Example #1
0
    public void playCreature(PointerEventData eventData, Draggable d)
    {
        CardGOInstance cardInstance = eventData.pointerDrag.GetComponent <CardGOInstance>();
        Card           card         = cardInstance.card;

        int      player_side    = this.getPlayerId();
        Position field_position = getCardPosition(player_side);

        //se o servidor deixar ele jogar a cartita;
        if (card.isCreature() && server.tryPlayCharacter(card, field_position, d.hand_index))
        {
            d.parentToReturnTo = this.transform;
            d.cardIs           = "played";
            empty = false;

            cardInstance.setFieldPosition(transform.name, field_position);
            server.playerPlayCreature(card, field_position);
            //addCreatureAttributes(d.gameObject, card);
        }
    }
Example #2
0
    public void createCard(Card card, Position pos, int player_id)
    {
        if (getCardByPosition(pos) != null)
        {
            return;
        }

        card.setPlayerId(player_id);

        //instância uma nova carta
        GameObject card_go = (GameObject)UnityEngine.Object.Instantiate(card_prefab, Vector3.zero, new Quaternion(0, 0, 0, 0));

        CardGOInstance card_instance = card_go.GetComponent <CardGOInstance>();

        card_instance.setControlReference();
        card_instance.setCard(card);
        card_instance.setCardImage();
        string go_name = this.getGameObjectCardPosition(pos);

        card_instance.setFieldPosition(go_name, pos);

        card_go.AddComponent <CardArrowDrop>();
        card_go.AddComponent <EffectTargetUI>();
    }