// Use this for initialization void Awake() { GameObject go = GameObject.Find("LevelSelector"); GameObject levelDLObj = GameObject.Find("LevelDownloader"); DownloadLevels levelDownloader = null; if (levelDLObj != null) { levelDownloader = levelDLObj.GetComponent <DownloadLevels>(); } if (go != null) { levelSelection = GameObject.Find("LevelSelector").GetComponent <LevelIdentity>(); prefab = levelDownloader.Levels[levelSelection.GetIndex()]; } else { GameObject selector = new GameObject("LevelSelector"); selector.AddComponent <LevelIdentity>(); levelSelection = selector.GetComponent <LevelIdentity>(); levelSelection.SetID(0); DontDestroyOnLoad(selector); if (levelDLObj != null) { prefab = levelDownloader.Levels[levelSelection.GetIndex()]; } } levelGameObject = Instantiate(prefab); ConfigHandler.LoadConfig(); ConfigHandler.Config.SetField("Progress", levelSelection.GetIndex()); ConfigHandler.SaveConfig(); ObjectiveHandler.OnObjectiveActivated += ObjectiveActivated; ObjectiveHandler.OnObjectiveDeactivated += ObjectiveDeactivated; }
void Awake() { ConfigHandler.LoadConfig(); if (instance == null) { instance = this; } else { Destroy(gameObject); } }
void Awake() { ConfigHandler.LoadConfig(); if (instance == null) { instance = this; } else { Destroy(gameObject); } }