private void PlayGameOverAnimation(Transform d) { StopAllCoroutines(); soundManager.PlaySoundFail(); isGameOver = true; //canvasManager.ButtonLogic (); jumpTweener.Kill(); sequence.Kill(); sequenceDOT.Kill(); sequenceDOT = null; guyAnim.StopAll(); Vector3 targetPosition = new Vector3(PLAYER.position.x, PLAYER.position.y, Camera.main.transform.position.z); canvasManager.music.DOPitch(-1, 1f) .OnComplete(() => { canvasManager.music.DOPitch(1, 1f); }); Camera.main.transform.DOShakePosition(0.3f, new Vector3(1, 1, 0), 10, 90, false) .OnComplete(() => { DOVirtual.Float(cameraSize, 5f, 0.3f, (float size) => { Camera.main.orthographicSize = size; }); Camera.main.transform.DOMove(targetPosition, 0.3f) .OnComplete(() => { PLAYER.DOLocalMoveY(floorPosition, 0.3f, false) .OnUpdate(() => { Camera.main.transform.position = new Vector3(PLAYER.position.x, PLAYER.position.y, Camera.main.transform.position.z); }) .OnComplete(() => { Camera.main.transform.position = new Vector3(PLAYER.position.x, PLAYER.position.y, Camera.main.transform.position.z); }); PLAYER.DOLocalRotate(new Vector3(0, 0, 180), 0.3f) .OnComplete(() => { DOVirtual.DelayedCall(0.3f, () => { guyAnim.DoWalk(); DOVirtual.DelayedCall(0.5f, () => { guyAnim.StopAll(); spriteDotGameOverZoom.transform.DOScale(Vector3.one * 10, 1) .OnComplete(() => { canvasManager.AnimationCameraGameOver(d.position); }); }); }); }); }); }); }
/// <summary> /// Do the aniamtion walk of the player /// </summary> void DoWalk() { if (isGameOver) { return; } if (jumpTweener != null) { jumpTweener.Kill(); } float ratio = Mathf.Abs(PLAYER.localPosition.y - floorPosition) / (positionTouchBorder - floorPosition); jumpTweener = PLAYER.DOLocalMoveY(floorPosition, ratio * waitTime, false) .OnComplete(guyAnim.DoWalk); }