示例#1
0
    //Functions assigned to buttons in main menu - SETTING ****Active bool to true;
    public void SplashButton()
    {
        mainMenuActive = true;
        StandaloneInputModule inputModule = es.gameObject.GetComponent <StandaloneInputModule>();

        if (GameManager.m_Instance.m_NumOfPlayers <= 4)
        {
            //P2-4 Join
            if (splashCanvas.activeSelf && Input.GetButtonDown("Jump_P1"))
            {
                int players = ++GameManager.m_Instance.m_NumOfPlayers;
                characterSelect.AssignController("P1");
                Debug.Log("Player " + players + " has Joined!");
                inputModule.submitButton    = "Jump_P1";
                inputModule.horizontalAxis  = "JoystickLeftX_P1";
                inputModule.verticalAxis    = "JoystickLeftY_P1";
                characterSelect.P1Join      = true;
                characterSelect.firstPlayer = CharacterSelect.PlayerOne.P1;
            }
            if (splashCanvas.activeSelf && Input.GetButtonDown("Jump_P2"))
            {
                int players = ++GameManager.m_Instance.m_NumOfPlayers;
                characterSelect.AssignController("P2");
                Debug.Log("Player " + players + " has Joined!");
                inputModule.submitButton    = "Jump_P2";
                inputModule.horizontalAxis  = "JoystickLeftX_P2";
                inputModule.verticalAxis    = "JoystickLeftY_P2";
                characterSelect.P2Join      = true;
                characterSelect.firstPlayer = CharacterSelect.PlayerOne.P2;
            }
            if (splashCanvas.activeSelf && Input.GetButtonDown("Jump_P3"))
            {
                int players = ++GameManager.m_Instance.m_NumOfPlayers;
                characterSelect.AssignController("P3");
                Debug.Log("Player " + players + " has Joined!");
                inputModule.submitButton    = "Jump_P3";
                inputModule.horizontalAxis  = "JoystickLeftX_P3";
                inputModule.verticalAxis    = "JoystickLeftY_P3";
                characterSelect.P3Join      = true;
                characterSelect.firstPlayer = CharacterSelect.PlayerOne.P3;
            }
            if (splashCanvas.activeSelf && Input.GetButtonDown("Jump_P4"))
            {
                int players = ++GameManager.m_Instance.m_NumOfPlayers;
                characterSelect.AssignController("P4");
                Debug.Log("Player " + players + " has Joined!");
                inputModule.submitButton    = "Jump_P4";
                inputModule.horizontalAxis  = "JoystickLeftX_P4";
                inputModule.verticalAxis    = "JoystickLeftY_P4";
                characterSelect.P4Join      = true;
                characterSelect.firstPlayer = CharacterSelect.PlayerOne.P4;
            }
        }
    }