mixedcards/Assets/Battle/BattleState.cs
2020-09-26 18:24:46 -04:00

41 lines
1 KiB
C#

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;
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;
set {
this.heroTurn = value;
this.playedEmotion = false;
}
}
}