public IEnumerator VerticalHoleTransition(Vector3 targetEndpoint, GrottoEntrance.EnterMethod enterMethod) { if (enterMethod == GrottoEntrance.EnterMethod.Fall) { iTween.MoveTo(gameObject, iTween.Hash("position", transform.position.SetY(transform.position.y - 5f), "time", .5f, "easetype", iTween.EaseType.easeInBack)); } else if (enterMethod == GrottoEntrance.EnterMethod.Spring) { iTween.MoveTo(gameObject, iTween.Hash("position", transform.position.SetY(transform.position.y + 10f), "time", .5f, "easetype", iTween.EaseType.easeInOutSine)); } yield return new WaitForSeconds(.25f); yield return StartCoroutine(CameraManager.Instance.DoWipeOut(.5f)); yield return new WaitForSeconds(.5f); CameraManager.Instance.GetCameraRig().position = targetEndpoint; transform.position = targetEndpoint.SetY(targetEndpoint.y + 3f); iTween.MoveTo(gameObject, iTween.Hash("position", targetEndpoint, "time", 1f, "easetype", iTween.EaseType.easeOutCirc)); yield return new WaitForSeconds(.25f); yield return StartCoroutine(CameraManager.Instance.DoWipeIn(.5f)); }
//Let's start specific and get generic as we go ok public IEnumerator OnFellDownHole(Vector3 targetEndpoint, GrottoEntrance.EnterMethod enterMethod) { if (enterMethod == GrottoEntrance.EnterMethod.Spring) SoundManager.Instance.Play(SoundManager.SoundEffect.Teleport); InputManager.Instance.PlayerInputEnabled = false; gameObject.collider.enabled = false; rigidbody.useGravity = false; yield return StartCoroutine(_animator.VerticalHoleTransition(targetEndpoint, enterMethod)); rigidbody.useGravity = true; InputManager.Instance.PlayerInputEnabled = true; gameObject.collider.enabled = true; if (enterMethod == GrottoEntrance.EnterMethod.Fall) SoundManager.Instance.Play(SoundManager.SoundEffect.MainLand); //Move player to initial position //Start iTweening toward target //Togggle correct player animation //CameraFadeOut //Move player to target position }