using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class BattleState { // public delegate void BattleStateChangedAction(); // public event BattleStateChangedAction OnBattleStateChanged; private bool heroTurn; private bool playedEmotion; private int round = 0; public bool IsTeamsTurn(TeamChoice team) { if (team == TeamChoice.Heroes) { return this.HeroTurn; } else { return !this.HeroTurn; } } 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;} public int Round {get => this.round;} public void AdvanceToTeamTurn(TeamChoice team) { if (team == TeamChoice.Heroes) { if (this.heroTurn) { throw new System.InvalidOperationException("Already in hero turn"); } this.heroTurn = true; this.round++; } else { if (!this.heroTurn) { throw new System.InvalidOperationException("Already in monster turn"); } this.heroTurn = false; } this.playedEmotion = false; } }