mixedcards/Assets/Battle/BattleState.cs
2020-10-10 21:49:04 -04:00

48 lines
1.3 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;
private BuffManager buffManager;
public BattleState(BuffManager buffManager) {
this.buffManager = buffManager;
}
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++;
}
}
public BuffManager BuffManager {get => this.buffManager;}
}