private void RestoreState() { logger.Debug("Restoring state"); if (IOUtils.ExistsPersitentData()) { SaveState save = IOUtils.LoadData(); logger.Debug("Restored state: " + JsonUtility.ToJson(save)); switch (save.state) { case State.LOCATION_STARTED: targetList = save.targetList; currentState = save.state; activeMmos = save.activeMmos; Invoke("RestoreChoice", 0.5f); // Restart location service // Run is-close check WatchAll(); break; case State.LOCATION_FOUND: case State.DISPLAYING: active = save.active; // Restart display service break; } } if (IOUtils.ExistsHeadingFile()) { headingDictionary = IOUtils.LoadHeadings(); Debug.Log("Loaded headings:\n" + JsonUtility.ToJson(headingDictionary)); } }
private void Awake() { // Important to not crash in editor if (Application.isEditor) { GameObject.Find("ARCore Device").active = false; } ActiveScreens = new List <GameObject>(); logger = LogManager.GetInstance().GetLogger(GetType()); logger.Debug("Awake!"); currentState = State.IDLE; // Use Awake instead of ctor nativeLocation = LocationAwarenessPlugin.GetInstance(); logger.Debug("Created LocationAwarenessPlugin"); gameObject.AddComponent <UnityLocationService>(); unityLocation = gameObject.GetComponent <UnityLocationService>(); logger.Debug("Added UnityLocationService to Controller"); gameObject.AddComponent <CineastApi>(); cineast = gameObject.GetComponent <CineastApi>(); logger.Debug("Added CineastApi to Controller"); headingDictionary = new HeadingDictionary(); uiManager.controller = this; logger.Debug("CineastApi Config: " + JsonUtility.ToJson(CineastUtils.Configuration)); }