Ejemplo n.º 1
0
    private async void PileToControllerHand(Action complete)
    {
        MotionManager.AddMotion();
        bool moveComplete = false;

        MoveToPosition(new Vector3(0, 0, -5), 1000, true, 20, () =>
        {
            moveComplete = true;
        });

        await new WaitUntil(() => moveComplete);
        await new WaitForSeconds(0.2f);

        Quaternion midle = Quaternion.Euler(0, -90, 0);

        //rotation
        float timeCouter = 0;

        while (timeCouter < 1)
        {
            timeCouter       += Time.deltaTime * 10f;
            cardTran.rotation = Quaternion.Lerp(Quaternion.identity, midle, timeCouter);
            await new WaitForUpdate();
        }

        cardUI.ShowFrontOfCard();
        render.flipX = true;
        Quaternion last = Quaternion.Euler(0, -180, 0);

        timeCouter = 0;

        while (timeCouter < 1)
        {
            timeCouter       += Time.deltaTime * 10f;
            cardTran.rotation = Quaternion.Lerp(midle, last, timeCouter);
            await new WaitForUpdate();
        }

        render.flipX      = false;
        cardTran.rotation = Quaternion.identity;
        cardUI.ShowFrontComplete();

        await new WaitForSeconds(0.2f);

        //move to hand
        HandUI.Instance.InsertCard(entity);
        entity.curStatus = CardEntity.status.inHand;

        MoveToPosition(HandUI.Instance.GetCardPosition(entity),
                       HandUI.Instance.cardInControllerHand.Count * 2, false, 20, () =>
        {
            MotionManager.RemoveMotion();
            complete?.Invoke();
        });
    }
Ejemplo n.º 2
0
    public async void HandToOpponentTopMogi(MogiEntity mogi, Action complete)
    {
        MotionManager.AddMotion();
        render.sortingOrder = 1000;
        bool moveComplete = false;

        MoveToPosition(new Vector3(0, 0, -5), 1000, true, 20, () =>
        {
            moveComplete = true;
        });

        await new WaitUntil(() => moveComplete);
        await new WaitForSeconds(0.2f);

        Quaternion midle = Quaternion.Euler(0, -90, 0);

        //rotation
        float timeCouter = 0;

        while (timeCouter < 1)
        {
            timeCouter       += Time.deltaTime * 10f;
            cardTran.rotation = Quaternion.Lerp(Quaternion.identity, midle, timeCouter);
            await new WaitForUpdate();
        }

        cardUI.ShowFrontOfCard();
        render.flipX = true;
        Quaternion last = Quaternion.Euler(0, -180, 0);

        timeCouter = 0;

        while (timeCouter < 1)
        {
            timeCouter       += Time.deltaTime * 10f;
            cardTran.rotation = Quaternion.Lerp(midle, last, timeCouter);
            await new WaitForUpdate();
        }

        render.flipX      = false;
        cardTran.rotation = Quaternion.identity;
        cardUI.ShowFrontComplete();

        await new WaitForSeconds(0.2f);

        MotionManager.RemoveMotion();

        MoveToTopOfMogi(mogi);

        await new WaitUntil(() => !MotionManager.running);

        complete?.Invoke();
    }
Ejemplo n.º 3
0
    private void PileToOpponentHand(Action complete)
    {
        MotionManager.AddMotion();
        HandUI.Instance.InsertCard(entity);
        entity.curStatus = CardEntity.status.inHand;

        render.sortingOrder = 1000;

        MoveToPosition(HandUI.Instance.GetCardPosition(entity),
                       HandUI.Instance.cardInOpponentHand.Count * 2, false, 10, () =>
        {
            MotionManager.RemoveMotion();
            complete?.Invoke();
        });
    }
Ejemplo n.º 4
0
    public async void MoveToSlot(SlotUI slot, bool moveToTop, Action complete)
    {
        MotionManager.AddMotion();

        if (!cardUI.showFront)
        {
            bool moveComplete = false;
            //move to center
            MoveToPosition(new Vector3(0, 0, -5), 1000, true, 20, () =>
            {
                moveComplete = true;
            });

            await new WaitUntil(() => moveComplete);

            await new WaitForSeconds(0.2f);

            Quaternion midle = Quaternion.Euler(0, -90, 0);

            //rotation
            float timeCouter = 0;
            while (timeCouter < 1)
            {
                timeCouter       += Time.deltaTime * 10f;
                cardTran.rotation = Quaternion.Lerp(Quaternion.identity, midle, timeCouter);
                await new WaitForUpdate();
            }

            cardUI.ShowFrontOfCard();

            render.flipX = true;
            Quaternion last = Quaternion.Euler(0, -180, 0);
            timeCouter = 0;

            while (timeCouter < 1)
            {
                timeCouter       += Time.deltaTime * 10f;
                cardTran.rotation = Quaternion.Lerp(midle, last, timeCouter);
                await new WaitForUpdate();
            }

            render.flipX      = false;
            cardTran.rotation = Quaternion.identity;
            cardUI.ShowFrontComplete();

            await new WaitForSeconds(0.2f);
        }

        int sorting = 1;

        if (moveToTop)
        {
            sorting = 1000;
        }

        MoveToPosition(slot.slotTransform.position, sorting, false, 10, () => {
            //move to hand
            MotionManager.RemoveMotion();
            if (!moveToTop)
            {
                entity.MoveToSlot();
            }
            complete.Invoke();
        });
    }
Ejemplo n.º 5
0
 private void Start()
 {
     MotionManager.AddMotion();
 }