Implement emotions
This commit is contained in:
parent
08c395cf51
commit
11df4f1164
25 changed files with 369 additions and 40 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue