Finish merging BattleClock and BattleState
This commit is contained in:
parent
658978682b
commit
5962ea9fd6
4 changed files with 17 additions and 25 deletions
|
|
@ -5,9 +5,7 @@ using UnityEngine;
|
|||
|
||||
public class BattleState
|
||||
{
|
||||
private TeamChoice mTeamsTurn = TeamChoice.Monsters;
|
||||
private bool mPlayedEmotion;
|
||||
private int mRound = 0;
|
||||
private bool playedEmotion;
|
||||
private BattleClock clock;
|
||||
private BuffManager buffManager;
|
||||
|
||||
|
|
@ -16,12 +14,16 @@ public class BattleState
|
|||
this.buffManager = new BuffManager(this.clock);
|
||||
}
|
||||
|
||||
public bool IsTeamsTurn(TeamChoice team) {
|
||||
return team == mTeamsTurn;
|
||||
public bool IsTeamsTurnToPlay(TeamChoice team) {
|
||||
if (team == TeamChoice.Heroes) {
|
||||
return this.clock.Now.RoundStep == RoundStep.StartOfHeroTurn;
|
||||
} else {
|
||||
return this.clock.Now.RoundStep == RoundStep.StartOfMonsterTurn;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanPlayEmotion(TeamChoice team) {
|
||||
return !mPlayedEmotion && IsTeamsTurn(team);
|
||||
return !playedEmotion && IsTeamsTurnToPlay(team);
|
||||
}
|
||||
|
||||
public void NotifyPlayedEmotion(TeamChoice team) {
|
||||
|
|
@ -30,20 +32,11 @@ public class BattleState
|
|||
+ "cannot play emotion");
|
||||
}
|
||||
|
||||
mPlayedEmotion = true;
|
||||
playedEmotion = true;
|
||||
}
|
||||
|
||||
public int Round {get => mRound;}
|
||||
|
||||
public void AdvanceToTeamTurn(TeamChoice team) {
|
||||
if (team == mTeamsTurn) {
|
||||
throw new System.InvalidOperationException("Already in turn of team " + team);
|
||||
}
|
||||
mTeamsTurn = team;
|
||||
mPlayedEmotion = false;
|
||||
if (team == TeamChoice.Heroes) {
|
||||
mRound++;
|
||||
}
|
||||
public void ClearEmotionPlayed() {
|
||||
this.playedEmotion = false;
|
||||
}
|
||||
|
||||
public BattleClock Clock {get => this.clock;}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue