IEnumerator Timer() { yield return(new WaitForSeconds(10)); if (sm.IsSuper()) { yield return(new WaitForSeconds(2f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(2f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(2f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(2f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(2f)); } } } } } // level2 if (doubleSpawner == null) { leftSpawner.CancelInvoke(); leftSpawner.spawnRate = rate2; rightSpawner.CancelInvoke(); rightSpawner.spawnRate = rate2; leftSpawner.Resume(); rightSpawner.Resume(); } else { doubleSpawner.CancelInvoke(); doubleSpawner.spawnRate = rate2; doubleSpawner.Resume(); } scLeft[0].CancelInvoke(); scLeft[0].spawnRate = middleRate2; scLeft[0].Resume(); scRight[0].CancelInvoke(); scRight[0].spawnRate = middleRate2; scRight[0].Resume(); yield return(new WaitForSeconds(30)); // level3 if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); } } } } } if (doubleSpawner == null) { leftSpawner.CancelInvoke(); leftSpawner.spawnRate = rate3; rightSpawner.CancelInvoke(); rightSpawner.spawnRate = rate3; leftSpawner.Resume(); rightSpawner.Resume(); } else { doubleSpawner.CancelInvoke(); doubleSpawner.spawnRate = rate3; doubleSpawner.Resume(); } scLeft[0].CancelInvoke(); scLeft[0].spawnRate = middleRate3; scLeft[0].Resume(); scRight[0].CancelInvoke(); scRight[0].spawnRate = middleRate3; scRight[0].Resume(); scLeft[1].enabled = true; scLeft[2].enabled = true; scRight[1].enabled = true; scRight[2].enabled = true; yield return(new WaitForSeconds(30)); // level4 if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); } } } } } if (doubleSpawner == null) { leftSpawner.CancelInvoke(); leftSpawner.spawnRate = rate4; rightSpawner.CancelInvoke(); rightSpawner.spawnRate = rate4; leftSpawner.Resume(); rightSpawner.Resume(); } else { doubleSpawner.CancelInvoke(); doubleSpawner.spawnRate = rate4; doubleSpawner.Resume(); } scLeft[0].CancelInvoke(); scLeft[0].spawnRate = middleRate4; scLeft[0].Resume(); scLeft[1].CancelInvoke(); scLeft[1].spawnRate = sideRate1; scLeft[1].Resume(); scLeft[2].CancelInvoke(); scLeft[2].spawnRate = sideRate1; scLeft[2].Resume(); scRight[0].CancelInvoke(); scRight[0].spawnRate = middleRate4; scRight[0].Resume(); scRight[1].CancelInvoke(); scRight[1].spawnRate = sideRate1; scRight[1].Resume(); scRight[2].CancelInvoke(); scRight[2].spawnRate = sideRate1; scRight[2].Resume(); yield return(new WaitForSeconds(30)); // level5 if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); if (sm.IsSuper()) { yield return(new WaitForSeconds(1f)); } } } } } if (doubleSpawner == null) { leftSpawner.CancelInvoke(); leftSpawner.spawnRate = rate5; rightSpawner.CancelInvoke(); rightSpawner.spawnRate = rate5; leftSpawner.Resume(); rightSpawner.Resume(); } else { doubleSpawner.CancelInvoke(); doubleSpawner.spawnRate = rate5; doubleSpawner.Resume(); } scLeft[0].CancelInvoke(); scLeft[0].spawnRate = middleRate5; scLeft[0].Resume(); scLeft[1].CancelInvoke(); scLeft[1].spawnRate = sideRate2; scLeft[1].Resume(); scLeft[2].CancelInvoke(); scLeft[2].spawnRate = sideRate2; scLeft[2].Resume(); scRight[0].CancelInvoke(); scRight[0].spawnRate = middleRate5; scRight[0].Resume(); scRight[1].CancelInvoke(); scRight[1].spawnRate = sideRate2; scRight[1].Resume(); scRight[2].CancelInvoke(); scRight[2].spawnRate = sideRate2; scRight[2].Resume(); }
public void GameOver() { if (over == 0) { /*GameCenter.GetComponent<Animator>().Play("GameCenter"); * Settings.GetComponent<Animator>().Play("Settings"); * PlayButton.GetComponent<Animator>().Play("Play");*/ HealthBar.GetComponent <Animator>().Play("HealthBarReverse", -1, 0); Color1.GetComponent <Animator>().Play("Colo1Reverse"); Color2.GetComponent <Animator>().Play("Color2Reverse"); Color3.GetComponent <Animator>().Play("Color3Reverse"); if (LeftSpawner != null) { LeftSpawner.CancelInvoke(); RightSpawner.CancelInvoke(); } else if (left != null) { left.CancelInvoke(); right.CancelInvoke(); } else { doubleSpawner.CancelInvoke(); } LeftPlayer.CancelInvoke(); RightPlayer.CancelInvoke(); if (LeftPlayer1 != null) { LeftPlayer1.CancelInvoke(); RightPlayer1.CancelInvoke(); LeftPlayer2.CancelInvoke(); RightPlayer2.CancelInvoke(); } plane.Play("game-end", -1, 0); leaderboard.gameObject.SetActive(true); leaderboard.Play("leaderboard-in"); volume.gameObject.SetActive(true); volume.Play("volume-in"); PlayButton.gameObject.SetActive(true); PlayButton.Play("play-in"); leftSide.gameObject.SetActive(true); leftSide.Play("leftSideIn"); //score.Play("ScoreOut"); //highScore.Play("highScoreOut"); SuperButton.Play("SuperOut"); pause.Play("PauseOut"); cc.EnableStars(); //plane.Play("PlanePositionReverse"); over++; if (flood != null) { flood.Stop(); } if (ct != null) { ct.GameOver(); } if (Color11 != null) { Color11.GetComponent <Animator>().Play("Colo1Reverse", -1, 0f); Color22.GetComponent <Animator>().Play("Color2Reverse", -1, 0f); Color33.GetComponent <Animator>().Play("Color3Reverse", -1, 0f); if (SuperButton1 != null) { SuperButton1.Play("SuperOut", -1, 0); int score = PlayerPrefs.GetInt("highScore_6_2", 0); score++; PlayerPrefs.SetInt("highScore_6_2", score); } } } }