Create HeroDeck with state of cards
This commit is contained in:
parent
967c871ed9
commit
567b732f85
7 changed files with 175 additions and 17 deletions
|
|
@ -14,9 +14,13 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
public delegate void TurnPassedAction();
|
||||
public event TurnPassedAction OnTurnPassed;
|
||||
|
||||
private List<BaseCard> cardsInHand;
|
||||
private HeroDeck heroDeck;
|
||||
private List<GameObject> cardsInHandUIs;
|
||||
|
||||
public void Init(HeroDeck heroDeck) {
|
||||
this.heroDeck = heroDeck;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
|
@ -29,7 +33,13 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
|
||||
}
|
||||
|
||||
public void SetHand(List<BaseCard> hand) {
|
||||
private void SetHand(List<BaseCard> hand) {
|
||||
if (this.cardsInHandUIs != null) {
|
||||
foreach (GameObject cardInHandUI in this.cardsInHandUIs) {
|
||||
Destroy(cardInHandUI);
|
||||
}
|
||||
}
|
||||
|
||||
this.cardsInHandUIs = new List<GameObject>();
|
||||
for (int i = 0; i < hand.Count; i++) {
|
||||
BaseCard card = hand[i];
|
||||
|
|
@ -87,4 +97,8 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
public bool IsTargeting() {
|
||||
return this.waitingForTarget;
|
||||
}
|
||||
|
||||
public void NotifyHandPileChanged() {
|
||||
SetHand(this.heroDeck.GetHand());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue