mixedcards/Assets/Battle/BattleState.cs
2020-09-30 22:24:12 -04:00

41 lines
1.1 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BattleState
{
private TeamChoice mTeamsTurn = TeamChoice.Monsters;
private bool mPlayedEmotion;
private int mRound = 0;
public bool IsTeamsTurn(TeamChoice team) {
return team == mTeamsTurn;
}
public bool CanPlayEmotion(TeamChoice team) {
return !mPlayedEmotion && IsTeamsTurn(team);
}
public void NotifyPlayedEmotion(TeamChoice team) {
if (!CanPlayEmotion(team)) {
throw new System.InvalidOperationException("BattleState received NotifyPlayedEmotion but "
+ "cannot play emotion");
}
mPlayedEmotion = 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++;
}
}
}