예제 #1
0
 void takeCard(Cell cell)
 {
     if (ViewCard != null && energy.CheckPrice(ViewCard.GetComponent <Card>().price))
     {
         GameObject found = MyCards.Find(item => item.GetComponent <Card>().index == ViewCard.GetComponent <Card>().index);
         MyCards.Remove(found);
         cell.PutCard(ViewCard);
         Destroy(ViewCard.GetComponent <Image>());
         Debug.Log("Price:");
         Debug.Log(ViewCard.GetComponent <Card>().price);
         energy.useEnergy(ViewCard.GetComponent <Card>().price);
         ViewCard = null;
         CameraAnimator.GetComponent <CameraAnimator>().StartReverseAnimation();
         MyCardsContainer.SetActive(true);
         MyCardsContainer.SetActive(true);
         Client.GetComponent <TCPClient>().SendEvent("message", "{\"cellId\": " + cell.Id + ", \"cardId\": " + cell.CardObject.GetComponent <Card>().id + ", \"event\": \"takeCard\"}");
     }
 }