mixedcards/Assets/Battle/BattleState.cs
2020-10-13 00:25:55 -04:00

44 lines
1.2 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BattleState
{
private bool playedEmotion;
private BattleClock clock;
private BuffManager buffManager;
public BattleState() {
this.clock = new BattleClock();
this.buffManager = new BuffManager(this.clock);
}
public bool IsTeamsTurnToPlay(TeamChoice team) {
if (team == TeamChoice.Heroes) {
return this.clock.Now.RoundStep == RoundStep.StartOfHeroTurn;
} else {
return this.clock.Now.RoundStep == RoundStep.StartOfMonsterTurn;
}
}
public bool CanPlayEmotion(TeamChoice team) {
return !playedEmotion && IsTeamsTurnToPlay(team);
}
public void NotifyPlayedEmotion(TeamChoice team) {
if (!CanPlayEmotion(team)) {
throw new System.InvalidOperationException("BattleState received NotifyPlayedEmotion but "
+ "cannot play emotion");
}
playedEmotion = true;
}
public void ClearEmotionPlayed() {
this.playedEmotion = false;
}
public BattleClock Clock {get => this.clock;}
public BuffManager BuffManager {get => this.buffManager;}
}