mixedcards/Assets/Battle/BattleState.cs
2020-10-13 00:50:29 -04:00

51 lines
1.5 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;
private EnergyPool heroEnergy;
private EnergyPool monsterEnergy;
public BattleState() {
this.clock = new BattleClock();
this.buffManager = new BuffManager(this.clock);
this.heroEnergy = new EnergyPool();
this.monsterEnergy = new EnergyPool();
}
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;}
public EnergyPool HeroEnergy {get => this.heroEnergy;}
public EnergyPool MonsterEnergy {get => this.monsterEnergy;}
}