コード例 #1
0
    //Function that assigns a control Scheme to a specific player as detected by the input
    void setControlScheme()
    {
        if (ps.is_CPU)
        {
            newPlayer.ThisPlayerControl = MoveSelector.ControlTypesHere.NotAssigned;
            ps.Controls = 0;
            ps.ControlManager();
        }
        else
        {
            //If the Control Scheme is not already in use and is the one being currently detected assign it to the Player
            if (!is_arrowKeys_taken && is_arrowKeys_used)

            {
                newPlayer.ThisPlayerControl = MoveSelector.ControlTypesHere.ArrowKeys;
                ps.Controls = 2;
                ps.ControlManager();
                is_arrowKeys_taken = true;
                is_arrowKeys_used  = false;
            }

            else if (!is_wsda_taken && is_wsda_used)

            {
                newPlayer.ThisPlayerControl = MoveSelector.ControlTypesHere.WSDA;
                ps.Controls = 3;
                ps.ControlManager();
                is_wsda_taken = true;
                is_wsda_used  = false;
            }

            else if (!is_joy2_taken && is_joy2_used)

            {
                newPlayer.ThisPlayerControl = MoveSelector.ControlTypesHere.Joy2;
                ps.Controls = 1;
                ps.ControlManager();
                is_joy2_taken = true;
                is_joy2_used  = false;
            }

            else if (!is_joy1_taken && is_joy1_used)

            {
                newPlayer.ThisPlayerControl = MoveSelector.ControlTypesHere.Joy1;
                ps.Controls = 0;
                ps.ControlManager();
                is_joy1_taken = true;
                is_joy1_used  = false;
            }
        }
    }
コード例 #2
0
    //When the cursor is on top of the button and presses the "a" button call the control manager funcion that switches the control scheme in the playerselector script
    void Update()
    {
        if (overlay)
        {
            if (player1Control.ThisPlayerControl == MoveSelector.ControlTypesHere.Joy1)
            {
                if (Input.GetButtonDown("ButtonAJoyStick1"))
                {
                    playerSelector.ControlManager();
                }
            }

            else if (player1Control.ThisPlayerControl == MoveSelector.ControlTypesHere.Joy2)
            {
                if (Input.GetButtonDown("ButtonAJoyStick2"))
                {
                    playerSelector.ControlManager();
                }
            }

            else if (player1Control.ThisPlayerControl == MoveSelector.ControlTypesHere.ArrowKeys)
            {
                if (Input.GetButtonDown("ButtonAArrows"))
                {
                    playerSelector.ControlManager();
                }
            }

            else if (player1Control.ThisPlayerControl == MoveSelector.ControlTypesHere.WSDA)
            {
                if (Input.GetButtonDown("ButtonAWSDA"))
                {
                    playerSelector.ControlManager();
                }
            }
        }
    }