public void AddCardToHand(Card card, bool ethereal) { Canvas canvas = FindObjectOfType <Canvas>(); CardInHand newCard = GameObject.Instantiate(cardPrefab, canvas.transform).GetComponent <CardInHand>(); newCard.card = card; newCard.active = true; newCard.gameObject.name = "Card " + card.name; newCard.transform.localPosition = drawPile.localPosition; newCard.transform.SetParent(rectTransform); newCard.hand = this; newCard.hoverable = true; CardGameObject cardGO = newCard.GetComponent <CardGameObject>(); if (ethereal) { cardGO.ethereal = true; } cardGO.card = card; cardGO.cardButton.onClick.AddListener(delegate { FindObjectOfType <BattleManager>().SelectCard(cardGO, player); }); cardsInHand.Add(newCard); newCard.GetComponent <CardInHand>().orderInHand = rectTransform.childCount; newCard.GetComponent <DisplayCard>().Display(cardGO); RecalculateCardsPosition(); }
public void AddCardToHand(Card card) { Transform playerUI = transform.parent; CardInHand newCard = GameObject.Instantiate(cardPrefab, playerUI).GetComponent <CardInHand>(); newCard.card = card; newCard.active = true; newCard.gameObject.name = "Card " + card.name + " " + (cardsInHand.Count + 1); newCard.transform.localScale = Vector3.zero; newCard.transform.localPosition = drawPilePosition.localPosition; newCard.transform.SetParent(rectTransform); newCard.hand = this; newCard.hoverable = true; CardGameObject cardGO = newCard.GetComponent <CardGameObject>(); cardGO.card = card; cardGO.cardButton.onClick.AddListener(delegate { FindObjectOfType <InputManager>().ButtonInput_SelectCard(cardGO, player); }); cardsInHand.Add(newCard); newCard.GetComponent <CardInHand>().orderInHand = rectTransform.childCount; newCard.GetComponent <DisplayCard>().Display(cardGO); RecalculateCardsPosition(); }
void HoverOverCard(CardInHand card) { UnhoverOverCard(); currentHand = card.hand; displayCard.gameObject.SetActive(true); displayCard.Display(card.GetComponent <CardGameObject>()); currentHand.RecalculateCardsPosition(); }
void HoverOverCard(CardInHand card) { UnhoverOverCard(); currentHover = card; currentHoverIndex = card.orderInHand - 1; displayCard.gameObject.SetActive(true); displayCard.Display(card.GetComponent <CardGameObject>()); RecalculateCardsPosition(); }
void DisplayCard(bool display, CardInHand card) { if (display) { displayCard.gameObject.SetActive(true); displayCard.Display(card.GetComponent <CardGameObject>()); } else { displayCard.gameObject.SetActive(false); } }