51 lines
1.4 KiB
C#
51 lines
1.4 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 BattleClock clock;
|
|
private BuffManager buffManager;
|
|
|
|
public BattleState() {
|
|
this.clock = new BattleClock();
|
|
this.buffManager = new BuffManager(this.clock);
|
|
}
|
|
|
|
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 BattleClock Clock {get => this.clock;}
|
|
public BuffManager BuffManager {get => this.buffManager;}
|
|
}
|