public IEnumerator Start() { playerPenguinGO = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject; if (playerPenguinGO != null) { RunController runController = playerPenguinGO.GetComponent <RunController>(); ParticipationController participationController = playerPenguinGO.GetComponent <ParticipationController>(); if (runController != null && runController.enabled && participationController != null && (participationController.GetParticipationData().CurrentParticipationState == ParticipationState.Ready || participationController.GetParticipationData().CurrentParticipationState == ParticipationState.Pending)) { Animator anim = playerPenguinGO.GetComponent <Animator>(); if (anim != null) { playerPenguinGO.GetComponent <Animator>().SetTrigger("LevelUp"); focusCameraOnPenguin(); yield return(null); yield return(new WaitForSeconds(anim.GetCurrentAnimatorClipInfo(0)[0].clip.length)); } } } Object.Destroy(base.gameObject); }
private IEnumerator Start() { bool animationCompleted = false; if (DelaySeconds > 0f) { yield return(new WaitForSeconds(DelaySeconds)); } localPlayerGameObject = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject; if (localPlayerGameObject != null) { RunController runController = localPlayerGameObject.GetComponent <RunController>(); ParticipationController participationController = localPlayerGameObject.GetComponent <ParticipationController>(); if (runController != null && runController.enabled && participationController != null && (participationController.GetParticipationData().CurrentParticipationState == ParticipationState.Ready || participationController.GetParticipationData().CurrentParticipationState == ParticipationState.Pending)) { Animator animator = localPlayerGameObject.GetComponent <Animator>(); if (animator != null) { localPlayerGameObject.GetComponent <Animator>().SetTrigger(AnimationTrigger); focusCameraOnPenguin(); if (this.OnAnimationStarted != null) { this.OnAnimationStarted(); } yield return(null); yield return(new WaitForSeconds(animator.GetCurrentAnimatorClipInfo(0)[0].clip.length)); animationCompleted = true; } } } if (wasCameraMoved) { resetCamera(); } if (this.OnAnimationEnded != null) { this.OnAnimationEnded(animationCompleted); } UnityEngine.Object.Destroy(base.gameObject); }