diff --git a/Assets/Battle/BattleController.cs b/Assets/Battle/BattleController.cs index 1399345..c8e0d6c 100644 --- a/Assets/Battle/BattleController.cs +++ b/Assets/Battle/BattleController.cs @@ -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 heroHandPlayability; private HandPlayability monsterHandPlayability; private TurnIntentions 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) { diff --git a/Assets/Battle/BattlePlayerControls.cs b/Assets/Battle/BattlePlayerControls.cs index 277e7ef..a4bae53 100644 --- a/Assets/Battle/BattlePlayerControls.cs +++ b/Assets/Battle/BattlePlayerControls.cs @@ -45,6 +45,7 @@ public class BattlePlayerControls : MonoBehaviour this.monsterHandControls.OnCardClicked += OnMonsterCardClicked; this.cardsInPlayUIs = new Dictionary(); + insightLevel.OnChanged += this.NotifyInsightLevelChanged; NotifyInsightLevelChanged(); } diff --git a/Assets/Battle/BattleState.cs b/Assets/Battle/BattleState.cs index db179d2..ad9363d 100644 --- a/Assets/Battle/BattleState.cs +++ b/Assets/Battle/BattleState.cs @@ -13,6 +13,9 @@ public class BattleState private BattleDeck heroDeck; private BattleDeck 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 heroDeck, BattleDeck monsterDeck) { @@ -60,4 +65,5 @@ public class BattleState public BattleDeck HeroDeck {get => this.heroDeck;} public BattleDeck MonsterDeck {get => this.monsterDeck;} public PlayArea PlayArea {get => this.playArea;} + public InsightLevel InsightLevel {get => this.insightLevel;} }