// ------------------------------------------------------------------------------ // Function Name: // Return types: // Argument types: // Author: // Date: // ------------------------------------------------------------------------------ // Purpose: // ------------------------------------------------------------------------------ public void LoadSavedGame () { if (savedGames.Length != 0) { Dictionary<Scenes, UNA_Level> saveData; Dictionary<Gravity, bool> gravitySettings; bool[] endPieces; float playerHealth; int overallPoints; bool loadEffective = UNA_SaveLoadController.LoadPlayer(gameSelected, out saveData, out endPieces, out playerHealth, out overallPoints, out gravitySettings); if (loadEffective) { Debug.Log("Game " + gameSelected + " Loaded."); WLD_GameController.controller.BuildGameLevels(saveData); WLD_GameController.endPieces = endPieces; WLD_GameController.player.GetComponent<WLD_HealthDmg>().Health = playerHealth; WLD_GameController.player.GetComponent<PLR_Points>().OverallPoints = overallPoints; WLD_GameController.gravitySettingDictionary = gravitySettings; levelLoader.LoadLevel(Scenes.Hub, new Vector3(0, 0)); } else { Debug.LogError("The game could not be loaded."); } } }
// ------------------------------------------------------------------------------ // Function Name: // Return types: // Argument types: // Author: // Date: // ------------------------------------------------------------------------------ // Purpose: // ------------------------------------------------------------------------------ public void SaveGame () { if (gameToSave != "") { UNA_SaveLoadController.ChangeProfileName(gameToSave); } UNA_SaveLoadController.SavePlayer(WLD_GameController.levels, WLD_GameController.endPieces, WLD_GameController.player.GetComponent<WLD_HealthDmg>().Health, WLD_GameController.player.GetComponent<PLR_Points>().OverallPoints, WLD_GameController.gravitySettingDictionary); WLD_GameController.ui_Texts[UI_Txt.SaveGameNotificationText].enabled = true; CancelLoad(); }