mixedcards/Assets/Battle/BattleState.cs
2020-10-13 00:58:33 -04:00

60 lines
1.9 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;
private BattleDeck<HeroCard> heroDeck;
private BattleDeck<MonsterCard> monsterDeck;
public BattleState() {
this.clock = new BattleClock();
this.buffManager = new BuffManager(this.clock);
this.heroEnergy = new EnergyPool();
this.monsterEnergy = new EnergyPool();
}
public void SetDecks(BattleDeck<HeroCard> heroDeck, BattleDeck<MonsterCard> monsterDeck) {
this.heroDeck = heroDeck;
this.monsterDeck = monsterDeck;
}
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;}
public BattleDeck<HeroCard> HeroDeck {get => this.heroDeck;}
public BattleDeck<MonsterCard> MonsterDeck {get => this.monsterDeck;}
}