Example #1
0
    public void SetSelected(GameObject card)
    {
        CardController selected = null;
        GameObject     obj      = null;

        foreach (GameObject o in campo)
        {
            CardController b = GetBehav(o);
            if (b.selected)
            {
                selected = b;
            }
            if (o == card)
            {
                obj = o;
            }
        }

        CardController cb = GetBehav(obj);

        if (cb.selected)
        {
            cb.Deselect();
        }
        else
        {
            if (selected != null)
            {
                selected.Deselect();
            }
            cb.Select();
        }
    }
Example #2
0
    void OnMouseUpAsButton()
    {
        if (active)
        {
            selected = !selected;

            if (selected)
            {
                cardSlotScript.ChangeCardSlot(direction, true);
                pairController.PairSelect();
            }

            if (!selected)
            {
                cardSlotScript.ChangeCardSlot(direction, false);
                pairController.Deselect();
            }

            cardTexture.sprite = idleTexture;
        }
    }