public void BuildGameMap(Player player, JsonSavedGame savedGame) { this.level = savedGame.Level; BuildMap(savedGame.Map); CentreCamera(); BuildContent(savedGame.Map); BuildPlayerAvatar(player, savedGame.Player); BuildNPC(level, savedGame.NPCList); BuildAffector(savedGame.Map.DrugAffect); }
private void StartGame_Loading(JsonSavedGame savedGame) { var player = SetGameStatesAndGetPlayerInstance(savedGame.Level); MapBuilder.I.BuildGameMap(player, savedGame); }
private void SaveGame() { JsonSavedGame savedGame = new JsonSavedGame(); savedGame.Level = level; savedGame.Map = (JsonMap)map.GetJsonObject(); savedGame.Player = (JsonPlayer)player.GetJsonObject(); savedGame.NPCList = npcList.ConvertAll((npc) => (JsonNPC)npc.GetJsonObject()); File.WriteAllText(Environment.CurrentDirectory + SAVED_GAME_PATH, JsonConvert.SerializeObject(savedGame, Formatting.Indented)); }