Create CardDatabase
This commit is contained in:
parent
18cfff1135
commit
246b2471f4
6 changed files with 50 additions and 17 deletions
|
|
@ -29,20 +29,16 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
|
||||
}
|
||||
|
||||
public void SetHand(int numberOfCards) {
|
||||
this.cardsInHand = new List<BaseCard>();
|
||||
public void SetHand(List<BaseCard> hand) {
|
||||
this.cardsInHandUIs = new List<GameObject>();
|
||||
for (int i = 0; i < numberOfCards; i++) {
|
||||
// TODO
|
||||
BaseCard newCard = new CardCrashingPunch();
|
||||
this.cardsInHand.Add(newCard);
|
||||
|
||||
GameObject newCardUI = Instantiate(this.cardPrefab, this.uiCanvas.transform);
|
||||
this.cardsInHandUIs.Add(newCardUI);
|
||||
newCardUI.transform.position = CalculateCardPosition(i, numberOfCards);
|
||||
newCardUI.GetComponent<CardUI>().Init(newCard);
|
||||
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<CardUI>().Init(card);
|
||||
int cardIndex = i;
|
||||
newCardUI.GetComponent<Button>().onClick.AddListener(delegate {OnCardClicked(newCard);});
|
||||
cardUI.GetComponent<Button>().onClick.AddListener(delegate {OnCardClicked(card);});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue