Exemple #1
0
    public void OnDrop(PointerEventData eventData)
    {
        if (scriptP1.myTurn)
        {
            GameObject  d        = eventData.pointerDrag;
            Playable    dScript  = d.GetComponent <Playable>();
            CardDisplay cardInfo = d.GetComponent <CardDisplay>();

            if (cardInfo.card.manaCost <= scriptP1.manaCrystals)
            {
                cardsOnTable.Add(scriptP1.cardsInHand[dScript.originSiblingIndex]);
                GameObject minion = MakeMinions(scriptP1.cardsInHand[dScript.originSiblingIndex], cardsOnTableGO);
                minion.tag             = "p1";
                scriptP1.manaCrystals -= cardInfo.card.manaCost;
                Destroy(d);
                dScript.GetIndex();
                scriptP1.cardsInHandGO.RemoveAt(dScript.originSiblingIndex);
                scriptP1.cardsInHand.RemoveAt(dScript.originSiblingIndex);
                scriptP1.UpdateHandPlacement();
                UpdateHandPlacement();
            }
        }
    }