public void NewGameProcess() { gameSessionData = new GameSessionData(); gameSessionData.wipeAbilityCount = 2; gameSessionData.doubleDamageAbilityCount = 2; gameSessionData.freezeAbilityCount = 2; gameSessionData.shieldAbilityCount = 2; gameSessionData.planetStatus.Add(1, false); /*gameSessionData.planetStatus.Add (2, false); * gameSessionData.planetStatus.Add (3, false); * gameSessionData.planetStatus.Add (4, false); * gameSessionData.planetStatus.Add (5, false); * gameSessionData.planetStatus.Add (6, false);*/ for (int i = 1; i <= 6; i++) { LevelSaveData levelSaveData = new LevelSaveData(); levelSaveData.levelID = 1; levelSaveData.planetID = i; gameSessionData.levels.Add(i.ToString() + "_1", levelSaveData); } SaveGameSessionData(); }
public override void StartGameState() { Debug.Log("GameStateEndless: Start Game State "); currentSessionData = new GameSessionData(); PopulateLevelsArray(); InitialiseClickSounds(); Vector3 mapPosition = MapSpawner.Instance.GetCurrentMapHolder().transform.position; mapPosition += new Vector3(0, 10, 0); //GameManager.instance.GetPlayerBall().transform.position = mapPosition; // ballPosition; GameManager.instance.GetPlayerBall().SetActive(true); energyMetreTunnel = GameManager.instance.gameObject.AddComponent <HexTunnelEnergy>(); energyMetreTunnel.Initialise(8, 30, 7); //energyMetreTunnel.edgeValue = energyMetre.GetEnergyMax() / 6; editMode = PlayerPrefs.GetInt("Edit Mode") == 1; if (editMode == true) // level edit on start... if the ball does not spawn we go into edit mode because of a helpfull bug thingo :) { Object.Destroy(Object.FindObjectOfType <PlayerController>().gameObject); } else { playerController = GameManager.instance.GetPlayerBall().GetComponent <PlayerController>(); } LoadNextLevel(); }
private void TryCreateGameSession() { GameSessionData data = new GameSessionData(GameManager.UserInfo.Username, PublicGameToggle.isOn); Network.SendDataToServer("CreateGame", data); //hide screen MessagingSystem.DispatchMessage(MessageType.OnOpenGamePanel, null); Deactivate(); }
public static void Save(GameSessionData data) { EnsureSavesDir(); var fileName = DateTime.Now.ToString("yyyy M d hh mm ss") + ".save"; var pathToFile = Path.Combine(SavesDir, fileName); File.WriteAllText(pathToFile, JsonUtility.ToJson(data, true)); }
public static GameSessionData LoadGameSessionData() { string path = Application.persistentDataPath + "/Resources/currentGameData.gameData"; GameSessionData loadedInfo = new GameSessionData(); FileStream file; BinaryFormatter bf = new BinaryFormatter(); if (File.Exists(path)) { file = File.Open(path, FileMode.Open); loadedInfo = (GameSessionData)bf.Deserialize(file); file.Close(); } return(loadedInfo); }
public static void SaveGameSessionData(GameSessionData data) { FileStream file; BinaryFormatter bf = new BinaryFormatter(); CreateDirectoryIfNotExist(Application.persistentDataPath + "/Resources/"); string path = Application.persistentDataPath + "/Resources/currentGameData.gameData"; if (File.Exists(path)) { File.Delete(path); } file = File.Create(path); bf.Serialize(file, data); file.Close(); }
void Awake() { instance = this; StartCoroutine(GameController.ActionAfterFewFramesCoroutine(2, () => { if (SaveLoadController.GameSessionDataExist()) { gameSessionData = SaveLoadController.LoadGameSessionData(); } else { NewGameProcess(); } BattleInterface.instance.RedrawAllInfo(); //StartCoroutine(GameController.ActionAfterFewFramesCoroutine(15, () => { //CheckFullVersionGame(); //})); })); }
public override void PassSessionData(GameSessionData data) { currentSessionData = data; }
public virtual void PassSessionData(GameSessionData data) { //throw new System.NotImplementedException(); }