public void EndLevel() { PlayerPrefs.SetInt("LastMenuState", 2 + 5); PlayerPrefs.SetInt("FirstLevelDone", 1); MenuMasterController.currentPlace = new List <int> () { 2 }; SaveMaster.LevelFinished(true, introLevel); SceneMaster.s.LoadMenu(); }
public void EndGame() { SaveMaster.LevelFinished(true, doranLevel); SceneMaster.s.LoadMenu(); }
public void EndGame(int id) { if (isFinished) { return; } DataLogger.LogMessage("Game Finished >" + DataHandler.s.myPlayerInteger.ToString() + " - " + id.ToString()); isFinished = true; isGamePlaying = false; finisherId = id; LocalPlayerController.isActive = false; NPCManager.s.StopAllNPCs(); bool isWon = CheckisWon(); try { /*if (_NPCBehaviour.activeNPC != null) * _NPCBehaviour.activeNPC.isActive = false;*/ PowerUpManager.s.DisablePowerUps(); if (GS.a.nextStage == null) { if (GoogleAPI.s.gameInProgress) { GoogleAPI.s.LeaveGame(); } } } catch (System.Exception e) { DataLogger.LogError(this.name, e); } if (isWon) { try { SaveMaster.LevelFinished(true, GS.a); } catch (System.Exception e) { DataLogger.LogError("Cant save level finished data: ", e); } if (GS.a.winDrops != null) { for (int i = 0; i < GS.a.winDrops.Length; i++) { ItemBase item = GS.a.winDrops[i]; int itemAmount = 1; if (GS.a.windDropAmounts.Length < i) { if (GS.a.windDropAmounts[i] > 0) { itemAmount = GS.a.windDropAmounts[i]; } } if (item != null) { InventoryMaster.s.Add(item, itemAmount); } } } if (GS.a.levelOutroDialog != null) { GameEndScreen.s.Endgame(finisherId, isWon, false); } else { RestOffTheEndingStuff(isWon); } if (GS.a.autoTransferHealthAcrossLevels) { int oldHealth = PlayerPrefs.GetInt(GS.a.name + GameSettings.autoTransferHealthAcrossLevelsPlayerPrefString, -1); int curHealth = ScoreBoardManager.s.allScores[DataHandler.s.myPlayerInteger, 0]; if (curHealth > oldHealth) { PlayerPrefs.SetInt(GS.a.name + GameSettings.autoTransferHealthAcrossLevelsPlayerPrefString, curHealth); } print("Health saved as " + curHealth.ToString() + " to " + GS.a.name + GameSettings.autoTransferHealthAcrossLevelsPlayerPrefString); } } else { GameEndScreen.s.Endgame(finisherId, isWon, true); InventoryMaster.s.ReduceEquipmentChargeLeft(); } }