public void MoveCard(int cardIndex, CardHolder other, out TweenHolder outTween, bool?visibleDuringTween, int indexToInsertAt = -1)
    {
        CardController cardBeingMoved = _Cards[cardIndex];

        _Cards.RemoveAt(cardIndex);
        if (!other._Cards.InsertionIndexIsValid(indexToInsertAt))
        {
            indexToInsertAt = other._Cards.Count;
        }
        other.AddCard(cardBeingMoved, indexToInsertAt);

        cardBeingMoved.ViewFSM.SetAnimState(other._cardsAnimState, performTweens: false);
        cardBeingMoved.ViewFSM.SetTextVisibility(visibleDuringTween ?? other._cardsTextVisibility);

        outTween = cardBeingMoved.AddOffsetHeightTween(_cardAnimationData.GeneralCardMoveHeight,
                                                       other.GetFinalPositionOfCardAtIndex(indexToInsertAt), true)
                   .AddLocalRotationTween(Vector3.one * 360.0f + cardBeingMoved.ViewFSM.GetAnimRotationOffset())
                   .AddIncrementalScaleTween(cardBeingMoved.ViewFSM.GetAnimScale())
                   .SetDuration(_cardAnimationData.GeneralCardMoveDuration)
                   .SetShouldChangeLayer(true)
                   .AddToOnFinishedOnce(() => other.OnCardRecieveTweenFinished(cardBeingMoved));

        OnCardSent(cardBeingMoved);
        other.OnCardRecieveTweenBegan(cardBeingMoved);

        if (CardFlipAudio != null)
        {
            CardFlipAudio.Play();
        }
    }
Exemple #2
0
    public void OnMouseUp()
    {
        if (Manager.Instance && !Manager.Instance.CanInteract())
        {
            if (Application.isEditor && Input.GetKey(KeyCode.K))
            {
                Explode();
            }

            return;
        }

        SetHeight(false);

        currentHolder.AddCard(this, false);

        sprite.sortingLayerName = "Default";

        face.Emote(Face.Emotion.Happy, Face.Emotion.Default, 1f);
        AudioManager.Instance.PlayEffectAt(24, transform.position, 1f);
    }
Exemple #3
0
    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);
    }