Beispiel #1
0
    public void ToRingSlot()
    {
        for (int i = 0; i < 4; i++)
        {
            if (!(Card.Caller.IsLocalPlayer ? UI.localRingSlots : UI.otherRingSlots)[i].occupied)
            {
                transform.SetParent((Card.Caller.IsLocalPlayer ? UI.localRingSlots : UI.otherRingSlots)[i].slot);

                (Card.Caller.IsLocalPlayer ? UI.localRingSlots : UI.otherRingSlots)[i].occupied = true;

                Card.RingSlot = i;

                break;
            }
        }

        RecT.anchorMin = RecT.anchorMax = Vector2.one * .5f;

        RecT.DOAnchorPos(Vector2.zero, 1).OnComplete(() => {
            transform.SetParent(transform.parent.parent);

            BigRec.anchorMin = BigRec.anchorMax = BigRec.pivot = Vector2.one * .5f;

            BigRec.anchoredPosition = Vector2.zero;

            Card.FinishedUsing();
        });
    }
Beispiel #2
0
    public void ToGraveyard(float speed, Action action, bool?flip = null)
    {
        SC_Graveyard target = Card.Caller.IsLocalPlayer == Card.Stolen ? GM.otherGraveyard : GM.localGraveyard;

        transform.SetParent(target.transform);

        SC_Deck.OrganizeHand(Card.Caller.IsLocalPlayer ? GM.localHand : GM.otherHand);

        RecT.anchorMin = RecT.anchorMax = RecT.pivot = Vector2.one * .5f;

        Flip(flip ?? !Card.Caller.IsLocalPlayer, speed);

        if (Card.OnTheRing)
        {
            Card.DiscardedFromRing();
        }

        RecT.DOAnchorPos(Vector2.zero, speed).OnComplete(() => {
            action();

            if (Card.Ephemeral)
            {
                Destroy(gameObject);
            }
            else
            {
                ShowAttackValues(false);

                target.Cards.Add(Card);
            }
        });
    }
Beispiel #3
0
    public IEnumerator DiscardToDeck(SC_Deck target)
    {
        target.cards.Add(Resources.Load <SC_BaseCard> (Card.Path));

        transform.SetParent(target.RecT);

        Flip(true, 1, false);

        (target.Local ? localPlayer.Graveyard : otherPlayer.Graveyard).Cards.Remove(Card);

        yield return(RecT.DOAnchorPos(Vector2.zero, 1).WaitForCompletion());

        Destroy(gameObject);
    }