Implement emotions

This commit is contained in:
henriquenakashima 2020-09-26 18:24:46 -04:00
parent 08c395cf51
commit 11df4f1164
25 changed files with 369 additions and 40 deletions

View file

@ -8,6 +8,7 @@ public class BattleState
// public delegate void BattleStateChangedAction();
// public event BattleStateChangedAction OnBattleStateChanged;
private bool heroTurn;
private bool playedEmotion;
public bool IsTeamsTurn(TeamChoice team) {
if (team == TeamChoice.Heroes) {
@ -17,5 +18,24 @@ public class BattleState
}
}
public bool HeroTurn {get => this.heroTurn; set => this.heroTurn = value;}
public bool CanPlayEmotion(TeamChoice team) {
return !this.playedEmotion && IsTeamsTurn(team);
}
public void NotifyPlayedEmotion(TeamChoice team) {
if (!this.CanPlayEmotion(team)) {
throw new System.InvalidOperationException("BattleState received NotifyPlayedEmotion but "
+ "cannot play emotion");
}
this.playedEmotion = true;
}
public bool HeroTurn {
get => this.heroTurn;
set {
this.heroTurn = value;
this.playedEmotion = false;
}
}
}