Example #1
0
 private void OnMouseDown()
 {
     if (shop)
     {
         FindObjectOfType <PlayerInfo>().AddCard(gameObject.GetComponent <Card>());
         shop.RemoveAllBuyableCards();
     }
     else if (parentDeck && parentDeck.cardInHand(gameObject.GetComponent <Card>()) && !parentDeck.usedMaxCards())
     {
         parentDeck.UsedCard();
         if (gameObject.GetComponent <DamageCard>())
         {
             battle.PlayerAttack(gameObject.GetComponent <DamageCard>().GetDamage());
         }
         if (gameObject.GetComponent <BlockCard>())
         {
             battle.PlayerArmorUp(gameObject.GetComponent <BlockCard>().GetBlock());
         }
         if (gameObject.GetComponent <HealCard>())
         {
             battle.HealPlayer(gameObject.GetComponent <HealCard>().GetHealAmount());
         }
         parentDeck.DiscardCard(gameObject.GetComponent <Card>());
     }
     else
     {
         sell = FindObjectOfType <Sell>();
         if (sell)
         {
             Destroy(gameObject);
             sell.MoveDeckBack();
             sell.RemoveGoBackButton();
         }
         else
         {
             Debug.Log("Card is not in hand, reached max cards, or no parent object found");
         }
     }
 }