Exemple #1
0
    public void Fall(IMatchThreeItem item, bool isLast)
    {
        var animation = item.GetGameObject().transform.DOLocalMove(Vector3.zero, 0.5f).Pause();

        animation.SetEase(Ease.Linear);

        if (isLast)
        {
            animation.OnComplete(() =>
            {
                OnAnimationFallEndEvent?.Invoke(false);
                OnAnimationStateChangeEvent?.Invoke(false);
            });
        }

        animation.OnStart(() => OnAnimationStateChangeEvent?.Invoke(true));
        animation.Play();
    }
Exemple #2
0
    public void Swap(IMatchThreeItem first, IMatchThreeItem second, bool sendEvent)
    {
        var animFirst  = first.GetGameObject().transform.DOLocalMove(Vector3.zero, 0.5f).Pause();
        var animSecond = second.GetGameObject().transform.DOLocalMove(Vector3.zero, 0.5f).Pause();

        animFirst.SetEase(Ease.OutQuad);
        animSecond.SetEase(Ease.OutQuad);

        if (sendEvent)
        {
            animSecond.OnKill(() => OnAnimationSwapEndEvent?.Invoke());
        }

        animFirst.OnStart(() => OnAnimationStateChangeEvent?.Invoke(true));
        animSecond.OnComplete(() => OnAnimationStateChangeEvent?.Invoke(false));

        animFirst.Play();
        animSecond.Play();
    }