public void JumpToEnd() { float duration = 1f; livingLetter.transform.DOLocalMove(startPosition, delay).OnComplete(delegate() { shadowTransform.gameObject.SetActive(true); livingLetter.gameObject.SetActive(true); livingLetter.transform.DOScale(endScale, duration * 0.5f); //livingLetter.Poof(); livingLetter.OnJumpStart(); float timeToJumpStart = 0.15f; float timeToJumpEnd = 0.4f; Sequence animationSequence = DOTween.Sequence(); animationSequence.AppendInterval(timeToJumpStart); animationSequence.AppendCallback(delegate() { livingLetter.transform.DOLocalJump(endPosition, 7f, 1, duration).OnComplete(delegate() { if (endCallback != null) { endCallback(); } }).SetEase(Ease.Linear); }); animationSequence.AppendInterval(duration - timeToJumpEnd); animationSequence.AppendCallback(delegate() { livingLetter.OnJumpEnded(); }); animationSequence.AppendInterval(timeToJumpEnd); animationSequence.OnComplete(delegate() { livingLetter.DoHorray(); }); animationSequence.Play(); }); }
void Update() { letter.HasFear = fear; letter.SetWalkingSpeed(walkSpeed); letter.SetDancingSpeed(danceSpeed); if (doTransition) { doTransition = false; letter.SetState(targetState); } if (doHooray) { doHooray = false; letter.DoHorray(); } if (doAngry) { doAngry = false; letter.DoAngry(); } if (doHighFive) { doHighFive = false; letter.DoHighFive(); } if (onJumpStart) { onJumpStart = false; letter.OnJumpStart(); } if (onJumpMiddle) { onJumpMiddle = false; letter.OnJumpMaximumHeightReached(); } if (onJumpEnd) { onJumpEnd = false; letter.OnJumpEnded(); } if (doSmallJump) { doSmallJump = false; letter.DoSmallJump(); } if (doDanceWin) { doDanceWin = false; letter.DoDancingWin(); } if (doDanceLose) { doDanceLose = false; letter.DoDancingLose(); } if (doTwirl) { doTwirl = false; letter.DoTwirl(() => { Debug.Log("BACK!"); }); } if (doToggleDance) { doToggleDance = false; letter.ToggleDance(); } }