void IDropHandler.OnDrop(PointerEventData eventData) { Player player = playerPanel.GetComponent <Player>(); CardObjectSpawner cardObjectSpawner = objectSpawner.GetComponent <CardObjectSpawner>(); CardController cardController = eventData.pointerDrag.GetComponent <CardController>(); CardData cardData = eventData.pointerDrag.GetComponent <CardData>(); if (cardController != null && cardData != null) { if (player.CanDrawCard(cardData.manaCost)) { cardObjectSpawner.SpawnMinion(cardData); player.ReduceMana(cardData.manaCost); cardController.DestroyCard(); } } }
void _OnCardDestroyed(CardDestroyed e) { CardController.DestroyCard(e.player, e.card); }