Guest User

Untitled

a guest
May 7th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. using InControl;
  2. using UnityEngine;
  3.  
  4. public class InControlExample : MonoBehaviour
  5. {
  6. private void Update()
  7. {
  8. var ad = InputManager.ActiveDevice;
  9.  
  10. // ボタンが押されたかどうか
  11. if ( ad.DPadLeft.WasPressed ) print( "十字ボタンの左" );
  12. if ( ad.DPadRight.WasPressed ) print( "十字ボタンの右" );
  13. if ( ad.DPadUp.WasPressed ) print( "十字ボタンの上" );
  14. if ( ad.DPadDown.WasPressed ) print( "十字ボタンの下" );
  15. if ( ad.Action2.WasPressed ) print( "A" );
  16. if ( ad.Action1.WasPressed ) print( "B" );
  17. if ( ad.Action4.WasPressed ) print( "X" );
  18. if ( ad.Action3.WasPressed ) print( "Y" );
  19. if ( ad.LeftBumper.WasPressed ) print( "L" );
  20. if ( ad.RightBumper.WasPressed ) print( "R" );
  21. if ( ad.LeftTrigger.WasPressed ) print( "ZL" );
  22. if ( ad.RightTrigger.WasPressed ) print( "ZR" );
  23. if ( ad.LeftStickButton.WasPressed ) print( "L スティック" );
  24. if ( ad.RightStickButton.WasPressed ) print( "R スティック" );
  25.  
  26. if ( ad.GetControl( InputControlType.Minus ).WasPressed ) print( "-" );
  27. if ( ad.GetControl( InputControlType.Plus ).WasPressed ) print( "+" );
  28. if ( ad.GetControl( InputControlType.Capture ).WasPressed ) print( "キャプチャー" );
  29. if ( ad.GetControl( InputControlType.Home ).WasPressed ) print( "HOME " );
  30.  
  31. // 左スティックの傾き
  32. print( ad.LeftStick.X ); // 横方向の傾き -1 ~ 1
  33. print( ad.LeftStick.Y ); // 縦方向の傾き -1 ~ 1
  34. print( ad.LeftStickLeft.Value ); // 左方向の傾き 0 ~ 1
  35. print( ad.LeftStickRight.Value ); // 右方向の傾き 0 ~ 1
  36. print( ad.LeftStickUp.Value ); // 上方向の傾き 0 ~ 1
  37. print( ad.LeftStickDown.Value ); // 下方向の傾き 0 ~ 1
  38.  
  39. // 右スティックの傾き
  40. print( ad.RightStick.X ); // 横方向の傾き -1 ~ 1
  41. print( ad.RightStick.Y ); // 縦方向の傾き -1 ~ 1
  42. print( ad.RightStickLeft.Value ); // 左方向の傾き 0 ~ 1
  43. print( ad.RightStickRight.Value ); // 右方向の傾き 0 ~ 1
  44. print( ad.RightStickUp.Value ); // 上方向の傾き 0 ~ 1
  45. print( ad.RightStickDown.Value ); // 下方向の傾き 0 ~ 1
  46. }
  47. }
Add Comment
Please, Sign In to add comment