コード例 #1
0
        public void ShowMenu(bool should_show, string menuname = null)
        {
            if (menuname != null)
            {
                MenuObjectMap mom = _menuDict[menuname];
                if (mom != null)
                {
                    SetMenuActive(mom, should_show);
                }
            }
            else
            {
                foreach (MenuObjectMap mom in menuObjects)
                {
                    SetMenuActive(mom, should_show);
                }
            }

            /*
             * if (should_show)
             * {
             *  isMenuShowing = true;
             *  if (menuObject != null)
             *      menuObject.SetActive(true);
             *  Time.timeScale = 0.0f; //pause game
             * }
             * else
             * {
             *  isMenuShowing = false;
             *  if (menuObject != null)
             *      menuObject.SetActive(false);
             *  Time.timeScale = 1.0f; //unpause game
             * }
             */
        }
コード例 #2
0
        public void SetMenuActive(MenuObjectMap menuMapObject, bool active)
        {
            if (menuMapObject == null || menuMapObject.obj == null)
            {
                return;
            }

            menuMapObject.active = active;
            menuMapObject.obj.SetActive(active);
            if (menuMapObject.pauseTime)
            {
                //1.0 if active, 0.0f otherwise
                Time.timeScale = active ? 0.0f : 1.0f;
            }
        }