private void LoadLocalData() { var data = LocalDataManager.Load(); if (data == null) { InitializeCategoryList(); this.ShoppingCartProducts = new List <string>(); this.Notifications = true; this.SelectedLocations = new List <Location>(); return; } foreach (var category in data.Categories) { category.Skip = 0; } this.CategoryList = new ObservableCollection <ProductCategory>(data.Categories); this.ShoppingCartProducts = data.ShoppingCartProducts; this.Notifications = data.Notifications; if (data.SelectedLocations != null) { this.SelectedLocations = data.SelectedLocations; } }
public void LoadGameData() { try { GameData gd = gameSaver.Load(); this.gameData = gd; worldGenerator.InstantiateLabyrinth(gd.maze); playerObj = Instantiate(playerPref, gd.playerPosition, Quaternion.identity); PlayerShooting playerShooting = playerObj.GetComponent <PlayerShooting>(); playerShooting.SetPlayer(gameData.playerPosition, gameData.bulletCount); startCamera.gameObject.SetActive(false); playerShooting.GetComponent <Health>().SetHealth(gameData.playerHealth); for (int i = 0; i < gd.enemyPositions.Count; i++) { CreateEnemy(gd.enemyPositions[i], gd.enemyHealth[i]); } } catch (Exception exception) { Debug.LogError(exception); } }