예제 #1
0
    //プレイヤーごとの入力設定を追加する
    private static void AddPlayerInputSettings(MyInputManagerGenerator myInputManagerGenerator, int playerIndex)
    {
        string upKey = "", downKey = "", leftKey = "", rightKey = "",
               AKey = "", BKey = "", XKey = "", YKey = "", STKey = "";

        GetAxisKey(out upKey, out downKey, out rightKey, out leftKey, out AKey, out BKey, out XKey, out YKey, out STKey, playerIndex);

        int joystickNum = playerIndex + 1;

        {
            var name = string.Format("Horizontal_Player{0}", joystickNum);
            myInputManagerGenerator.AddAxis(InputInfo.CreateAxis(name, joystickNum, 1));
            myInputManagerGenerator.AddAxis(InputInfo.CreateKeyAxis(name, rightKey, leftKey, "", ""));
        }
        {
            var name = string.Format("Vertical_Player{0}", joystickNum);
            myInputManagerGenerator.AddAxis(InputInfo.CreateAxis(name, joystickNum, 2));
            myInputManagerGenerator.AddAxis(InputInfo.CreateKeyAxis(name, downKey, upKey, "", ""));
        }
        {
            var name   = string.Format("A_Player{0}", joystickNum);
            var button = string.Format("joystick {0} button 0", joystickNum);
            myInputManagerGenerator.AddAxis(InputInfo.CreateButton(name, button, AKey));
        }
        {
            var name   = string.Format("B_Player{0}", joystickNum);
            var button = string.Format("joystick {0} button 1", joystickNum);
            myInputManagerGenerator.AddAxis(InputInfo.CreateButton(name, button, BKey));
        }
        {
            var name   = string.Format("X_Player{0}", joystickNum);
            var button = string.Format("joystick {0} button 2", joystickNum);
            myInputManagerGenerator.AddAxis(InputInfo.CreateButton(name, button, XKey));
        }
        {
            var name   = string.Format("Y_Player{0}", joystickNum);
            var button = string.Format("joystick {0} button 3", joystickNum);
            myInputManagerGenerator.AddAxis(InputInfo.CreateButton(name, button, YKey));
        }
        {
            var name   = string.Format("ST_Player{0}", joystickNum);
            var button = string.Format("joystick {0} button 11", joystickNum);
            myInputManagerGenerator.AddAxis(InputInfo.CreateButton(name, button, STKey));
        }
    }