refactor: renamed Model.cs to Score.cs
This commit is contained in:
parent
2be3b572fb
commit
5d470a57af
8 changed files with 48 additions and 48 deletions
|
@ -1,29 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
Assets/Scripts/Domain/Score.cs
Normal file
29
Assets/Scripts/Domain/Score.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
namespace Domain {
|
||||
public class Score {
|
||||
public int Value { private set; get; }
|
||||
|
||||
public readonly int SpawnRate;
|
||||
public readonly int GrowIterations;
|
||||
|
||||
public float GrowPercentage { private set; get; }
|
||||
|
||||
public Score(int spawnRate, int growIterations) : this(0, spawnRate, growIterations) { }
|
||||
|
||||
public Score(int value, int spawnRate, int growIterations) {
|
||||
Value = value;
|
||||
SpawnRate = spawnRate;
|
||||
GrowIterations = growIterations;
|
||||
}
|
||||
|
||||
public void Add() {
|
||||
Value++;
|
||||
|
||||
if (Value % GrowIterations == 0) {
|
||||
float relativeScore = Value % (GrowIterations * SpawnRate);
|
||||
if (relativeScore == 0 && Value != 0)
|
||||
relativeScore = GrowIterations * SpawnRate;
|
||||
GrowPercentage = relativeScore / (SpawnRate * GrowIterations);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue