33 lines
No EOL
853 B
C#
33 lines
No EOL
853 B
C#
namespace Domain {
|
|
public class Model {
|
|
public int Score { private set; get; }
|
|
|
|
public readonly int SpawnRate;
|
|
public readonly int GrowIterations;
|
|
|
|
public float GrowPercentage { private set; get; }
|
|
|
|
public bool NeedsToSpawn { private set; get; }
|
|
public bool NeedsToAnimate { private set; get; }
|
|
|
|
public Model(int spawnRate, int growIterations) : this(0, spawnRate, growIterations) { }
|
|
|
|
public Model(int score, int spawnRate, int growIterations) {
|
|
Score = score;
|
|
SpawnRate = spawnRate;
|
|
GrowIterations = growIterations;
|
|
}
|
|
|
|
public void AddScore() {
|
|
Score++;
|
|
NeedsToAnimate = NeedsToSpawn = false;
|
|
|
|
if (Score % GrowIterations == 0) {
|
|
GrowPercentage = Score / (float)(SpawnRate * GrowIterations);
|
|
NeedsToAnimate = true;
|
|
}
|
|
if (Score % (SpawnRate * GrowIterations) == 0)
|
|
NeedsToSpawn = true;
|
|
}
|
|
}
|
|
} |