/// <summary> /// [ボタン]の情報を一括取得 /// </summary> public static XBStateButton GetStateButton(XBKeyCode.UserCode id) { XBStateButton sts = new XBStateButton(); sts.A = XBGamePad.IsPressed(XBKeyCode.Button.A, id); sts.B = XBGamePad.IsPressed(XBKeyCode.Button.B, id); sts.X = XBGamePad.IsPressed(XBKeyCode.Button.X, id); sts.Y = XBGamePad.IsPressed(XBKeyCode.Button.Y, id); sts.start = XBGamePad.IsPressed(XBKeyCode.Button.Start, id); sts.back = XBGamePad.IsPressed(XBKeyCode.Button.Back, id); return sts; }
/// <summary> /// すべての入力情報を一括取得 /// </summary> /// <param name="raw">未加工の値にするか?</param> public static XBState GetState(XBKeyCode.UserCode id, bool raw = false) { XBState sts = new XBState(); sts.button = XBGamePad.GetStateButton(id); sts.shoulders = XBGamePad.GetStateShoulder(id, raw); sts.axisL = XBGamePad.GetStateAxisL(id, raw); sts.axisR = XBGamePad.GetStateAxisR(id, raw); sts.dpad = XBGamePad.GetStateDPad(id, raw); return sts; }
/// <summary> /// [右スティック]の情報を一括取得 /// </summary> /// <param name="raw">未加工の値にするか?</param> public static XBStateAxis GetStateAxisR(XBKeyCode.UserCode id, bool raw = false) { XBStateAxis sts = new XBStateAxis(); sts.stickPressed = XBGamePad.IsPressed(XBKeyCode.Button.RightStick, id); if (raw) { sts.axis = XBGamePad.GetAxisRaw(XBKeyCode.Axis.RightStick, id); } else { sts.axis = XBGamePad.GetAxis(XBKeyCode.Axis.RightStick, id); } return sts; }
/// <summary> /// [十字キー]の情報を一括取得 /// </summary> /// <param name="raw">未加工の値にするか?</param> public static XBStateDPad GetStateDPad(XBKeyCode.UserCode id, bool raw = false) { XBStateDPad sts = new XBStateDPad(); if (raw) { sts.axis = XBGamePad.GetAxisRaw(XBKeyCode.Axis.Dpad, id); } else { sts.axis = XBGamePad.GetAxis(XBKeyCode.Axis.Dpad, id); } sts.left = (sts.axis.x < 0); sts.right = (sts.axis.x > 0); sts.up = (sts.axis.y > 0); sts.down = (sts.axis.y < 0); return sts; }
/// <summary> /// [Shoulder & Trigger]の情報を一括取得 /// </summary> /// <param name="raw">未加工の値にするか?</param> public static XBStateShoulder GetStateShoulder(XBKeyCode.UserCode id, bool raw = false) { XBStateShoulder sts = new XBStateShoulder(); sts.shoulderL = XBGamePad.IsPressed(XBKeyCode.Button.LeftShoulder, id); sts.shoulderR = XBGamePad.IsPressed(XBKeyCode.Button.RightShoulder, id); if (raw) { sts.triggerL = XBGamePad.GetTriggerRaw(XBKeyCode.Trigger.LeftTrigger, id); sts.triggerR = XBGamePad.GetTriggerRaw(XBKeyCode.Trigger.RightTrigger, id); } else { sts.triggerL = XBGamePad.GetTrigger(XBKeyCode.Trigger.LeftTrigger, id); sts.triggerR = XBGamePad.GetTrigger(XBKeyCode.Trigger.RightTrigger, id); } return sts; }