public void OnCheckPointPassed(CheckPointScript i_CheckPointScript) { if (isCheckPointPassable(i_CheckPointScript)) { i_CheckPointScript.PassedCheckPointSound.Play(); StartCoroutine(delayedDeactivateCheckpoint(1f, i_CheckPointScript)); m_MainPlayerScript.OnCheckPointPassed(i_CheckPointScript); if (SceneManager.GetActiveScene().name == "Level1") { m_EnemiesManagerScript.SpawnEnemyInSpawnLocation(m_CurrentCheckPointIndex); } m_CurrentCheckPointIndex++; if (m_CurrentCheckPointIndex < m_CheckPoints.Length) { m_LightOfCurrentCheckPoint.transform.position = m_CheckPoints[m_CurrentCheckPointIndex].transform.position; } else { m_LevelCompleted = true; m_MainPlayerScript.OnLevelCompleted(); } } else { m_FailedToPassCheckPointSound.Play(); } }