void Awake() { if (appController == null) { appController = this; } else if (appController != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
void loadGames() { JSONArray gamesObj = JSON.Parse(Resources.Load <TextAsset>("Jsons/games").text).AsObject["games"].AsArray; icons = Resources.LoadAll <Sprite>("Sprites/icons"); games = new List <Game>(); foreach (JSONClass game in gamesObj) { Game newGame = new Game(); newGame.SetId(int.Parse(game["id"].Value)); newGame.SetName(game ["name"].Value); newGame.SetPrefabName(game ["prefabName"].Value); newGame.SetDescription(game ["description"].Value); newGame.SetIcon(icons[int.Parse(game ["icon"].Value)]); games.Add(newGame); } AppController.GetController().GetMetricsController().SetMetricsModel(new MetricsModel(games)); }
void Awake() { if (appController == null) appController = this; else if (appController != this) Destroy(gameObject); DontDestroyOnLoad(gameObject); appModel = new AppModel(); //InitModelFromJsonInfo(); }
internal void StartGame(int currentLevel) { AppController.GetController().SetCurrentGame(currentLevel); ChangeCurrentObject(readTest); }
internal void RestartCurrentGame() { // ChangeCurrentObject(LoadPrefab("oading"); ChangeCurrentObject(LoadPrefab("Games/" + AppController.GetController().GetCurrentGame().GetPrefabName())); }