private void Awake() { ///THIS IS EXTREMELY IMPORTANT TO HAVE! ///What it does is tells the game to not remove itself from any scenes ///Though if it finds another game manager it is fully able to destroy that game manager. DontDestroyOnLoad(this.gameObject); if (FindObjectsOfType <GameManager>().Length != 1) { Destroy(this.gameObject); } ScreenTransition = GetComponentInChildren <Animator>(); Settings = GetComponent <D_Settings>(); //Set up the other Managers MenuMan = GetComponent <MenuManager>(); if (MenuMan != null) { MenuMan.Setup(this); } else { Debug.LogError("Menu Management is not present on GameManager"); } StageMan = GetComponent <StageManager>(); if (StageMan != null) { StageMan.Setup(this); } else { Debug.LogError("Stage Management is not present on GameManager"); } StatMan = GetComponent <StatsManager>(); if (StatMan != null) { StatMan.Setup(this); } else { Debug.LogError("Stat Management is not present on the GameManager"); } SaveFileObj = GetComponent <D_SaveFile>(); //SaveFile = SaveSystem.LoadFile(SaveFile.FileNumber); Application.targetFrameRate = 60; if (MyGameState == GameState.GAMEPLAY) { LightenScreen(); StatMan.SwitchUI(true); } }
public B_SaveFile(D_SaveFile file) { FileNumber = file.FileNumber; Name = file.FileName; Character = file.Character; MostRecentStage = new B_StageData(file.MostRecentStage); SaveWorldStats(file.World1, World1); SaveWorldStats(file.World2, World2); SaveWorldStats(file.World3, World3); SaveWorldStats(file.World4, World4); SaveWorldStats(file.World5, World5); }
public static void SaveFile(D_SaveFile FileData) { Debug.Log("Saving File!"); BinaryFormatter formatter = new BinaryFormatter(); int fileIndex = FileData.FileNumber; string path = Application.persistentDataPath + "/save" + fileIndex.ToString() + ".rice"; FileStream stream = new FileStream(path, FileMode.Create); B_SaveFile data = new B_SaveFile(FileData); formatter.Serialize(stream, data); stream.Close(); }
public void OverrideData(D_SaveFile file) { FileNumber = file.FileNumber; FileName = file.FileName; Character = file.Character; }