public void ResetScore() { SaveLoadController.savedOScore = 0; SaveLoadController.savedXScore = 0; saveLoad.Save(); SceneManager.LoadScene(SceneManager.GetActiveScene().name); }
private void OnFormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason != CloseReason.UserClosing) { return; } if (CuratorDataSet.HasChanges()) { if (MetroMessageBox.Show(this, "Save changes?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { _saveLoadController.Save(); } catch (Exception ex) { ShowSaveFailureMessage(ex.Message); } } } _saveLoadController.Exit(); if (MetroMessageBox.Show(this, "Export to Steam?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { AttemptSteamExport(); } }
void GameWinner(int oxValue) { //mark the game has ended gameEnd = true; saveLoad.Load(); // Load the score first to get the previous score //enable victory UI and increase the score of winning player if (oxValue == (xValue * (int)gridSize)) { gameVisual.WinGameVisual("X Won!"); SaveLoadController.savedXScore = ++SaveLoadController.loadedXScore; } else if (oxValue == (oValue * (int)gridSize)) { gameVisual.WinGameVisual("O Won!"); SaveLoadController.savedOScore = ++SaveLoadController.loadedOScore; } else { gameVisual.WinGameVisual("It's a Draw!"); } //Save the game with the new score saveLoad.Save(); //Update score board with the new score gameVisual.UpdateScoreBoard(); }
private void OnCollisionEnter(Collision other) { if (!other.gameObject.CompareTag("Player")) { return; } if (SaveLoadController.EnemiesDefeatedList.Contains(gameObject.name)) { return; } Battle.Enemies = BattleEnemies; Battle.worldObjName = gameObject.name; SaveLoadController.Save(false); SceneManager.LoadScene("battle_castle"); }
void OnCollisionEnter(Collision collision) { if (!active) { return; } if (collision.gameObject.CompareTag("Player")) { // Fully Heal Player Battle.playerEntity.CurrentHealth = Battle.playerEntity.Stats.MaxHealth; wsc.UpdateHealth(); // Save Stats SaveLoadController.FountainsUsedList.Add(gameObject.name); SaveLoadController.Save(); wsc.SavedGame.gameObject.SetActive(true); StartCoroutine(RemoveSavedGameInfo(3f)); // Disable active = false; } }
public void Save <T>(string key, T data) where T : class { _controller.Save(key, data, onSaveCorrupted); }
void Awake() { SavedGame.gameObject.SetActive(false); if (!Battle.won) { SaveLoadController.Load(); } else if (Battle.worldObjName != "" && Battle.won) { SaveLoadController.EnemiesDefeatedList.Add(Battle.worldObjName); if (Battle.worldObjName == "Prince") { SceneManager.LoadScene("end_game"); } } SaveLoadController.SaveData data = SaveLoadController.data; if (SaveLoadController.data != null) { GameObject.FindGameObjectWithTag("Player").transform.position = new Vector3(data.PositionX, data.PositionY, data.PositionZ); Battle.playerEntity.InitStats("Dragon", data.CurrLevel); Battle.playerEntity.CurrentExperience = data.CurrExp; Battle.playerEntity.CurrentHealth = data.CurrHealth; StoryController.SetNumberScrollsFound(data.ScrollsCaughtCount); foreach (FountainController fountain in FindObjectsOfType <FountainController>()) { int i = Array.IndexOf(data.FountainsUsed, fountain.name); if (i > -1) { fountain.active = false; } } foreach (EnemyWorldScript enemy in FindObjectsOfType <EnemyWorldScript>()) { int i = Array.IndexOf(data.EnemiesDefeated, enemy.name); if (i > -1 || (enemy.name == Battle.worldObjName && Battle.won)) { Destroy(enemy.gameObject); } } foreach (ScrollController scrollSub in FindObjectsOfType <ScrollController>()) { GameObject scroll = scrollSub.transform.parent.gameObject; int i = Array.IndexOf(data.ScrollsCaught, scroll.name); if (i > -1) { Destroy(scroll.gameObject); } } } else { SaveLoadController.ResetValues(); SaveLoadController.Save(); } HealthBar.SetMaxValue(Battle.playerEntity.Stats.MaxHealth); HealthBar.SetCurValue(Battle.playerEntity.CurrentHealth); ExperienceBar.SetMaxValue(Battle.playerEntity.Stats.Experience); ExperienceBar.SetCurValue(Battle.playerEntity.CurrentExperience); LevelLabel.text = "Level " + Battle.playerEntity.Stats.Level; }