Example #1
0
File: Card.cs Project: gbdb71/ld40
    public void OnMouseUp()
    {
        if (!Manager.Instance.CanInteract())
        {
            return;
        }

        dragging = false;

        height = 0f;

        int type = isMatrix ? 0 : 1;

        if (dragTime < 0.25f && !LeftArea(1.2f))
        {
            UseCard();
            return;
        }
        else
        {
            Collider2D hit = Physics2D.OverlapBox(transform.position, coll.bounds.size, 0, areaMask);

            if (hit)
            {
                CardHolder holder = hit.GetComponent <CardHolder> ();
                if (holder.Allows(type))
                {
                    holder.AddCard(this, false);
                    return;
                }
            }

            AudioManager.Instance.PlayEffectAt(6, transform.position, 0.5f);
        }

        currentHolder.AddCard(this, true);
    }