Ejemplo n.º 1
0
        // ----------------------
        static public InputAxisList LoadInputManagerAxes()
        {
            try
            {
                SerializedObject   serializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(INPUT_ASSET_PATH)[0]);
                SerializedProperty axesProperty     = serializedObject.FindProperty("m_Axes");

                int           axisCount = axesProperty.arraySize;
                InputAxisList axes      = new InputAxisList(axisCount);    // InputAxis[axisCount];

                for (int i = 0; i < axisCount; ++i)
                {
                    SerializedProperty axisProperty = axesProperty.GetArrayElementAtIndex(i);

                    InputAxis axis = new InputAxis();
                    //axes[i] = axis;
                    axes.Add(axis);

                    axis.name                    = GetChildProperty(axisProperty, "m_Name").stringValue;
                    axis.descriptiveName         = GetChildProperty(axisProperty, "descriptiveName").stringValue;
                    axis.descriptiveNegativeName = GetChildProperty(axisProperty, "descriptiveNegativeName").stringValue;
                    axis.negativeButton          = GetChildProperty(axisProperty, "negativeButton").stringValue;
                    axis.positiveButton          = GetChildProperty(axisProperty, "positiveButton").stringValue;
                    axis.altNegativeButton       = GetChildProperty(axisProperty, "altNegativeButton").stringValue;
                    axis.altPositiveButton       = GetChildProperty(axisProperty, "altPositiveButton").stringValue;
                    axis.gravity                 = GetChildProperty(axisProperty, "gravity").floatValue;
                    axis.dead                    = GetChildProperty(axisProperty, "dead").floatValue;
                    axis.sensitivity             = GetChildProperty(axisProperty, "sensitivity").floatValue;
                    axis.snap                    = GetChildProperty(axisProperty, "snap").boolValue;
                    axis.invert                  = GetChildProperty(axisProperty, "invert").boolValue;
                    axis.type                    = (AxisType)GetChildProperty(axisProperty, "type").intValue;
                    axis.axis                    = GetChildProperty(axisProperty, "axis").intValue + 1;                                       //??
                    axis.joyNum                  = GetChildProperty(axisProperty, "joyNum").intValue;
                }

                return(axes);
            }
            catch (System.Exception)
            {
            }

            return(null);
        }
Ejemplo n.º 2
0
        // -------------------
        static private InputAxisList GetControlFreakAxes()
        {
            InputAxisList axes = new InputAxisList(5 + (GamepadManager.MAX_JOYSTICKS * GamepadManager.MAX_INTERNAL_AXES));

            // Add mouse definit
            axes.Add(new InputAxis()
            {
                name = InputRig.CF_EMPTY_AXIS, sensitivity = 1f, type = AxisType.KeyOrMouseButton
            });
            axes.Add(new InputAxis()
            {
                name = InputRig.CF_MOUSE_DELTA_X_AXIS, sensitivity = 1f, type = AxisType.MouseMovement, axis = 1
            });
            axes.Add(new InputAxis()
            {
                name = InputRig.CF_MOUSE_DELTA_Y_AXIS, sensitivity = 1f, type = AxisType.MouseMovement, axis = 2
            });
            axes.Add(new InputAxis()
            {
                name = InputRig.CF_SCROLL_WHEEL_X_AXIS, sensitivity = 1f, type = AxisType.MouseMovement, axis = 3
            });
            axes.Add(new InputAxis()
            {
                name = InputRig.CF_SCROLL_WHEEL_Y_AXIS, sensitivity = 1f, type = AxisType.MouseMovement, axis = 4
            });


            // Add gamepad definitions...

            for (int i = 0; i < GamepadManager.MAX_JOYSTICKS; i++)
            {
                for (int j = 0; j < GamepadManager.MAX_INTERNAL_AXES; j++)
                {
                    axes.Add(new InputAxis()
                    {
                        name        = GamepadManager.GetJoyAxisName(i, j),
                        dead        = 0.2f,
                        sensitivity = 1f,
                        type        = AxisType.JoystickAxis,
                        axis        = (j + 1),
                        joyNum      = (i + 1)
                    });
                }
            }

            return(axes);
        }
Ejemplo n.º 3
0
        // -----------------
        private static InputAxisList GetDefaultAxes()
        {
            InputAxisList axes = new InputAxisList(30);

            axes.Add(new InputAxis()
            {
                name = "Horizontal", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "left", positiveButton = "right", altNegativeButton = "a", altPositiveButton = "d", gravity = 3f, dead = 0.001f, sensitivity = 3f, snap = true, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Vertical", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "down", positiveButton = "up", altNegativeButton = "s", altPositiveButton = "w", gravity = 3f, dead = 0.001f, sensitivity = 3f, snap = true, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Fire1", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "left ctrl", altNegativeButton = "", altPositiveButton = "mouse 0", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Fire2", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "left alt", altNegativeButton = "", altPositiveButton = "mouse 1", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Fire3", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "left cmd", altNegativeButton = "", altPositiveButton = "mouse 2", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Jump", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "space", altNegativeButton = "", altPositiveButton = "", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Mouse X", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "", altNegativeButton = "", altPositiveButton = "", gravity = 0f, dead = 0f, sensitivity = 0.1f, snap = false, invert = false, type = AxisType.MouseMovement, axis = 1, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Mouse Y", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "", altNegativeButton = "", altPositiveButton = "", gravity = 0f, dead = 0f, sensitivity = 0.1f, snap = false, invert = false, type = AxisType.MouseMovement, axis = 2, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Mouse ScrollWheel", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "", altNegativeButton = "", altPositiveButton = "", gravity = 0f, dead = 0f, sensitivity = 0.1f, snap = false, invert = false, type = AxisType.MouseMovement, axis = 3, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Horizontal", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "", altNegativeButton = "", altPositiveButton = "", gravity = 0f, dead = 0.19f, sensitivity = 1f, snap = false, invert = false, type = AxisType.JoystickAxis, axis = 1, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Vertical", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "", altNegativeButton = "", altPositiveButton = "", gravity = 0f, dead = 0.19f, sensitivity = 1f, snap = false, invert = true, type = AxisType.JoystickAxis, axis = 2, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Fire1", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "joystick button 0", altNegativeButton = "", altPositiveButton = "", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Fire2", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "joystick button 1", altNegativeButton = "", altPositiveButton = "", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Fire3", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "joystick button 2", altNegativeButton = "", altPositiveButton = "", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Jump", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "joystick button 3", altNegativeButton = "", altPositiveButton = "", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Submit", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "return", altNegativeButton = "", altPositiveButton = "joystick button 0", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Submit", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "enter", altNegativeButton = "", altPositiveButton = "space", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });
            axes.Add(new InputAxis()
            {
                name = "Cancel", descriptiveName = "", descriptiveNegativeName = "", negativeButton = "", positiveButton = "escape", altNegativeButton = "", altPositiveButton = "joystick button 1", gravity = 1000f, dead = 0.001f, sensitivity = 1000f, snap = false, invert = false, type = AxisType.KeyOrMouseButton, axis = 0, joyNum = 0
            });

            return(axes);
        }