Implement OilOfSharpness
This commit is contained in:
parent
2190070fee
commit
31cb8fe4c0
45 changed files with 604 additions and 21 deletions
29
Assets/Battle/BattleClock.cs
Normal file
29
Assets/Battle/BattleClock.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
public class BattleClock {
|
||||
public delegate void TimeChangedAction(BattleTime timeNow);
|
||||
public event TimeChangedAction OnTimeChanged;
|
||||
|
||||
private int mRoundNumber;
|
||||
private RoundStep mStep;
|
||||
|
||||
public BattleClock() {
|
||||
mRoundNumber = 0;
|
||||
mStep = RoundStep.None;
|
||||
}
|
||||
|
||||
public void AdvanceRound() {
|
||||
mRoundNumber++;
|
||||
mStep = RoundStep.StartOfRound;
|
||||
TriggerOnTimeChanged();
|
||||
}
|
||||
|
||||
public void AdvanceToStep(RoundStep step) {
|
||||
mStep = step;
|
||||
TriggerOnTimeChanged();
|
||||
}
|
||||
|
||||
private void TriggerOnTimeChanged() {
|
||||
if (OnTimeChanged != null) OnTimeChanged(this.Now);
|
||||
}
|
||||
|
||||
public BattleTime Now {get => new BattleTime(mRoundNumber, mStep);}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue