IEnumerator WaitToStart() { characterController.character.animator.Play(s_StartHash); float length = k_CountdownToStartLength; m_TimeToStart = length; while (m_TimeToStart >= 0) { yield return(null); m_TimeToStart -= Time.deltaTime * k_CountdownSpeed; } m_TimeToStart = -1; if (m_Rerun) { // Make invincible on rerun, to avoid problems if the character died in front of an obstacle characterController.characterCollider.SetInvincible(); } characterController.StartRunning(); StartMove(); }
//倒计时的时候进行的操作 IEnumerator WaitToStart() { characterController.character.animator.Play(s_StartHash); float length = k_CountdownToStartLength; m_TimeToStart = length; while (m_TimeToStart >= 0) { yield return(null); m_TimeToStart -= Time.deltaTime * k_CountdownSpeed; } m_TimeToStart = -1; if (m_Rerun) { //复活后无敌一段时间 characterController.characterCollider.SetInvincible(); } characterController.StartRunning(); StartMove(); }