Move InsightLevel into BattleState
This commit is contained in:
parent
cb88ae78b6
commit
c2fc8b0904
3 changed files with 10 additions and 8 deletions
|
|
@ -7,7 +7,6 @@ using UnityEngine.SceneManagement;
|
|||
public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffectResolver, MonsterViewpoint
|
||||
{
|
||||
private bool STABLE_HAND_STYLE = true;
|
||||
private int STARTING_INSIGHT = 3;
|
||||
|
||||
// Inspector public
|
||||
public GameObject uiCanvas;
|
||||
|
|
@ -25,7 +24,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
private BattleMonster[] monsters;
|
||||
|
||||
private BattleState state;
|
||||
private InsightLevel insightLevel;
|
||||
private HandPlayability<HeroCard> heroHandPlayability;
|
||||
private HandPlayability<MonsterCard> monsterHandPlayability;
|
||||
private TurnIntentions<MonsterCard> monsterIntentions;
|
||||
|
|
@ -49,8 +47,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
this.heroEnergyUI.Init(this.state.HeroEnergy);
|
||||
this.monsterEnergyUI.Init(this.state.MonsterEnergy);
|
||||
|
||||
this.insightLevel = new InsightLevel(STARTING_INSIGHT);
|
||||
|
||||
this.heroes = new BattleHero[parameters.HeroIds.Length];
|
||||
for (int i = 0; i < this.heroes.Length; i++) {
|
||||
HeroId id = parameters.HeroIds[i];
|
||||
|
|
@ -98,10 +94,9 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
this.state.MonsterDeck, this.state.MonsterEnergy, this.monsterHandPlayability);
|
||||
|
||||
this.battlePlayerControls.Init(
|
||||
this.state.HeroDeck, this.state.MonsterDeck, this.state.PlayArea, this.insightLevel,
|
||||
this.state.HeroDeck, this.state.MonsterDeck, this.state.PlayArea, this.state.InsightLevel,
|
||||
this.heroHandPlayability, this.monsterHandPlayability, this.monsterIntentions,
|
||||
this.uiCanvas.transform.localScale.x);
|
||||
this.insightLevel.OnChanged += this.battlePlayerControls.NotifyInsightLevelChanged;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
|
@ -114,7 +109,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
BattleResult.FinishBattle(new BattleResult(true));
|
||||
};
|
||||
cheat.OnInsightCode += delegate {
|
||||
this.insightLevel.Modify(+5);
|
||||
this.state.InsightLevel.Modify(+5);
|
||||
};
|
||||
cheat.OnOneHPCode += delegate {
|
||||
foreach (BattleMonster m in this.monsters) {
|
||||
|
|
@ -398,7 +393,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
}
|
||||
|
||||
public void ModifyInsight(ModifyInsightEffect effect) {
|
||||
this.insightLevel.Modify(effect.Amount);
|
||||
this.state.InsightLevel.Modify(effect.Amount);
|
||||
}
|
||||
|
||||
public void DrawCards(DrawCardsEffect effect) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
this.monsterHandControls.OnCardClicked += OnMonsterCardClicked;
|
||||
this.cardsInPlayUIs = new Dictionary<BaseCard, GameObject>();
|
||||
|
||||
insightLevel.OnChanged += this.NotifyInsightLevelChanged;
|
||||
NotifyInsightLevelChanged();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ public class BattleState
|
|||
private BattleDeck<HeroCard> heroDeck;
|
||||
private BattleDeck<MonsterCard> monsterDeck;
|
||||
private PlayArea playArea;
|
||||
private InsightLevel insightLevel;
|
||||
|
||||
private int STARTING_INSIGHT = 3;
|
||||
|
||||
public BattleState() {
|
||||
this.clock = new BattleClock();
|
||||
|
|
@ -20,6 +23,8 @@ public class BattleState
|
|||
this.heroEnergy = new EnergyPool();
|
||||
this.monsterEnergy = new EnergyPool();
|
||||
this.playArea = new PlayArea();
|
||||
this.insightLevel = new InsightLevel(STARTING_INSIGHT);
|
||||
|
||||
}
|
||||
|
||||
public void SetDecks(BattleDeck<HeroCard> heroDeck, BattleDeck<MonsterCard> monsterDeck) {
|
||||
|
|
@ -60,4 +65,5 @@ public class BattleState
|
|||
public BattleDeck<HeroCard> HeroDeck {get => this.heroDeck;}
|
||||
public BattleDeck<MonsterCard> MonsterDeck {get => this.monsterDeck;}
|
||||
public PlayArea PlayArea {get => this.playArea;}
|
||||
public InsightLevel InsightLevel {get => this.insightLevel;}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue