public void SetEffect(string text, Item item, CardButton cardButton) { quantityText.text = text; normalText.gameObject.SetActive(false); inventorySlot.SetSlot(item, true); // Make clicking on the inventory slots select the card inventorySlot.GetComponent <Button>().onClick = cardButton.GetComponent <Button>().onClick; }
/// <summary> /// Play card and damage the opposing player /// </summary> public void PlaceCardOffense(CardButton button, ICard card) { if (currentTurn == Turn.Defender && button.associatedPlayer == defender) { if(defender.attack.Count < 5) { button.GetComponent<Animator>().runtimeAnimatorController = canvasManager.tableAnimator; defender.hand.Remove(button); defender.attack.Add(button); button.GetComponent<RectTransform>().SetParent(defender.attackTransform); } } else if (currentTurn == Turn.Attacker && button.associatedPlayer == attacker) { if (attacker.attack.Count < 5) { button.GetComponent<Animator>().runtimeAnimatorController = canvasManager.tableAnimator; attacker.hand.Remove(button); attacker.attack.Add(button); button.GetComponent<RectTransform>().SetParent(attacker.attackTransform); } } }
/// <summary> /// Returns true is card is discarded /// </summary> public bool DiscardCard(CardButton card) { string cardName = CardParser.deparseCard(card.GetComponent <CardButton>().myCard); if (GameManager.instance.discardCard(cardName)) { GameManager.instance.finishFinalTurn(card); GameManager.instance.myHand.Remove(card); CardPooler.instance.PushCard(card.gameObject); NotificationManager.instance.myTurn(false); return(true); } else { return(false); } }
public void SelectCard(CardData cardData) { selectedCard.GetComponent <CardButton>().SetCard(cardData); }