/// <summary> /// プレイヤーごとの入力設定を追加する /// </summary> /// <param name="inputManagerGenerator">Input manager generator.</param> /// <param name="playerIndex">Player index.</param> private static void AddPlayerInputSettings(InputManagerGenerator inputManagerGenerator, int playerIndex) { if (playerIndex < 0 || playerIndex > 3) { Debug.LogError("プレイヤーインデックスの値が不正です。"); } string upKey = "", downKey = "", leftKey = "", rightKey = "", attackKey = ""; GetAxisKey(out upKey, out downKey, out leftKey, out rightKey, out attackKey, playerIndex); int joystickNum = playerIndex + 1; // 横方向 { var name = string.Format("Player{0} Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } // 縦方向 { var name = string.Format("Player{0} Vertical", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } // 攻撃 { var axis = new InputAxis(); var name = string.Format("Player{0} Attack", playerIndex); var button = string.Format("joystick {0} button 0", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); } }
/// <summary> /// グローバルな入力設定を追加する(OK、キャンセルなど) /// </summary> /// <param name="inputManagerGenerator">Input manager generator.</param> private static void AddGlobalInputSettings(InputManagerGenerator inputManagerGenerator) { // 横方向 { var name = "Horizontal"; inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, "a", "d", "left", "right")); } // 縦方向 { var name = "Vertical"; inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, "s", "w", "down", "up")); } // 決定 { var name = "Submit"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, "z", "joystick button 0")); } // キャンセル { var name = "Cancel"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, "x", "joystick button 1")); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); InputManager manager = target as InputManager; if (GUILayout.Button("反映")) { generator = new InputManagerGenerator(); generator.Clear(); var inputList = manager.GetInputSettingList(); for (int i = 0; i < inputList.Length; i++) { var data = inputList[i]; generator.AddAxis(InputAxis.CreateKeyAxis(data.name, data.negative, data.positive, data.altNegative, data.altPositive)); if (data.isJoyPadAxisCreate) { generator.AddAxis(InputAxis.CreatePadAxis(data.name, data.joyStickNum, data.axisNum)); } } Debug.Log("反映成功"); } }
public static void EnableSteeringContoller() { InputManagerGenerator inputManagerGenerator = new InputManagerGenerator(); // 現在の設定をクリア inputManagerGenerator.Clear(); // ハンドル入力を登録 { var name = "HANDLE"; inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, 0, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, "a", "d", "left", "right")); } // ボタン入力を登録 foreach (var button in buttons) { var buttonName = button.Key; var inputName = button.Value; inputManagerGenerator.AddAxis(InputAxis.CreateButton(buttonName, inputName, inputName)); } // デフォルト { inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis("Horizontal", 0, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis("Horizontal", "a", "d", "left", "right")); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis("Vertical", 0, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis("Vertical", "s", "w", "down", "up")); inputManagerGenerator.AddAxis(InputAxis.CreateButton("Submit", "enter", "joystick button 0")); inputManagerGenerator.AddAxis(InputAxis.CreateButton("Cancel", "escape", "joystick button 1")); } // 完了 Debug.Log("ProjectSetting/InputにSteeringControllerを設定しました。"); }
/// <summary> /// グローバルな入力設定を追加する(OK、キャンセルなど) /// </summary> /// <param name="inputManagerGenerator">Input manager generator.</param> private static void AddGlobalInputSettings(InputManagerGenerator inputManagerGenerator) { // 横方向 { var name = "Horizontal"; inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, 0, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, "a", "d", "left", "right")); } // 縦方向 { var name = "Vertical"; inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, 0, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, "s", "w", "down", "up")); } }
/// <summary> /// プレイヤーごとの入力設定を追加する /// </summary> /// <param name="inputManagerGenerator">Input manager generator.</param> /// <param name="playerIndex">Player index.</param> /// private static void AddPlayerInputSettings(InputManagerGenerator inputManagerGenerator, int playerIndex) { if (playerIndex < 0 || playerIndex > 3) { Debug.LogError("プレイヤーインデックスの値が不正です。"); } string upKey = "", downKey = "", leftKey = "", rightKey = "", attackKey = ""; GetAxisKey(out upKey, out downKey, out leftKey, out rightKey, out attackKey, playerIndex); List <string> buttonCodeList = Enum.GetNames(typeof(UdonObservable.InputRx.GamePad.GamePadObservable.ButtonCode)).ToList(); int joystickNum = playerIndex + 1; // 横方向 { var name = string.Format("Player{0} Horizontal", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 1)); // inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } // 縦方向 { var name = string.Format("Player{0} Vertical", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 2)); // inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } // 全てのキーの生成 { foreach (var key in buttonCodeList.Select((value, index) => new { value, index })) { var name = string.Format("Player{0} {1}", joystickNum, key.value); var button = string.Format("joystick {0} button {1}", joystickNum, key.index); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); } } }
/** ******************************************************************************** * @summary グローバルな入力設定を追加する(OK、キャンセルなど) ***********************************************************************************/ private static void AddGlobalInputSettings(InputManagerGenerator inputManagerGenerator) { // 横方向 { var name = "Horizontal"; inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, 0, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, "a", "d", "left", "right")); } // 縦方向 { var name = "Vertical"; inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, 0, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, "s", "w", "down", "up")); } // 決定 { var name = "OK"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, "z", "joystick button 3")); } // キャンセル { var name = "Cancel"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, "x", "joystick button 2")); } // ポーズ { var name = "Pause"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, "return", "joystick button 11")); } // デバッグ用リセット { var name = "DebugReset"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, "escape", "joystick button 10")); } }
/// <summary> /// プレイヤーごとの入力設定を追加する /// </summary> /// <param name="inputManagerGenerator">Input manager generator.</param> /// <param name="playerIndex">Player index.</param> private static void AddPlayerInputSettings(InputManagerGenerator inputManagerGenerator, int playerIndex) { if (playerIndex < 0 || playerIndex > 3) { Debug.LogError("プレイヤーインデックスの値が不正です。"); } string upKey = "", downKey = "", leftKey = "", rightKey = ""; List <string> fireKeys; GetAxisKey(out upKey, out downKey, out leftKey, out rightKey, out fireKeys, playerIndex); int joystickNum = playerIndex + 1; Debug.Log("プレイヤー" + joystickNum + "の設定を追加します。"); // 横方向 { var name = string.Format("P{0}Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 1)); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 5)); //5thAxis inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } // 縦方向 { var name = string.Format("P{0}Vertical", playerIndex); //Yはinvert設定しないとギャクに成る inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 2, true)); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 6, true)); //6thAxis inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } // 攻撃 for (int i = 0; i < FIRENUM; i++) { var axis = new InputAxis(); var name = string.Format("P{0}Fire{1}", playerIndex, i + 1); var button = string.Format("joystick {0} button {1}", joystickNum, i); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, fireKeys[i])); } }
/** ******************************************************************************** * @summary プレイヤーごとの入力設定を追加する ***********************************************************************************/ private static void AddPlayerInputSettings(InputManagerGenerator inputManagerGenerator, int playerIndex) { if (playerIndex < 0 || playerIndex > 3) { Debug.LogError("プレイヤーインデックスの値が不正です。"); } string upKey = "", downKey = "", leftKey = "", rightKey = "", jumpKey = "", characterKey = "", eraserKey = "", chalkKey = "", changeStateKey = "", actionKey = ""; GetAxisKey(out upKey, out downKey, out leftKey, out rightKey, out jumpKey, out characterKey, out eraserKey, out chalkKey, out changeStateKey, out actionKey, playerIndex); int joystickNum = playerIndex + 1; // 横方向 { var name = string.Format("Player{0} Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } // 縦方向 { var name = string.Format("Player{0} Vertical", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } // チョーク /* * { * var axis = new InputAxis(); * var name = string.Format("Player{0} Chalk", playerIndex); * var button = string.Format("joystick {0} button 0", joystickNum); * inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, chalkKey)); * } */ // 黒板消し { var name = string.Format("Player{0} Eraser", playerIndex); var button = string.Format("joystick {0} button 4", joystickNum); // 4: L1 inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, eraserKey)); } // キャラクター /* * { * var axis = new InputAxis(); * var name = string.Format("Player{0} Character", playerIndex); * var button = string.Format("joystick {0} button 3", joystickNum); * inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, characterKey)); * } */ // ステート切り替え { var name = string.Format("Player{0} ChangeState", playerIndex); var button = string.Format("joystick {0} button 5", joystickNum); // 5: R1 inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, changeStateKey)); } // アクション { var name = string.Format("Player{0} Action", playerIndex); var button = string.Format("joystick {0} button 0", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, actionKey)); } // ジャンプ { var name = string.Format("Player{0} Jump", playerIndex); var button = string.Format("joystick {0} button 2", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, jumpKey)); } }
public static void Resetting() { Debug.Log("start to change input manger"); InputManagerGenerator gen = new InputManagerGenerator(); gen.Clear(); gen.AddAxis(InputAxis.Init("LRight", "", "", "a", "d", 0, 0.1f, 2, true, false, AxisType.JoystickAxis, 1, 0)); gen.AddAxis(InputAxis.Init("LDown", "", "", "s", "w", 0, 0.1f, 2, true, false, AxisType.JoystickAxis, 2, 0)); gen.AddAxis(InputAxis.Init("RRight", "", "", "", "", 0, 0.1f, 2, true, false, AxisType.JoystickAxis, 3, 1)); gen.AddAxis(InputAxis.Init("RDown", "", "", "", "", 0, 0.1f, 2, true, false, AxisType.JoystickAxis, 4, 1)); gen.AddAxis(InputAxis.Init("L2", "", "", "", "", 0, 0.1f, 2, true, false, AxisType.JoystickAxis, 5, 1)); gen.AddAxis(InputAxis.Init("R2", "", "", "", "", 0, 0.1f, 2, true, false, AxisType.JoystickAxis, 6, 1)); gen.AddAxis(InputAxis.Init("L1", "", "joystick button 4", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); gen.AddAxis(InputAxis.Init("R1", "", "joystick button 5", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); gen.AddAxis(InputAxis.Init("L3", "", "joystick button 10", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); gen.AddAxis(InputAxis.Init("R3", "", "joystick button 11", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); gen.AddAxis(InputAxis.Init("Rectangle", "", "joystick button 0", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); gen.AddAxis(InputAxis.Init("Cross", "", "joystick button 1", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); gen.AddAxis(InputAxis.Init("Circle", "", "joystick button 2", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); gen.AddAxis(InputAxis.Init("Triangle", "", "joystick button 3", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); gen.AddAxis(InputAxis.Init("Right", "", "", "", "", 0, 0.1f, 1000, false, false, AxisType.JoystickAxis, 7, 1)); gen.AddAxis(InputAxis.Init("Up", "", "", "", "", 0, 0.1f, 1000, false, false, AxisType.JoystickAxis, 8, 1)); gen.AddAxis(InputAxis.Init("None", "", "", "", "", 1000, 0.1f, 1000, false, false, AxisType.KeyOrMouseButton, 1, 1)); }
/// <summary> /// プレイヤーごとの入力設定を追加する /// </summary> /// <param name="inputManagerGenerator">Input manager generator.</param> /// <param name="playerIndex">Player index.</param> private static void AddPlayerInputSettings(InputManagerGenerator inputManagerGenerator, int playerIndex, string controllerName) { if (playerIndex < 0 || playerIndex > 3) { Debug.LogError("プレイヤーインデックスの値が不正です。"); } string upKey = "", downKey = "", leftKey = "", rightKey = "", attackKey1 = "", attackKey2 = "", attackKey3 = ""; GetAxisKey(out upKey, out downKey, out leftKey, out rightKey, out attackKey1, out attackKey2, out attackKey3, playerIndex); int joystickNum = playerIndex + 1; //ここに各コントローラーの設定を作成 #region BSGPAC02 Series if (controllerName == "BSGPAC02 Series") { //スティック //横方向 { var name = string.Format("Player{0}_Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, controllerName, joystickNum, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } //縦方向 { var name = string.Format("Player{0}_Vertical", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, controllerName, joystickNum, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } //攻撃ボタン //弱 { var name = string.Format("Player{0}_Attack1", playerIndex); var button = string.Format("joystick {0} button 0", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey1)); } //中 { var name = string.Format("Player{0}_Attack2", playerIndex); var button = string.Format("joystick {0} button 1", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey2)); } //強 { var name = string.Format("Player{0}_Attack3", playerIndex); var button = string.Format("joystick {0} button 2", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey3)); } //決定キーなどの設定 { //決定 { var name = "OK"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "z", "joystick button 1")); } //キャンセル { var name = "Cancel"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "x", "joystick button 2")); } //ポーズ { var name = "Pause"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "escape", "joystick button 8")); } } } #endregion #region RAP.N3 else if (controllerName == "RAP.N3") { //スティック //横方向 { var name = string.Format("Player{0}_Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, controllerName, joystickNum, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } //縦方向 { var name = string.Format("Player{0}_Vertical", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, controllerName, joystickNum, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } //攻撃ボタン //弱 { //var axis = new InputAxis(); var name = string.Format("Player{0}_Attack1", playerIndex); var button = string.Format("joystick {0} button 1", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey1)); } //中 { var name = string.Format("Player{0}_Attack2", playerIndex); var button = string.Format("joystick {0} button 2", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey2)); } //強 { var name = string.Format("Player{0}_Attack3", playerIndex); var button = string.Format("joystick {0} button 7", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey3)); } //決定キーなどの設定 { //決定 { var name = "OK"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "z", "joystick button 0")); } //キャンセル { var name = "Cancel"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "x", "joystick button 1")); } //ポーズ { var name = "Pause"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "escape", "joystick button 8")); } } } #endregion #region Logicool Dual Action else if (controllerName == "Logicool Dual Action") { //スティック //横方向 { var name = string.Format("Player{0}_Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, controllerName, joystickNum, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } //縦方向 { var name = string.Format("Player{0}_Vertical", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, controllerName, joystickNum, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } //攻撃ボタン //弱 { var name = string.Format("Player{0}_Attack1", playerIndex); var button = string.Format("joystick {0} button 0", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey1)); } // 中 { var name = string.Format("Player{0}_Attack2", playerIndex); var button = string.Format("joystick {0} button 1", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey2)); } //強 { var name = string.Format("Player{0}_Attack3", playerIndex); var button = string.Format("joystick {0} button 2", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey3)); } //決定キーなどの設定 { //決定 { var name = "OK"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "z", "joystick button 1")); } //キャンセル { var name = "Cancel"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "x", "joystick button0")); } //ポーズ { var name = "Pause"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "escape", "joystick button 7")); } } } #endregion #region Controller (Gamepad F310) else if (controllerName == "Controller (Gamepad F310)") { //スティック //横方向 { var name = string.Format("Player{0}_Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, controllerName, joystickNum, 1)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } //縦方向 { var name = string.Format("Player{0}_Vertical", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, controllerName, joystickNum, 2)); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } //攻撃ボタン //弱 { var name = string.Format("Player{0}_Attack1", playerIndex); var button = string.Format("joystick {0} button 0", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey1)); } //中 { var name = string.Format("Player{0}_Attack2", playerIndex); var button = string.Format("joystick {0} button 1", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey2)); } //強 { var name = string.Format("Player{0}_Attack3", playerIndex); var button = string.Format("joystick {0} button 2", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, button, attackKey3)); } //決定キーなどの設定 { //決定 { var name = "OK"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "z", "joystick button 1")); } //キャンセル { var name = "Cancel"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "x", "joystick button0")); } //ポーズ { var name = "Pause"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "escape", "joystick button 7")); } } } #endregion //キーボードのみ設定 else { #region キーボードのみ //スティック //横方向 { var name = string.Format("Player{0}_Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } //縦方向 { var name = string.Format("Player{0}_Vertical", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } //攻撃ボタン //弱 { //var axis = new InputAxis(); var name = string.Format("Player{0}_Attack1", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "", attackKey1)); } //中 { var name = string.Format("Player{0}_Attack2", playerIndex); var button = string.Format("joystick {0} button 1", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "", attackKey2)); } //強 { var name = string.Format("Player{0}_Attack3", playerIndex); var button = string.Format("joystick {0} button 2", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "", attackKey3)); } //決定キーなどの設定 { //決定 { var name = "OK"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "z", "")); } //キャンセル { var name = "Cancel"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "x", "")); } //ポーズ { var name = "Pause"; inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, controllerName, "escape", "")); } } #endregion Debug.Log("***player" + playerIndex + " -> " + controllerName + " の入力が設定されていません キーボードのみ設定します***"); } }
public static void Reset() { Debug.Log("インプットマネージャーの設定を開始します。"); InputManagerGenerator inputMgr = new InputManagerGenerator(); inputMgr.Clear(); //共通の入力設定 inputMgr.AddAxis(AxisData.CreateKeyAxis("Horizontal", "left", "right")); //横軸 inputMgr.AddAxis(AxisData.CreateKeyAxis("Vertical", "up", "down")); //縦軸 inputMgr.AddAxis(AxisData.CreatePadAxis("Horizontal", 1, 0)); //横軸 inputMgr.AddAxis(AxisData.CreatePadAxis("Vertical", 2, 0)); //縦軸 inputMgr.AddAxis(AxisData.CreateButton("Accelerator", "space", "joystick button 0")); //適用・アクセル inputMgr.AddAxis(AxisData.CreateButton("Brake", "backspace", "joystick button 1")); //取消 ・ブレーキ inputMgr.AddAxis(AxisData.CreateButton("Glider", "left shift", "joystick button 2")); //滑空 inputMgr.AddAxis(AxisData.CreateButton("Drift", "left ctrl", "joystick button 6")); //ドリフト inputMgr.AddAxis(AxisData.CreateButton("Menu", "escape", "joystick button 9")); //メニュー //プレイヤーごとの入力設定 for (int i = 1; i <= 4; i++) { inputMgr.AddAxis(AxisData.CreatePadAxis("P" + i + "Horizontal", 1, i)); //横軸 inputMgr.AddAxis(AxisData.CreatePadAxis("P" + i + "Vertical", 2, i)); //縦軸 inputMgr.AddAxis(AxisData.CreateButton("P" + i + "Accelerator", "joystick " + i + " button 0")); //適用・アクセル inputMgr.AddAxis(AxisData.CreateButton("P" + i + "Brake", "joystick " + i + " button 1")); //取消 ・ブレーキ inputMgr.AddAxis(AxisData.CreateButton("P" + i + "Glider", "joystick " + i + " button 2")); //滑空 inputMgr.AddAxis(AxisData.CreateButton("P" + i + "Drift", "joystick " + i + " button 6")); //ドリフト inputMgr.AddAxis(AxisData.CreateButton("P" + i + "Menu", "joystick " + i + " button 9")); //メニュー } Debug.Log("設定を再設定しました。"); }
/// <summary> /// プレイヤーごとの入力設定を追加する /// </summary> /// <param name="inputManagerGenerator">Input manager generator.</param> /// <param name="playerIndex">Player index.</param> private static void AddPlayerInputSettings(InputManagerGenerator inputManagerGenerator, int playerIndex) { if (playerIndex < 1 || playerIndex > 4) { Debug.LogError("プレイヤーインデックスの値が不正です。"); } string upKey = "", downKey = "", leftKey = "", rightKey = "", attackKey = ""; GetAxisKey(out upKey, out downKey, out leftKey, out rightKey, out attackKey, playerIndex); int joystickNum = playerIndex; // 横方向 { var name = string.Format("Player{0} Horizontal", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 1)); //inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } // 縦方向 { var name = string.Format("Player{0} Vertical", playerIndex); var padAxis = InputAxis.CreatePadAxis(name, joystickNum, 2); padAxis.invert = true; inputManagerGenerator.AddAxis(padAxis); //inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } // 横方向 { var name = string.Format("Player{0} Horizontal2", playerIndex); inputManagerGenerator.AddAxis(InputAxis.CreatePadAxis(name, joystickNum, 4)); //inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, leftKey, rightKey, "", "")); } // 縦方向 { var name = string.Format("Player{0} Vertical2", playerIndex); var padAxis = InputAxis.CreatePadAxis(name, joystickNum, 5); padAxis.invert = true; inputManagerGenerator.AddAxis(padAxis); //inputManagerGenerator.AddAxis(InputAxis.CreateKeyAxis(name, downKey, upKey, "", "")); } // 攻撃 //{ // var axis = new InputAxis(); // var name = string.Format("Player{0} Attack", playerIndex); // var button = string.Format("joystick {0} button 1", joystickNum); // inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); //} // Cancel { var axis = new InputAxis(); var name = string.Format("Player{0} Cancel", playerIndex); var button = string.Format("joystick {0} button 2", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); } // Item { var axis = new InputAxis(); var name = string.Format("Player{0} Item", playerIndex); var button = string.Format("joystick {0} button 3", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); } // Throw { var axis = new InputAxis(); var name = string.Format("Player{0} Throw", playerIndex); var button = string.Format("joystick {0} button 0", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); } //Hold { var axis = new InputAxis(); var name = string.Format("Player{0} Hold", playerIndex); var button = string.Format("joystick {0} button 1", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); } // Dash { var axis = new InputAxis(); var name = string.Format("Player{0} Dash", playerIndex); var button = string.Format("joystick {0} button 5", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); } // Pause 難市 { var axis = new InputAxis(); var name = string.Format("Player{0} Pause", playerIndex); var button = string.Format("joystick {0} button 7", joystickNum); inputManagerGenerator.AddAxis(InputAxis.CreateButton(name, button, attackKey)); } }
public static void Reset() { Debug.Log("インプットマネージャーの設定を開始します。"); InputManagerGenerator inputMgr = new InputManagerGenerator(); inputMgr.Clear(); //共通の入力設定 inputMgr.AddAxis(AxisData.CreateKeyAxis("Horizontal" , "left", "right"));//横軸 inputMgr.AddAxis(AxisData.CreateKeyAxis("Vertical" , "up" , "down" ));//縦軸 inputMgr.AddAxis(AxisData.CreatePadAxis("Horizontal" , 1, 0));//横軸 inputMgr.AddAxis(AxisData.CreatePadAxis("Vertical" , 2, 0));//縦軸 inputMgr.AddAxis(AxisData.CreateButton ("Accelerator" , "space" , "joystick button 0" ));//適用・アクセル inputMgr.AddAxis(AxisData.CreateButton ("Brake" , "backspace" , "joystick button 1" ));//取消 ・ブレーキ inputMgr.AddAxis(AxisData.CreateButton ("Glider" , "left shift" , "joystick button 2" ));//滑空 inputMgr.AddAxis(AxisData.CreateButton ("Drift" , "left ctrl" , "joystick button 6" ));//ドリフト inputMgr.AddAxis(AxisData.CreateButton ("Menu" , "escape" , "joystick button 9" ));//メニュー //プレイヤーごとの入力設定 for(int i=1; i <= 4; i++) { inputMgr.AddAxis(AxisData.CreatePadAxis("P" + i + "Horizontal" , 1, i)); //横軸 inputMgr.AddAxis(AxisData.CreatePadAxis("P" + i + "Vertical" , 2, i)); //縦軸 inputMgr.AddAxis(AxisData.CreateButton ("P" + i + "Accelerator" , "joystick " + i + " button 0" ));//適用・アクセル inputMgr.AddAxis(AxisData.CreateButton ("P" + i + "Brake" , "joystick " + i + " button 1" ));//取消 ・ブレーキ inputMgr.AddAxis(AxisData.CreateButton ("P" + i + "Glider" , "joystick " + i + " button 2" ));//滑空 inputMgr.AddAxis(AxisData.CreateButton ("P" + i + "Drift" , "joystick " + i + " button 6" ));//ドリフト inputMgr.AddAxis(AxisData.CreateButton ("P" + i + "Menu" , "joystick " + i + " button 9" ));//メニュー } Debug.Log("設定を再設定しました。"); }