public void GameOver() { State = GameState.Dead; //SavedLives--; MenuManager.Instance.GameOver(); SoundManager.PlaySfx(soundManager.soundGameover, 0.5f); if (SavedLives <= 0) { //reset all levels and worlds /* * isNoLives = true; * * if (zeroLiveAction == ZeroLivesAction.ResetAllWorlds) { * PlayerPrefs.DeleteAll (); * * } else { * var highestWorld = PlayerPrefs.GetInt (GlobalValue.WorldReached, 1); * //Reset the highest world * PlayerPrefs.SetInt (highestWorld.ToString (), 1); * SavedBullets = defaultBullet; * SavedLives = defaultLive; * SavedPoints = 0; * } */ } AdsController.ShowAds(); }
public void GameFinish() { State = GameState.Finish; Player.GameFinish(); MenuManager.Instance.Gamefinish(); SoundManager.PlaySfx(soundManager.soundGamefinish, 0.5f); //save coins and points SavedCoins = Coin; SavedPoints = Point; SavedBullets = Bullet; //unlock new world if this level is the last one if (LevelManager.Instance.isLastLevelOfWorld) { PlayerPrefs.SetInt(GlobalValue.WorldReached, GlobalValue.worldPlaying + 1); Debug.Log("Completed the last level, if this is not the final level, please uncheck isLastLevelOfWorld in LevelManager script"); return; } //check to unlock new level var levelreached = PlayerPrefs.GetInt(GlobalValue.worldPlaying.ToString(), 1); if (GlobalValue.levelPlaying == levelreached) { PlayerPrefs.SetInt(GlobalValue.worldPlaying.ToString(), levelreached + 1); Debug.Log("Unlock new level"); } AdsController.ShowAds(); }