Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using InControl;
- using UnityEngine;
- public class InControlExample : MonoBehaviour
- {
- private void Update()
- {
- var ad = InputManager.ActiveDevice;
- // ボタンが押されたかどうか
- if ( ad.DPadLeft.WasPressed ) print( "十字ボタンの左" );
- if ( ad.DPadRight.WasPressed ) print( "十字ボタンの右" );
- if ( ad.DPadUp.WasPressed ) print( "十字ボタンの上" );
- if ( ad.DPadDown.WasPressed ) print( "十字ボタンの下" );
- if ( ad.Action2.WasPressed ) print( "A" );
- if ( ad.Action1.WasPressed ) print( "B" );
- if ( ad.Action4.WasPressed ) print( "X" );
- if ( ad.Action3.WasPressed ) print( "Y" );
- if ( ad.LeftBumper.WasPressed ) print( "L" );
- if ( ad.RightBumper.WasPressed ) print( "R" );
- if ( ad.LeftTrigger.WasPressed ) print( "ZL" );
- if ( ad.RightTrigger.WasPressed ) print( "ZR" );
- if ( ad.LeftStickButton.WasPressed ) print( "L スティック" );
- if ( ad.RightStickButton.WasPressed ) print( "R スティック" );
- if ( ad.GetControl( InputControlType.Minus ).WasPressed ) print( "-" );
- if ( ad.GetControl( InputControlType.Plus ).WasPressed ) print( "+" );
- if ( ad.GetControl( InputControlType.Capture ).WasPressed ) print( "キャプチャー" );
- if ( ad.GetControl( InputControlType.Home ).WasPressed ) print( "HOME " );
- // 左スティックの傾き
- print( ad.LeftStick.X ); // 横方向の傾き -1 ~ 1
- print( ad.LeftStick.Y ); // 縦方向の傾き -1 ~ 1
- print( ad.LeftStickLeft.Value ); // 左方向の傾き 0 ~ 1
- print( ad.LeftStickRight.Value ); // 右方向の傾き 0 ~ 1
- print( ad.LeftStickUp.Value ); // 上方向の傾き 0 ~ 1
- print( ad.LeftStickDown.Value ); // 下方向の傾き 0 ~ 1
- // 右スティックの傾き
- print( ad.RightStick.X ); // 横方向の傾き -1 ~ 1
- print( ad.RightStick.Y ); // 縦方向の傾き -1 ~ 1
- print( ad.RightStickLeft.Value ); // 左方向の傾き 0 ~ 1
- print( ad.RightStickRight.Value ); // 右方向の傾き 0 ~ 1
- print( ad.RightStickUp.Value ); // 上方向の傾き 0 ~ 1
- print( ad.RightStickDown.Value ); // 下方向の傾き 0 ~ 1
- }
- }
Add Comment
Please, Sign In to add comment