public void PlaceCard(CardBehaviourScript card) { if (card.team == CardBehaviourScript.Team.My && MyMana - card.mana >= 0 && MyTableCards.Count < 10) { //card.gameObject.transform.position = MyTablePos.position; card.GetComponent <CardBehaviourScript>().newPos = MyTablePos.position; MyHandCards.Remove(card.gameObject); MyTableCards.Add(card.gameObject); card.SetCardStatus(CardBehaviourScript.CardStatus.OnTable); //PlaySound(cardDrop); if (card.cardtype == CardBehaviourScript.CardType.Magic)///Apply Magic Effect { card.canPlay = true; if (card.cardeffect == CardBehaviourScript.CardEffect.ToAll) { card.AddToAll(card, true, delegate { card.Destroy(card); }); } else if (card.cardeffect == CardBehaviourScript.CardEffect.ToEnemies) { card.AddToEnemies(card, AITableCards, true, delegate { card.Destroy(card); }); } } MyMana -= card.mana; } if (card.team == CardBehaviourScript.Team.AI && AIMana - card.mana >= 0 && AITableCards.Count < 10) { //card.gameObject.transform.position = AITablePos.position; card.GetComponent <CardBehaviourScript>().newPos = AITablePos.position; AIHandCards.Remove(card.gameObject); AITableCards.Add(card.gameObject); card.SetCardStatus(CardBehaviourScript.CardStatus.OnTable); //PlaySound(cardDrop); if (card.cardtype == CardBehaviourScript.CardType.Magic)///Apply Magic Effect { card.canPlay = true; if (card.cardeffect == CardBehaviourScript.CardEffect.ToAll) { card.AddToAll(card, true, delegate { card.Destroy(card); }); } else if (card.cardeffect == CardBehaviourScript.CardEffect.ToEnemies) { card.AddToEnemies(card, MyTableCards, true, delegate { card.Destroy(card); }); } } AIMana -= card.mana; } TablePositionUpdate(); HandPositionUpdate(); UpdateGame(); }
public void PlaceCard(CardBehaviourScript temp) { // //Find That Card // CardBehaviourScript card = AIHandCards.Find(item => item._name == temp._name); if (card.team == CardBehaviourScript.Team.AI && AIMana - card.mana >= 0 && AITableCards.Count < 10) { AIHandCards.Remove(card); AITableCards.Add(card); Action a; a.Card1 = card._name; a.Card2 = ""; a.Hero = ""; a.OpCode = 0; Actions.Enqueue(a); card.SetCardStatus(CardBehaviourScript.CardStatus.OnTable); if (card.cardtype == CardBehaviourScript.CardType.Magic)///Apply Magic Effect { card.canPlay = true; if (card.cardeffect == CardBehaviourScript.CardEffect.ToAll) { card.AddToAll(card, false, delegate { card.Destroy(card); }); } else if (card.cardeffect == CardBehaviourScript.CardEffect.ToEnemies) { card.AddToEnemies(card, PlayerTableCards, false, delegate { card.Destroy(card); }); } } AIMana -= card.mana; } }