using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class BattlePlayerControls : MonoBehaviour { public BattleController battleController; public GameObject uiCanvas; public GameObject cardPrefab; public delegate void CardUsedAction(BaseCard card); public event CardUsedAction OnCardUsed; public delegate void TurnPassedAction(); public event TurnPassedAction OnTurnPassed; private HeroDeck heroDeck; private List cardsInHandUIs; public void Init(HeroDeck heroDeck) { this.heroDeck = heroDeck; } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } private void SetHand(List hand) { if (this.cardsInHandUIs != null) { foreach (GameObject cardInHandUI in this.cardsInHandUIs) { Destroy(cardInHandUI); } } this.cardsInHandUIs = new List(); for (int i = 0; i < hand.Count; i++) { BaseCard card = hand[i]; GameObject cardUI = Instantiate(this.cardPrefab, this.uiCanvas.transform); this.cardsInHandUIs.Add(cardUI); cardUI.transform.position = CalculateCardPosition(i, hand.Count); cardUI.GetComponent().Init(card); int cardIndex = i; cardUI.GetComponent