示例#1
0
        /** Main
         */
        public static bool Main(int a_index)
        {
            //is_focus
            bool t_is_focus = Fee.Input.Input.GetInstance().is_focus;

            //pad_index
            int t_pad_index = Fee.Input.Input.GetInstance().pad.status[a_index].pad_index;

            UnityEngine.InputSystem.Gamepad t_device = Fee.Input.Input.GetInstance().pad.GetInputSystemDevice(t_pad_index);
            if (t_device != null)
            {
                float t_value_low      = Fee.Input.Input.GetInstance().pad.status[a_index].motor_low.GetValue();
                float t_value_high     = Fee.Input.Input.GetInstance().pad.status[a_index].motor_high.GetValue();
                float t_raw_value_low  = Fee.Input.Input.GetInstance().pad.status[a_index].motor_low.GetRawValue();
                float t_raw_value_high = Fee.Input.Input.GetInstance().pad.status[a_index].motor_high.GetRawValue();

                {
                    Fee.Input.Input.GetInstance().pad.status[a_index].motor_low.SetRawValue(t_value_low);
                    Fee.Input.Input.GetInstance().pad.status[a_index].motor_high.SetRawValue(t_value_high);
                    t_device.SetMotorSpeeds(t_value_low, t_value_high);
                }

                //debugview
                                #if (UNITY_EDITOR) || (DEVELOPMENT_BUILD) || (USE_DEF_FEE_DEBUGTOOL)
                {
                    Fee.Input.Input.GetInstance().debugview.pad_motor = "Pad_Motor_InputSystem_GamePad";
                }
                                #endif

                return(true);
            }
            return(false);
        }
示例#2
0
 /** Delete
  */
 public void Delete()
 {
     foreach (UnityEngine.InputSystem.InputDevice t_device in UnityEngine.InputSystem.InputSystem.devices)
     {
         UnityEngine.InputSystem.Gamepad t_gamepad = t_device as UnityEngine.InputSystem.Gamepad;
         if (t_gamepad != null)
         {
             t_gamepad.SetMotorSpeeds(0.0f, 0.0f);
         }
     }
 }
示例#3
0
        /** Main
         */
        public static bool Main(int a_index)
        {
            //is_focus
            bool t_is_focus = Fee.Input.Input.GetInstance().is_focus;

            //pad_index
            int t_pad_index = Fee.Input.Input.GetInstance().pad.status[a_index].pad_index;

            UnityEngine.InputSystem.Gamepad t_device = Fee.Input.Input.GetInstance().pad.GetInputSystemDevice(t_pad_index);
            if (t_device != null)
            {
                //デバイス。
                bool t_left_on       = t_device.dpad.left.isPressed;
                bool t_right_on      = t_device.dpad.right.isPressed;
                bool t_up_on         = t_device.dpad.up.isPressed;
                bool t_down_on       = t_device.dpad.down.isPressed;
                bool t_enter_on      = t_device.buttonEast.isPressed;
                bool t_escape_on     = t_device.buttonSouth.isPressed;
                bool t_sub1_on       = t_device.buttonNorth.isPressed;
                bool t_sub2_on       = t_device.buttonWest.isPressed;
                bool t_left_menu_on  = t_device.selectButton.isPressed;
                bool t_right_menu_on = t_device.startButton.isPressed;

                //設定。
                Fee.Input.Input.GetInstance().pad.status[a_index].left.Set(t_left_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].right.Set(t_right_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].up.Set(t_up_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].down.Set(t_down_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].enter.Set(t_enter_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].escape.Set(t_escape_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].sub1.Set(t_sub1_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].sub2.Set(t_sub2_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].left_menu.Set(t_left_menu_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].right_menu.Set(t_right_menu_on & t_is_focus);

                //debugview
                                #if (UNITY_EDITOR) || (DEVELOPMENT_BUILD) || (USE_DEF_FEE_DEBUGTOOL)
                {
                    Fee.Input.Input.GetInstance().debugview.pad_button = "Pad_Button_InputSystem_GamePad";
                }
                                #endif

                return(true);
            }
            return(false);
        }
        /** Main
         */
        public static bool Main(int a_index)
        {
            //is_focus
            bool t_is_focus = Fee.Input.Input.GetInstance().is_focus;

            //pad_index
            int t_pad_index = Fee.Input.Input.GetInstance().pad.status[a_index].pad_index;

            UnityEngine.InputSystem.Gamepad t_device = Fee.Input.Input.GetInstance().pad.GetInputSystemDevice(t_pad_index);
            if (t_device != null)
            {
                //デバイス。
                float t_l_x  = t_device.leftStick.x.ReadValue();
                float t_l_y  = t_device.leftStick.y.ReadValue();
                float t_r_x  = t_device.rightStick.x.ReadValue();
                float t_r_y  = t_device.rightStick.y.ReadValue();
                bool  t_l_on = t_device.leftStickButton.isPressed;
                bool  t_r_on = t_device.rightStickButton.isPressed;

                //設定。
                if (t_is_focus == true)
                {
                    Fee.Input.Input.GetInstance().pad.status[a_index].l_stick.Set(t_l_x, t_l_y);
                    Fee.Input.Input.GetInstance().pad.status[a_index].r_stick.Set(t_r_x, t_r_y);
                }
                else
                {
                    Fee.Input.Input.GetInstance().pad.status[a_index].l_stick.Set(0.0f, 0.0f);
                    Fee.Input.Input.GetInstance().pad.status[a_index].r_stick.Set(0.0f, 0.0f);
                }
                Fee.Input.Input.GetInstance().pad.status[a_index].l_stick_button.Set(t_l_on & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].r_stick_button.Set(t_r_on & t_is_focus);

                //debugview
                                #if (UNITY_EDITOR) || (DEVELOPMENT_BUILD) || (USE_DEF_FEE_DEBUGTOOL)
                {
                    Fee.Input.Input.GetInstance().debugview.pad_stick = "Pad_Stick_InputSystem_GamePad";
                }
                                #endif

                return(true);
            }

            return(false);
        }
        /** Main
         */
        public static bool Main(int a_index)
        {
            //is_focus
            bool t_is_focus = Fee.Input.Input.GetInstance().is_focus;

            //pad_index
            int t_pad_index = Fee.Input.Input.GetInstance().pad.status[a_index].pad_index;

            UnityEngine.InputSystem.Gamepad t_device = Fee.Input.Input.GetInstance().pad.GetInputSystemDevice(t_pad_index);
            if (t_device != null)
            {
                //デバイス。
                bool  t_l_1 = t_device.leftShoulder.isPressed;
                bool  t_r_1 = t_device.rightShoulder.isPressed;
                float t_l_2 = t_device.leftTrigger.ReadValue();
                float t_r_2 = t_device.rightTrigger.ReadValue();

                //設定。
                Fee.Input.Input.GetInstance().pad.status[a_index].l_trigger_1.Set(t_l_1 & t_is_focus);
                Fee.Input.Input.GetInstance().pad.status[a_index].r_trigger_1.Set(t_r_1 & t_is_focus);
                if (t_is_focus == true)
                {
                    Fee.Input.Input.GetInstance().pad.status[a_index].l_trigger_2.Set(t_l_2);
                    Fee.Input.Input.GetInstance().pad.status[a_index].r_trigger_2.Set(t_r_2);
                }
                else
                {
                    Fee.Input.Input.GetInstance().pad.status[a_index].l_trigger_2.Set(0.0f);
                    Fee.Input.Input.GetInstance().pad.status[a_index].r_trigger_2.Set(0.0f);
                }

                //debugview
                                #if (UNITY_EDITOR) || (DEVELOPMENT_BUILD) || (USE_DEF_FEE_DEBUGTOOL)
                {
                    Fee.Input.Input.GetInstance().debugview.pad_trigger = "Pad_Trigger_InputSystem_GamePad";
                }
                                #endif

                return(true);
            }

            return(false);
        }
示例#6
0
        static void GetGamepadInput(UnityEngine.InputSystem.Gamepad device, InputState inputState)
        {
            if (device == null)
            {
                return;
            }

            inputState.right = (device.leftStick.ReadValue().x > deadZone) || device.dpad.right.isPressed;
            inputState.left  = (device.leftStick.ReadValue().x < -deadZone) || device.dpad.left.isPressed;
            inputState.up    = (device.leftStick.ReadValue().y > deadZone) || device.dpad.up.isPressed;
            inputState.down  = (device.leftStick.ReadValue().y < -deadZone) || device.dpad.down.isPressed;

            inputState.aButton = device.aButton.isPressed;
            inputState.bButton = device.bButton.isPressed;
            inputState.xButton = device.xButton.isPressed;
            inputState.yButton = device.yButton.isPressed;

            inputState.leftTrigger   = device.leftTrigger.ReadValue();
            inputState.rightTrigger  = device.rightTrigger.ReadValue();
            inputState.start         = device.startButton.isPressed;
            inputState.rightShoulder = device.rightShoulder.isPressed;
        }