Se ha utilizado GitHub Projects para la planificación del proyecto.
public static GameManager Instance { get; private set; }
private void Awake() {
if (Instance != null && Instance != this) {
Destroy(this);
} else {
Instance = this;
}
}
Características de C#
public float AverageCPM {
get {
if (typedWords.Count() == 0)
return defaultTypingSpeed;
return CalculateTypingSpeed(
typedWords.Select(c => c.word.Count()).Sum(),
typedWords.Select(c => c.seconds).Sum()
);
}
}
public class ScoreCalculator {
public int CurrentScore { get; private set; }
public void WordTyped(WordCPM wordCPM, float averageCPMLast10) {
GameManager gm = GameManager.Instance;
int perfectBonus = gm.config.perfectWordBonus;
int pointsPerCharacter = gm.config.pointsPerCharacter;
float cpmMultiplier = gm.getCPMScoreMultiplier(averageCPMLast10);
float wordAccuracy = (float)wordCPM.word.Count() /
(wordCPM.word.Count() + wordCPM.misses);
CurrentScore += (int)(wordCPM.word.Count() * pointsPerCharacter
* cpmMultiplier * wordAccuracy);
CurrentScore += wordAccuracy == 1f ? perfectBonus : 0;
}
}