diff --git a/Assets/Battle/BattleController.cs b/Assets/Battle/BattleController.cs index e6c2848..f334a98 100644 --- a/Assets/Battle/BattleController.cs +++ b/Assets/Battle/BattleController.cs @@ -51,7 +51,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe heroSprites[i] = HeroDatabase.createHeroSprite(id); heroSprites[i].name = "Hero" + i + "_Sprite"; - heroSprites[i].transform.position = new Vector3(-1 + -3 + 3 * i, 0, 0); + heroSprites[i].transform.position = new Vector3(-1 + -3 + 3 * i, -1.8f, 0); BattleParticipantSprite bps = heroSprites[i].AddComponent(); bps.Init(battlePlayerControls, heroes[i]); bps.OnSpriteClicked += battlePlayerControls.NotifyParticipantSpriteClicked; @@ -71,7 +71,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe monsterSprites[i] = MonsterDatabase.createMonsterSprite(id); monsterSprites[i].name = "Monster" + i + "_Sprite"; - monsterSprites[i].transform.position = new Vector3(+1 + -3 + 3 * i, 3, 0); + monsterSprites[i].transform.position = new Vector3(+1 + -3 + 3 * i, 1.2f, 0); BattleParticipantSprite bps = monsterSprites[i].AddComponent(); bps.Init(battlePlayerControls, monsters[i]); bps.OnSpriteClicked += battlePlayerControls.NotifyParticipantSpriteClicked; @@ -100,10 +100,11 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe this.playArea = new PlayArea(); - this.battlePlayerControls.Init(this.heroDeck, this.playArea); + this.battlePlayerControls.Init(this.heroDeck, this.monsterDeck, this.playArea); this.battlePlayerControls.OnCardUsed += this.NotifyHeroCardUsed; this.battlePlayerControls.OnTurnPassed += this.NotifyHeroTurnPassed; - this.heroDeck.OnHandPileChanged += this.battlePlayerControls.NotifyHandPileChanged; + this.heroDeck.OnHandPileChanged += this.battlePlayerControls.NotifyHeroHandPileChanged; + this.monsterDeck.OnHandPileChanged += this.battlePlayerControls.NotifyMonsterHandPileChanged; } private BattleParticipant FindHeroByClass(HeroId heroId) { diff --git a/Assets/Battle/BattlePlayerControls.cs b/Assets/Battle/BattlePlayerControls.cs index b8f82e6..738ee96 100644 --- a/Assets/Battle/BattlePlayerControls.cs +++ b/Assets/Battle/BattlePlayerControls.cs @@ -7,7 +7,7 @@ using UnityEngine.UI; public class BattlePlayerControls : MonoBehaviour { // TODO: Draw enemy permanents - + public BattleController battleController; public GameObject uiCanvas; public GameObject cardPrefab; @@ -18,12 +18,15 @@ public class BattlePlayerControls : MonoBehaviour public event TurnPassedAction OnTurnPassed; private BattleDeck heroDeck; + private BattleDeck monsterDeck; private List cardsInHandUIs; private PlayArea playArea; private Dictionary cardsInPlayUIs; - public void Init(BattleDeck heroDeck, PlayArea playArea) { + public void Init( + BattleDeck heroDeck, BattleDeck monsterDeck, PlayArea playArea) { this.heroDeck = heroDeck; + this.monsterDeck = monsterDeck; this.playArea = playArea; this.cardsInPlayUIs = new Dictionary(); @@ -42,7 +45,7 @@ public class BattlePlayerControls : MonoBehaviour } - private void SetHand(List hand) { + private void SetHeroHand(List hand) { if (this.cardsInHandUIs != null) { foreach (GameObject cardInHandUI in this.cardsInHandUIs) { Destroy(cardInHandUI); @@ -61,6 +64,10 @@ public class BattlePlayerControls : MonoBehaviour } } + private void SetMonsterHand(List hand) { + // TODO + } + private const int CARD_WIDTH = 122; private const int CARD_HEIGHT = 155; @@ -69,7 +76,7 @@ public class BattlePlayerControls : MonoBehaviour const int DELTA = CARD_WIDTH + SPACING; return new Vector3(Screen.width * 0.5f - DELTA / 2 * (count - 1) + DELTA * index, - 160, + SPACING + CARD_HEIGHT / 2, 0); } @@ -105,8 +112,12 @@ public class BattlePlayerControls : MonoBehaviour return this.singleTargeting != null && this.singleTargeting.CanTarget(participant); } - public void NotifyHandPileChanged() { - SetHand(this.heroDeck.GetHandPile().Cast().ToList()); + public void NotifyHeroHandPileChanged() { + SetHeroHand(this.heroDeck.GetHandPile().ToList()); + } + + public void NotifyMonsterHandPileChanged() { + SetMonsterHand(this.monsterDeck.GetHandPile().ToList()); } private void NotifyPlayAreaChanged() {