private void Check_B_Press()
 {
     if ((m_GameManager.Player_Count() == 0) && (m_Controllers.Any_B_Pressed()))
     {
         // nobody current in the game, go back to main menu
         Close = true;
     }
     else
     {
         // there is someone to leave
         foreach (int?num in m_Controllers.B_Pressed_List())
         {
             int controller_num = num ?? default(int);
             // for each controller who hit B call remove on their panel if they exist
             foreach (PlayerSelectPanel Panel in Panels)
             {
                 if (Panel.isOccupied() && (Panel.Get_Controller_Number() == controller_num))
                 {
                     // Player exists, let the panel decide what to do
                     Panel.Cancel();
                     break;
                 }
             }
         }
     }
 }
Beispiel #2
0
    public void Update()
    {
        /* This code will run every frame, you should handle what the menu does in each state
         * This could include calling update on another manager if necessary, or nothing */

        // All states
        m_Controllers.Update();
        if (m_firstFrame)
        {
            m_GameManager.Preload_Next_Level();
            m_firstFrame = false;
        }

        switch (m_State)
        {
        case MenuState.Loading:
        {
            if (m_GameManager.Current_Scene() == "Menu")
            {
                Setup();
                SetState(m_StartState);
            }
            else
            {
                Debug.Log("MenuManager LOADING: Scene [" + m_GameManager.Current_Scene() + "]");
            }
            break;
        }

        case MenuState.MainMenu:
        {
            // handled by the event manager
            break;
        }

        case MenuState.AboutMenu:
        {
            if (m_Controllers.Any_B_Pressed())
            {
                SetState(MenuState.MainMenu);
            }
            break;
        }

        case MenuState.SettingsMenu:
        {
            m_SettingsManager.Update();
            if (m_SettingsManager.Close)
            {
                SetState(MenuState.MainMenu);
            }
            break;
        }

        case MenuState.PlayerSelect:
        {
            m_PlayerSelectManager.Update();
            if (m_PlayerSelectManager.Close)
            {
                SetState(MenuState.MainMenu);
            }
            else if (m_PlayerSelectManager.Play)
            {
                //m_PlayRequested = true;
                SetState(MenuState.QuickStart);
            }
            break;
        }

        case MenuState.QuickStart:
        {
            m_QuickStartMenu.Update();
            if (m_QuickStartMenu.Play)
            {
                m_PlayRequested = true;
            }
            break;
        }

        default:
        {
            // THROW ERROR!
            throw new System.NotImplementedException("State missing in MenuManager.Update()");
        }
        }
        // All States
        //re add shortcut when Y pressed to skip menu once refactoring complete
    }