Beispiel #1
0
        /// <summary>
        /// Loads and show's the view
        /// </summary>
        /// <param name="path">Path.</param>
        protected void LoadAndShowView(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                SimpleLogger.LogError(this, "Attempting to load view at invalid path.");
                return;
            }

            GameObject prefab = Resources.Load <GameObject>(path);

            if (prefab == null)
            {
                SimpleLogger.LogError(this, "Attempting to load view at invalid path.");
                return;
            }

            view = GameObject.Instantiate(prefab).GetComponent <BaseGameStateView>();
            if (view == null)
            {
                SimpleLogger.LogError(this, "View is missing the required component.");
                return;
            }

            TargetObject.ShowView(view);
        }
Beispiel #2
0
 /// <summary>
 /// Shows a game state view.
 /// </summary>
 /// <param name="gameStateView">Game state view.</param>
 public void ShowView(BaseGameStateView gameStateView)
 {
     gameStateView.transform.SetParent(transform, false);
     gameStateView.transform.SetAsLastSibling();
     gameStateView.gameObject.SetActive(true);
     gameStateView.OnShow();
 }