28 lines
No EOL
513 B
C#
28 lines
No EOL
513 B
C#
namespace Domain {
|
|
public class Model {
|
|
public int Score { private set; get; }
|
|
|
|
public readonly int SpawnRate;
|
|
private bool _needsToSpawn;
|
|
|
|
public Model(int spawnRate) : this(0, spawnRate) { }
|
|
|
|
public Model(int score, int spawnRate) {
|
|
Score = score;
|
|
SpawnRate = spawnRate;
|
|
}
|
|
|
|
public void AddScore() {
|
|
Score++;
|
|
if (Score % SpawnRate == 0)
|
|
_needsToSpawn = true;
|
|
}
|
|
|
|
public bool NeedsToSpawn() {
|
|
bool needs = _needsToSpawn;
|
|
_needsToSpawn = false;
|
|
|
|
return needs;
|
|
}
|
|
}
|
|
} |