Example #1
0
 private void TryStopAnimation()
 {
     if (_animation != null && _animation.IsPlaying())
     {
         _animation.Kill();
     }
 }
    public override void OnPauseObstacle()
    {
        if (!isPlayingTween)
        {
            return;
        }

        if (pathTweener != null)
        {
            if (pathTweener.IsPlaying())
            {
                pathTweener.Pause();
            }
        }
        base.OnPauseObstacle();
    }
Example #3
0
 public void Continue()
 {
     if (_dialogueTween != null && _dialogueTween.IsPlaying())    //The animation is still playing, we finish it.
     {
         Debug.Log("IsPLaying");
         _dialogueTween.Complete();
         return;
     }
     if (_wordQueue.Count > 0)   //There are words still in the queue, so we show them.
     {
         Debug.Log("word Queue");
         ShowDialogueTween(CutDialog());
         return;
     }
     _currentPopup?.Hide();
     ShowCompletecallback.Invoke();
 }
Example #4
0
    private void StartMoveToTarget(Vector3 target)
    {
        if (isStunned)
        {
            return;
        }
        if (startGameManager.inSetup)
        {
            return;
        }
        start       = transform.position;
        this.target = new Vector3(target.x, transform.position.y, target.z);
        startDist   = Vector3.Distance(start, this.target);
        SetMoving(true);
        transform.LookAt(this.target);

        //TODO with sequence to lerp up then steady then down
        if (moveTween != null && moveTween.IsPlaying())
        {
            moveTween.SetTarget(this.target);
            moveTween.ChangeValues(start, this.target, startDist / speed);
        }
        else
        {
            moveTween = transform.DOMove(this.target, startDist / speed);
            moveTween.OnUpdate(() => {
                var t = (Mathf.Sin(moveTween.ElapsedPercentage().Remap(0, 1, -Mathf.PI + Mathf.PI / 2, Mathf.PI + Mathf.PI / 2)) + 1) / 2.0f;
                animator.SetFloat("Speed", t);

                if (!isMoving || isStunned)
                {
                    moveTween.Kill();
                }
            });
            moveTween.OnComplete(() => {
                SetMoving(false);
            });
            moveTween.OnKill(() => {
                SetMoving(false);
            });
        }
    }