/// <summary> /// Mainline method: Loads the file and extracts the data using a BinaryFortmatter /// </summary> /// <returns>If said load attempt was successfull, return true</returns> public static bool Load() { //Either the folder or file dont exist, return false to show a failed attempt. if (!FolderExists() || !File.Exists(filePath)) { return(false); } using (FileStream fs = new FileStream(filePath, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); SaveData data = formatter.Deserialize(fs) as SaveData; //Using the same logic, we desearlise the information from the file into the class. Debug.Log("Load Successfull"); //We then feed in the newrly aquired information to restart the game. GameManagercs.allPlayers = TestManager.ins.allPlayers = TestGameModel.StartNewGame(data, TestManager.ins.piecePrefab); TestGameModel.GetNextTurn(TestManager.ins.allPlayers, TestManager.ins.turnText); return(true); } }
public void TurnStarted() { isReady = false; TestGameModel.GetNextTurn(allPlayers, turnText); }
public void OnStartEvent() { allPlayers = TestGameModel.StartNewGame(modeSelection[selection.value].players, piecePrefab); TestGameModel.GetNextTurn(allPlayers, turnText); }