29 lines
No EOL
764 B
C#
29 lines
No EOL
764 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 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++;
|
|
|
|
if (Score % GrowIterations == 0) {
|
|
float relativeScore = Score % (GrowIterations * SpawnRate);
|
|
if (relativeScore == 0 && Score != 0)
|
|
relativeScore = GrowIterations * SpawnRate;
|
|
GrowPercentage = relativeScore / (SpawnRate * GrowIterations);
|
|
}
|
|
}
|
|
}
|
|
} |