Ejemplo n.º 1
0
    /// <summary>
    /// If the input manager entries don't exist, create them
    /// </summary>
    private void CreateInputManagerSettings()
    {
        if (!InputManagerHelper.IsDefined("Inventory Toggle"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "Inventory Toggle";
            lEntry.PositiveButton = "0";
            lEntry.Gravity        = 100;
            lEntry.Dead           = 0.3f;
            lEntry.Sensitivity    = 100;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 1;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("Inventory Shift"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "Inventory Shift";
            lEntry.NegativeButton = "-";
            lEntry.PositiveButton = "=";
            lEntry.Gravity        = 100;
            lEntry.Dead           = 0.3f;
            lEntry.Sensitivity    = 100;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 1;
            lEntry.JoyNum         = 0;
            InputManagerHelper.AddEntry(lEntry, true);

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
            lEntry                = new InputManagerEntry();
            lEntry.Name           = "Inventory Shift";
            lEntry.PositiveButton = "joystick button 7";
            lEntry.NegativeButton = "joystick button 8";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;
            InputManagerHelper.AddEntry(lEntry, true);
#else
            lEntry             = new InputManagerEntry();
            lEntry.Name        = "Inventory Shift";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 6;
            lEntry.JoyNum      = 0;
            InputManagerHelper.AddEntry(lEntry, true);
#endif
        }
    }
Ejemplo n.º 2
0
        public static void CloneInputManager()
        {
            // Make the new blank instance for the InputManager Clone
            XciInputManagerClone inputManagerClone = ScriptableObject.CreateInstance <XciInputManagerClone>();

            // Retrieve the data of the original InputManager
            SerializedObject   originalInputManager           = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]);
            SerializedProperty originalInputEntriesCollection = originalInputManager.FindProperty("m_Axes");

            // Find the number of entries in the InputManager and allocate space in the clone
            int NumOfEntries = originalInputEntriesCollection.arraySize;

            inputManagerClone.Alloc(NumOfEntries);

            // Loop through every input entry and copy them into the clone
            InputManagerEntry  currentEntry  = null;
            SerializedProperty originalEntry = null;

            for (int i = 0; i < NumOfEntries; ++i)
            {
                originalEntry = originalInputEntriesCollection.GetArrayElementAtIndex(i);
                currentEntry  = inputManagerClone[i];


                currentEntry.name                    = InputManagerCloner.GetChildProperty(originalEntry, "m_Name").stringValue;
                currentEntry.descriptiveName         = InputManagerCloner.GetChildProperty(originalEntry, "descriptiveName").stringValue;
                currentEntry.descriptiveNegativeName = InputManagerCloner.GetChildProperty(originalEntry, "descriptiveNegativeName").stringValue;
                currentEntry.negativeButton          = InputManagerCloner.GetChildProperty(originalEntry, "negativeButton").stringValue;
                currentEntry.positiveButton          = InputManagerCloner.GetChildProperty(originalEntry, "positiveButton").stringValue;
                currentEntry.altNegativeButton       = InputManagerCloner.GetChildProperty(originalEntry, "altNegativeButton").stringValue;
                currentEntry.altPositiveButton       = InputManagerCloner.GetChildProperty(originalEntry, "altPositiveButton").stringValue;
                currentEntry.gravity                 = InputManagerCloner.GetChildProperty(originalEntry, "gravity").floatValue;
                currentEntry.dead                    = InputManagerCloner.GetChildProperty(originalEntry, "dead").floatValue;
                currentEntry.sensitivity             = InputManagerCloner.GetChildProperty(originalEntry, "sensitivity").floatValue;
                currentEntry.snap                    = InputManagerCloner.GetChildProperty(originalEntry, "snap").boolValue;
                currentEntry.invert                  = InputManagerCloner.GetChildProperty(originalEntry, "invert").boolValue;
                currentEntry.type                    = (InputManagerEntry.Type)InputManagerCloner.GetChildProperty(originalEntry, "type").intValue;
                currentEntry.axis                    = InputManagerCloner.GetChildProperty(originalEntry, "axis").intValue;
                currentEntry.joyNum                  = InputManagerCloner.GetChildProperty(originalEntry, "joyNum").intValue;
            }


            // Now save the Input Manager clone to file

            // Hard-coded path (always replaces what was originally there) (Do NOT change!)
            string finalAssetPath = "Assets/Resources/XboxCtrlrInput/InputManagerClone.asset";

            // Create a new data asset into a file on the chosen path
            AssetDatabase.CreateAsset(inputManagerClone, finalAssetPath);

            // Save and Focus
            AssetDatabase.SaveAssets();
        }
Ejemplo n.º 3
0
 static void CopyEntry(SerializedProperty spAxis, InputManagerEntry entry)
 {
     spAxis.FindPropertyRelative("m_Name").stringValue            = entry.name;
     spAxis.FindPropertyRelative("descriptiveName").stringValue   = entry.desc;
     spAxis.FindPropertyRelative("negativeButton").stringValue    = entry.btnNegative;
     spAxis.FindPropertyRelative("altNegativeButton").stringValue = entry.altBtnNegative;
     spAxis.FindPropertyRelative("positiveButton").stringValue    = entry.btnPositive;
     spAxis.FindPropertyRelative("altPositiveButton").stringValue = entry.altBtnPositive;
     spAxis.FindPropertyRelative("gravity").floatValue            = entry.gravity;
     spAxis.FindPropertyRelative("dead").floatValue        = entry.deadZone;
     spAxis.FindPropertyRelative("sensitivity").floatValue = entry.sensitivity;
     spAxis.FindPropertyRelative("snap").boolValue         = entry.snap;
     spAxis.FindPropertyRelative("invert").boolValue       = entry.invert;
     spAxis.FindPropertyRelative("type").intValue          = (int)entry.kind;
     spAxis.FindPropertyRelative("axis").intValue          = (int)entry.axis;
     spAxis.FindPropertyRelative("joyNum").intValue        = (int)entry.joystick;
 }
Ejemplo n.º 4
0
        // **************************************************************************************************
        // Following properties and function only valid while editing
        // **************************************************************************************************

#if UNITY_EDITOR
        /// <summary>
        /// Creates input settings in the Unity Input Manager
        /// </summary>
        public override void CreateInputManagerSettings()
        {
            if (!InputManagerHelper.IsDefined(_ActionAlias))
            {
                InputManagerEntry lEntry = new InputManagerEntry();
                lEntry.Name           = _ActionAlias;
                lEntry.PositiveButton = "t";
                lEntry.Gravity        = 1000;
                lEntry.Dead           = 0.001f;
                lEntry.Sensitivity    = 1000;
                lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                lEntry.Axis           = 0;
                lEntry.JoyNum         = 0;

                InputManagerHelper.AddEntry(lEntry, true);

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                lEntry                = new InputManagerEntry();
                lEntry.Name           = _ActionAlias;
                lEntry.PositiveButton = "joystick button 11"; // Left stick click
                lEntry.Gravity        = 1;
                lEntry.Dead           = 0.3f;
                lEntry.Sensitivity    = 1;
                lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                lEntry.Axis           = 0;
                lEntry.JoyNum         = 0;

                InputManagerHelper.AddEntry(lEntry, true);
#else
                lEntry                = new InputManagerEntry();
                lEntry.Name           = _ActionAlias;
                lEntry.PositiveButton = "joystick button 8"; // Left stick click
                lEntry.Gravity        = 1;
                lEntry.Dead           = 0.3f;
                lEntry.Sensitivity    = 1;
                lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                lEntry.Axis           = 0;
                lEntry.JoyNum         = 0;

                InputManagerHelper.AddEntry(lEntry, true);
#endif
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// (Internal) Create the Input Manager entry for keys, mouse buttons, and joystick buttons
        ///  Defaults to Gravity = 1000; Dead = 0.001; Sensitivity = 1000
        /// </summary>
        /// <param name="rName">Name of the Input Manager setting (input alias)</param>
        /// <param name="rKey">The primary key</param>
        /// <param name="rAltKey">The alternate key (or mouse button)</param>
        /// <param name="rJoystickButton">(Optional) The joystick button</param>
        private static void CreateInputSetting_Internal(string rName, string rKey, string rAltKey, int rJoystickButton = -1)
        {
            if (InputManagerHelper.IsDefined(rName))
            {
                return;
            }

            // Keyboard and/or mouse button
            InputManagerEntry lEntry = new InputManagerEntry
            {
                Name              = rName,
                PositiveButton    = rKey,
                AltPositiveButton = rAltKey,
                Gravity           = 1000,
                Dead              = 0.001f,
                Sensitivity       = 1000,
                Type              = InputManagerEntryType.KEY_MOUSE_BUTTON,
                Axis              = 0,
                JoyNum            = 0
            };

            InputManagerHelper.AddEntry(lEntry, true);

            // Joystick button
            if (rJoystickButton <= -1)
            {
                return;
            }
            lEntry = new InputManagerEntry
            {
                Name           = rName,
                Gravity        = 1000,
                Dead           = 0.001f,
                Sensitivity    = 1000,
                Type           = InputManagerEntryType.KEY_MOUSE_BUTTON,
                Axis           = 0,
                JoyNum         = 0,
                PositiveButton = "joystick button " + rJoystickButton
            };
            InputManagerHelper.AddEntry(lEntry, true);
        }
Ejemplo n.º 6
0
    /// <summary>
    /// If the input manager entries don't exist, create them
    /// </summary>
    private void CreateInputManagerSettings()
    {
        if (!InputManagerHelper.IsDefined("Combatant Toggle Lock"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "Combatant Toggle Lock";
            lEntry.PositiveButton = "t";
            lEntry.Gravity        = 100;
            lEntry.Dead           = 0.3f;
            lEntry.Sensitivity    = 100;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 1;
            lEntry.JoyNum         = 0;
            InputManagerHelper.AddEntry(lEntry, true);

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
            lEntry                = new InputManagerEntry();
            lEntry.Name           = "Combatant Toggle Lock";
            lEntry.PositiveButton = "joystick button 12";
            lEntry.Gravity        = 100;
            lEntry.Dead           = 0.3f;
            lEntry.Sensitivity    = 100;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 1;
            lEntry.JoyNum         = 0;
            InputManagerHelper.AddEntry(lEntry, true);
#else
            lEntry                = new InputManagerEntry();
            lEntry.Name           = "Combatant Toggle Lock";
            lEntry.PositiveButton = "joystick button 9";
            lEntry.Gravity        = 100;
            lEntry.Dead           = 0.3f;
            lEntry.Sensitivity    = 100;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 1;
            lEntry.JoyNum         = 0;
            InputManagerHelper.AddEntry(lEntry, true);
#endif
        }
    }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a new Input Manager setting for a joystick axis.
        /// Defaults to Gravity = 1; Dead = 0.3; Sensitivity = 1
        /// </summary>
        /// <param name="rName">Name of the Input Manager setting (input alias)</param>
        /// <param name="rAxis">Index of the joystick axis</param>
        /// <param name="rJoystickNum">(optional) Which joystick?</param>
        public static void CreateAxisInputSetting(string rName, int rAxis, int rJoystickNum = 0)
        {
            if (InputManagerHelper.IsDefined(rName))
            {
                return;
            }

            InputManagerEntry lEntry = new InputManagerEntry
            {
                Name              = rName,
                PositiveButton    = string.Empty,
                AltPositiveButton = string.Empty,
                Gravity           = 1,
                Dead              = 0.3f,
                Sensitivity       = 1,
                Type              = InputManagerEntryType.JOYSTICK_AXIS,
                Axis              = rAxis,
                JoyNum            = rJoystickNum
            };

            InputManagerHelper.AddEntry(lEntry, true);
        }
Ejemplo n.º 8
0
        static void MakeUniquePendingInputsToRegister()
        {
            for (int pendingIndex = s_PendingInputsToRegister.Count - 1; pendingIndex > 0; --pendingIndex)
            {
                InputManagerEntry pendingEntry = s_PendingInputsToRegister[pendingIndex];
                int checkedIndex = pendingIndex - 1;
                for (; checkedIndex > -1 && !pendingEntry.IsEqual(s_PendingInputsToRegister[checkedIndex]); --checkedIndex)
                {
                    ;
                }

                if (checkedIndex == -1)
                {
                    continue;
                }

                // There is a duplicate entry in PendingInputesToRegister.
                // Debug.LogWarning($"Two entries with same name and kind are tryed to be added at same time. Only first occurence is kept. Name:{pendingEntry.name} Kind:{pendingEntry.kind}");

                // Keep only first.
                // Counting decreasingly will have no impact on index before pendingIndex. So we can safely remove it.
                s_PendingInputsToRegister.RemoveAt(pendingIndex);
            }
        }
Ejemplo n.º 9
0
    /// <summary>
    /// If the input manager entries don't exist, create them
    /// </summary>
    private void CreateInputManagerEntries()
    {
        if (!InputManagerHelper.IsDefined("WXButton0"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXButton0";
            lEntry.PositiveButton = "joystick button 0";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXButton1"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXButton1";
            lEntry.PositiveButton = "joystick button 1";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXRightStickX"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXRightStickX";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 4;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXRightStickY"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXRightStickY";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Invert      = true;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 5;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXRightStickX"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "MXRightStickX";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 3;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXRightStickY"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "MXRightStickY";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Invert      = true;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 4;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }
    }
Ejemplo n.º 10
0
    /// <summary>
    /// Displays the properties for the advanced tab
    /// </summary>
    /// <returns></returns>
    private bool OnAdvancedInspector()
    {
        bool lIsDirty = false;

        EditorGUILayout.BeginVertical(Box);
        GUILayout.Space(5);

        bool lNewIsInternalUpdateEnabled = EditorGUILayout.Toggle(new GUIContent("Force Update", "Determines if we allow the camera rig to update itself or if something like the Actor Controller will tell the camera when to update."), mTarget.IsInternalUpdateEnabled);

        if (lNewIsInternalUpdateEnabled != mTarget.IsInternalUpdateEnabled)
        {
            mIsDirty = true;
            mTarget.IsInternalUpdateEnabled = lNewIsInternalUpdateEnabled;
        }

        GUILayout.Space(3);
        EditorGUILayout.EndVertical();

        GUILayout.Space(5);

        EditorGUILayout.BeginVertical(Box);
        GUILayout.Space(5);

        float lNewOrbitSmoothing = EditorGUILayout.FloatField(new GUIContent("Rotation Smoothing", "Power of the smoothing function to ease rotations. (0=none, 1=lots)"), mTarget.OrbitSmoothing);

        if (lNewOrbitSmoothing != mTarget.OrbitSmoothing)
        {
            mIsDirty = true;
            mTarget.OrbitSmoothing = lNewOrbitSmoothing;
        }

        GUILayout.Space(5);

        float lNewMinDistance = EditorGUILayout.FloatField(new GUIContent("Min Distance", "Minimum distance the camera can get to the anchor."), mTarget.MinDistance);

        if (lNewMinDistance != mTarget.MinDistance)
        {
            mIsDirty            = true;
            mTarget.MinDistance = lNewMinDistance;
        }

        float lNewMaxDistance = EditorGUILayout.FloatField(new GUIContent("Max Distance", "Maximum distance the camera can get from the anchor."), mTarget.MaxDistance);

        if (lNewMaxDistance != mTarget.MaxDistance)
        {
            mIsDirty            = true;
            mTarget.MaxDistance = lNewMaxDistance;
        }

        GUILayout.Space(5);

        float lNewMinPitch = EditorGUILayout.FloatField(new GUIContent("Min Pitch", "Minimum pitch the camera can get to. Pitch values are from -87 to 87 to prevent flipping."), mTarget.MinPitch);

        if (lNewMinPitch != mTarget.MinPitch)
        {
            mIsDirty         = true;
            mTarget.MinPitch = lNewMinPitch;
        }

        float lNewMaxPitch = EditorGUILayout.FloatField(new GUIContent("Max Pitch", "Maximum pitch the camera can get to. Pitch values are from -87 to 87 to prevent flipping."), mTarget.MaxPitch);

        if (lNewMaxPitch != mTarget.MaxPitch)
        {
            mIsDirty         = true;
            mTarget.MaxPitch = lNewMaxPitch;
        }

        GUILayout.Space(3);
        EditorGUILayout.EndVertical();

        GUILayout.Space(5);

        EditorGUILayout.BeginVertical(Box);
        GUILayout.Space(5);

        Transform lNewAnchor = EditorGUILayout.ObjectField(new GUIContent("Anchor", "Transform the camera is meant to follow."), mTarget.Anchor, typeof(Transform), true) as Transform;

        if (lNewAnchor != mTarget.Anchor)
        {
            lIsDirty       = true;
            mTarget.Anchor = lNewAnchor;
        }

        Vector3 lNewAnchorOffset = EditorGUILayout.Vector3Field(new GUIContent("Anchor Offset", "Offset from the transform that represents the true anchor."), mTarget.AnchorOffset);

        if (lNewAnchorOffset != mTarget.AnchorOffset)
        {
            lIsDirty             = true;
            mTarget.AnchorOffset = lNewAnchorOffset;
        }

        float lNewAnchorDistance = EditorGUILayout.FloatField(new GUIContent("Anchor Distance", "Orbit distance from the anchor."), mTarget.AnchorDistance);

        if (lNewAnchorDistance != mTarget.AnchorDistance)
        {
            lIsDirty = true;
            mTarget.AnchorDistance = lNewAnchorDistance;
        }

        bool lNewAnchorOrbitsCamera = EditorGUILayout.Toggle(new GUIContent("Anchor Orbits Camera", "Determines if the player walks around the camera."), mTarget.AnchorOrbitsCamera);

        if (lNewAnchorOrbitsCamera != mTarget.AnchorOrbitsCamera)
        {
            mIsDirty = true;
            mTarget.AnchorOrbitsCamera = lNewAnchorOrbitsCamera;
        }

        float lNewAnchorTime = EditorGUILayout.FloatField(new GUIContent("Transition Time", "Time (in seconds) to transition to this mode."), mTarget.AnchorTime);

        if (lNewAnchorTime != mTarget.AnchorTime)
        {
            mIsDirty           = true;
            mTarget.AnchorTime = lNewAnchorTime;
        }

        float lNewYawSpeed = EditorGUILayout.FloatField(new GUIContent("Yaw Speed", "Degrees per second the camera orbits the anchor."), mTarget.YawSpeed);

        if (lNewYawSpeed != mTarget.YawSpeed)
        {
            mIsDirty         = true;
            mTarget.YawSpeed = lNewYawSpeed;
        }

        float lNewPitchSpeed = EditorGUILayout.FloatField(new GUIContent("Pitch Speed", "Degrees per second the camera orbits the anchor."), mTarget.PitchSpeed);

        if (lNewPitchSpeed != mTarget.PitchSpeed)
        {
            mIsDirty           = true;
            mTarget.PitchSpeed = lNewPitchSpeed;
        }

        GUILayout.Space(3);
        EditorGUILayout.EndVertical();

        GUILayout.Space(5);

        EditorGUILayout.BeginVertical(Box);
        EditorHelper.DrawSmallTitle("Targeting Mode Properties");

        bool lNewIsAltModeEnabled = EditorGUILayout.Toggle(new GUIContent("Is Targeting Enabled", "Determines if the player can use the alternate targeting mode."), mTarget.IsAltModeEnabled);

        if (lNewIsAltModeEnabled != mTarget.IsAltModeEnabled)
        {
            mIsDirty = true;
            mTarget.IsAltModeEnabled = lNewIsAltModeEnabled;
        }

        string lNewAltActionAlias = EditorGUILayout.TextField(new GUIContent("Targeting Alias", "Input used to activate the alternate targeting mode."), mTarget.AltActionAlias);

        if (lNewAltActionAlias != mTarget.AltActionAlias)
        {
            mIsDirty = true;
            mTarget.AltActionAlias = lNewAltActionAlias;
        }

        bool lNewAltActionAliasAsToggle = EditorGUILayout.Toggle(new GUIContent("Targeting As Toggle", "Determines if the alias works as a toggle or needs to be held for the alternate targeting mode"), mTarget.AltActionAliasAsToggle);

        if (lNewAltActionAliasAsToggle != mTarget.AltActionAliasAsToggle)
        {
            mIsDirty = true;
            mTarget.AltActionAliasAsToggle = lNewAltActionAliasAsToggle;
        }

        Vector3 lNewAltAnchorOffset = EditorGUILayout.Vector3Field(new GUIContent("Targeting Anchor Offset", "Position of the camera relative to the anchor."), mTarget.AltAnchorOffset);

        if (lNewAltAnchorOffset != mTarget.AltAnchorOffset)
        {
            mIsDirty = true;
            mTarget.AltAnchorOffset = lNewAltAnchorOffset;
        }

        float lNewAltAnchorDistance = EditorGUILayout.FloatField(new GUIContent("Targeting Anchor Distance", "Distance from the anchor."), mTarget.AltAnchorDistance);

        if (lNewAltAnchorDistance != mTarget.AltAnchorDistance)
        {
            mIsDirty = true;
            mTarget.AltAnchorDistance = lNewAltAnchorDistance;
        }

        float lNewAltPitchSpeed = EditorGUILayout.FloatField(new GUIContent("Pitch Speed", "Degrees per second the view pitches while targeting."), mTarget.AltPitchSpeed);

        if (lNewAltPitchSpeed != mTarget.AltPitchSpeed)
        {
            mIsDirty = true;
            mTarget.AltPitchSpeed = lNewAltPitchSpeed;
        }

        float lNewAltAnchorTime = EditorGUILayout.FloatField(new GUIContent("Transition Time", "Time (in seconds) to transition to this mode."), mTarget.AltAnchorTime);

        if (lNewAltAnchorTime != mTarget.AltAnchorTime)
        {
            mIsDirty = true;
            mTarget.AltAnchorTime = lNewAltAnchorTime;
        }

        bool lNewAltForceActorToView = EditorGUILayout.Toggle(new GUIContent("Start Actor at View", "Determines if we rotate the actor to look at our current view when targeting starts."), mTarget.AltForceActorToView);

        if (lNewAltForceActorToView != mTarget.AltForceActorToView)
        {
            mIsDirty = true;
            mTarget.AltForceActorToView = lNewAltForceActorToView;
        }

        GUILayout.Space(3);
        EditorGUILayout.EndVertical();

        GUILayout.Space(5);

        EditorGUILayout.BeginVertical(Box);
        EditorHelper.DrawSmallTitle("Collision Properties");

        if ((mTarget.IsCollisionsEnabled && mTarget.IsObstructionsEnabled) || (mTarget.IsAltCollisionsEnabled && mTarget.IsAltObstructionsEnabled))
        {
            EditorGUILayout.HelpBox("Having both collisions and line-of-sight testing enabled could cause some popping.", MessageType.Warning);
        }

        bool lNewTestCollisions = EditorGUILayout.Toggle(new GUIContent("Is Collision Enabled", "Deterines if we can collide with obstacles in the normal mode."), mTarget.IsCollisionsEnabled);

        if (lNewTestCollisions != mTarget.IsCollisionsEnabled)
        {
            mIsDirty = true;
            mTarget.IsCollisionsEnabled = lNewTestCollisions;
        }

        bool lNewAltTestCollisions = EditorGUILayout.Toggle(new GUIContent("Is Targeting Collision Enabled", "Determines if we can collide with obstacles in the targeting mode."), mTarget.IsAltCollisionsEnabled);

        if (lNewAltTestCollisions != mTarget.IsAltCollisionsEnabled)
        {
            mIsDirty = true;
            mTarget.IsAltCollisionsEnabled = lNewAltTestCollisions;
        }

        bool lNewAutoCollisionRadius = EditorGUILayout.Toggle(new GUIContent("Auto Collision Radius", "Automatically sets the collider radius to cover the camera's near plane."), mTarget.AutoCollisionRadius);

        if (lNewAutoCollisionRadius != mTarget.AutoCollisionRadius)
        {
            mIsDirty = true;
            mTarget.AutoCollisionRadius = lNewAutoCollisionRadius;
        }

        if (lNewAutoCollisionRadius)
        {
            float lNewAutoCollisionRadiusFactor = EditorGUILayout.FloatField(new GUIContent("Auto Radius Factor", "Multiplier to use when automatically setting the collider radius."), mTarget.AutoCollisionRadiusFactor);
            if (lNewAutoCollisionRadiusFactor != mTarget.AutoCollisionRadiusFactor)
            {
                mIsDirty = true;
                mTarget.AutoCollisionRadiusFactor = lNewAutoCollisionRadiusFactor;
            }
        }
        else
        {
            float lNewCollisionRadius = EditorGUILayout.FloatField(new GUIContent("Collision Radius", "Radius of the collider used by the camera."), mTarget.CollisionRadius);
            if (lNewCollisionRadius != mTarget.CollisionRadius)
            {
                mIsDirty = true;
                mTarget.CollisionRadius = lNewCollisionRadius;
            }
        }

        GUILayout.Space(5);

        bool lNewTestObstructions = EditorGUILayout.Toggle(new GUIContent("Is LOS Enabled", "Deterines if we use line-of-sight test for objects blocing the view in the normal mode."), mTarget.IsObstructionsEnabled);

        if (lNewTestObstructions != mTarget.IsObstructionsEnabled)
        {
            mIsDirty = true;
            mTarget.IsObstructionsEnabled = lNewTestObstructions;
        }

        bool lNewAltTestObstructions = EditorGUILayout.Toggle(new GUIContent("Is Targeting LOS Enabled", "Determines if we test for objects blocking the view in the targeting mode."), mTarget.IsAltObstructionsEnabled);

        if (lNewAltTestObstructions != mTarget.IsAltObstructionsEnabled)
        {
            mIsDirty = true;
            mTarget.IsAltObstructionsEnabled = lNewAltTestObstructions;
        }

        bool lNewAutoObstructionRadius = EditorGUILayout.Toggle(new GUIContent("Auto LOS Radius", "Automatically sets the obstruction radius to cover the camera's near plane."), mTarget.AutoObstructionRadius);

        if (lNewAutoObstructionRadius != mTarget.AutoObstructionRadius)
        {
            mIsDirty = true;
            mTarget.AutoObstructionRadius = lNewAutoObstructionRadius;
        }

        if (lNewAutoObstructionRadius)
        {
            float lNewAutoCollisionRadiusFactor = EditorGUILayout.FloatField(new GUIContent("Auto Radius Factor", "Multiplier to use when automatically setting the obstruction radius."), mTarget.AutoCollisionRadiusFactor);
            if (lNewAutoCollisionRadiusFactor != mTarget.AutoCollisionRadiusFactor)
            {
                mIsDirty = true;
                mTarget.AutoCollisionRadiusFactor = lNewAutoCollisionRadiusFactor;
            }
        }
        else
        {
            float lNewObstructionRadius = EditorGUILayout.FloatField(new GUIContent("LOS Radius", "Radius of the collider used by the camera."), mTarget.ObstructionRadius);
            if (lNewObstructionRadius != mTarget.ObstructionRadius)
            {
                mIsDirty = true;
                mTarget.ObstructionRadius = lNewObstructionRadius;
            }
        }

        float lNewRecoveryDelay = EditorGUILayout.FloatField(new GUIContent("LOS Recovery Delay", "After a collision, the number of seconds before we head back to our desired distance."), mTarget.RecoveryDelay);

        if (lNewRecoveryDelay != mTarget.RecoveryDelay)
        {
            mIsDirty = true;
            mTarget.RecoveryDelay = lNewRecoveryDelay;
        }

        GUILayout.Space(5);

        int lNewCollisionLayers = EditorHelper.LayerMaskField(new GUIContent("Collision Layers", "Layers that identies objects the camera will collide with."), mTarget.CollisionLayers);

        if (lNewCollisionLayers != mTarget.CollisionLayers)
        {
            mIsDirty = true;
            mTarget.CollisionLayers = lNewCollisionLayers;
        }

        GUILayout.Space(3);
        EditorGUILayout.EndVertical();

        GUILayout.Space(5);

        EditorGUILayout.BeginVertical(Box);
        EditorHelper.DrawSmallTitle("Fade Properties");

        if ((mTarget.IsFadeEnabed))
        {
            EditorGUILayout.HelpBox("True fading requires character shaders to use transparency." + (mTarget.DisableRenderers ? "" : "Disabling renderers works with opaque or transparent shaders."), MessageType.Warning);
        }

        bool lNewIsFadeEnabled = EditorGUILayout.Toggle(new GUIContent("Is Fade Enabled", "Determines if we fade the anchor when the camera is too close. This requires the anchor shaders to use transparencies."), mTarget.IsFadeEnabed);

        if (lNewIsFadeEnabled != mTarget.IsFadeEnabed)
        {
            mIsDirty             = true;
            mTarget.IsFadeEnabed = lNewIsFadeEnabled;
        }

        float lNewFadeDistance = EditorGUILayout.FloatField(new GUIContent("Fade Distance", "Distance between the anchor and camera where we start fading out."), mTarget.FadeDistance);

        if (lNewFadeDistance != mTarget.FadeDistance)
        {
            mIsDirty             = true;
            mTarget.FadeDistance = lNewFadeDistance;
        }

        float lNewFadeSpeed = EditorGUILayout.FloatField(new GUIContent("Fade Speed", "Time (in seconds) to fade the anchor in and out."), mTarget.FadeSpeed);

        if (lNewFadeSpeed != mTarget.FadeSpeed)
        {
            mIsDirty          = true;
            mTarget.FadeSpeed = lNewFadeSpeed;
        }

        bool lNewDisableRenderers = EditorGUILayout.Toggle(new GUIContent("Disable Renderers", "Determines if the anchor's renderers are disabled when fading is complete. This works for non-transparent shaders too."), mTarget.DisableRenderers);

        if (lNewDisableRenderers != mTarget.DisableRenderers)
        {
            mIsDirty = true;
            mTarget.DisableRenderers = lNewDisableRenderers;
        }

        GUILayout.Space(3);
        EditorGUILayout.EndVertical();

        GUILayout.Space(5);

        EditorGUILayout.BeginVertical(Box);
        EditorHelper.DrawSmallTitle("Zoom Properties");

        bool lNewIsFieldOfViewEnabled = EditorGUILayout.Toggle(new GUIContent("Is FOV Enabled", "Determines if we allow changing the field-of-view while in normal mode."), mTarget.IsFieldOfViewEnabled);

        if (lNewIsFieldOfViewEnabled != mTarget.IsFieldOfViewEnabled)
        {
            mIsDirty = true;
            mTarget.IsFieldOfViewEnabled = lNewIsFieldOfViewEnabled;
        }

        bool lNewIsAltFieldOfViewEnabled = EditorGUILayout.Toggle(new GUIContent("Is Targeting FOV Enabled", "Determines if we allow changing the field-of-view while in targeting mode."), mTarget.IsAltFieldOfViewEnabled);

        if (lNewIsAltFieldOfViewEnabled != mTarget.IsAltFieldOfViewEnabled)
        {
            mIsDirty = true;
            mTarget.IsAltFieldOfViewEnabled = lNewIsAltFieldOfViewEnabled;
        }

        string lNewFieldOfViewActionAlias = EditorGUILayout.TextField(new GUIContent("FOV Action Alias", "Input alias used to get the field-of-view delta each frame."), mTarget.FieldOfViewActionAlias);

        if (lNewFieldOfViewActionAlias != mTarget.FieldOfViewActionAlias)
        {
            mIsDirty = true;
            mTarget.FieldOfViewActionAlias = lNewFieldOfViewActionAlias;
        }

        if (lNewFieldOfViewActionAlias == "Camera FOV")
        {
            if (!InputManagerHelper.IsDefined("Camera FOV"))
            {
                InputManagerEntry lEntry = new InputManagerEntry();
                lEntry.Name        = "Camera FOV";
                lEntry.Gravity     = 0f;
                lEntry.Dead        = 0f;
                lEntry.Sensitivity = 0.1f;
                lEntry.Type        = InputManagerEntryType.MOUSE_MOVEMENT;
                lEntry.Axis        = 3;
                lEntry.JoyNum      = 0;
                InputManagerHelper.AddEntry(lEntry);

                lEntry             = new InputManagerEntry();
                lEntry.Name        = "Camera FOV";
                lEntry.Gravity     = 1f;
                lEntry.Dead        = 0.3f;
                lEntry.Sensitivity = 1f;
                lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                lEntry.Axis = 6;
#else
                lEntry.Axis = 10;
#endif
                lEntry.JoyNum = 0;
                InputManagerHelper.AddEntry(lEntry, true);
            }
        }

        float lNewMinFieldOfView = EditorGUILayout.FloatField(new GUIContent("Min FOV", "Minimum field of view (tightest zoom) allowed."), mTarget.MinFieldOfView);
        if (lNewMinFieldOfView != mTarget.MinFieldOfView)
        {
            mIsDirty = true;
            mTarget.MinFieldOfView = lNewMinFieldOfView;
        }

        float lNewFieldOfViewSpeed = EditorGUILayout.FloatField(new GUIContent("FOV Speed", "Speed (in seconds) at which we change the field-of-view."), mTarget.FieldOfViewSpeed);
        if (lNewFieldOfViewSpeed != mTarget.FieldOfViewSpeed)
        {
            mIsDirty = true;
            mTarget.FieldOfViewSpeed = lNewFieldOfViewSpeed;
        }

        float lNewFieldOfViewSmoothing = EditorGUILayout.FloatField(new GUIContent("FOV Smoothing", "Smoothing applied to field-of-view changes. (0=none, 1=lots)"), mTarget.FieldOfViewSmoothing);
        if (lNewFieldOfViewSmoothing != mTarget.FieldOfViewSmoothing)
        {
            mIsDirty = true;
            mTarget.FieldOfViewSmoothing = lNewFieldOfViewSmoothing;
        }

        GUILayout.Space(3);
        EditorGUILayout.EndVertical();

        GUILayout.Space(5);

        EditorGUILayout.BeginVertical(Box);
        EditorHelper.DrawSmallTitle("Camera Shake Properties");

        // Determine how gravity is applied
        AnimationCurve lNewShakeStrength = EditorGUILayout.CurveField(new GUIContent("Shake Strength", "Determines how strong the shake is over the duration. (0 = none, 1 = 100%)"), mTarget.ShakeStrength);
        if (lNewShakeStrength != mTarget.ShakeStrength)
        {
            mIsDirty = true;
            mTarget.ShakeStrength = lNewShakeStrength;
        }

        GUILayout.Space(3);
        EditorGUILayout.EndVertical();

        GUILayout.Space(5);

        //float lNewDistanceEnd = EditorGUILayout.FloatField(new GUIContent("Distance End", ""), mTarget.mDistanceEnd);
        //if (lNewDistanceEnd != mTarget.mDistanceEnd)
        //{
        //    mIsDirty = true;
        //    mTarget.mDistanceEnd = lNewDistanceEnd;
        //}

        //float lNewLocalYaw = EditorGUILayout.FloatField(new GUIContent("Local Yaw", ""), mTarget.LocalYaw);
        //if (lNewLocalYaw != mTarget.LocalYaw)
        //{
        //    mIsDirty = true;
        //    mTarget.LocalYaw = lNewLocalYaw;
        //}

        //float lNewLocalPitch = EditorGUILayout.FloatField(new GUIContent("Local Pitch", ""), mTarget.LocalPitch);
        //if (lNewLocalPitch != mTarget.LocalPitch)
        //{
        //    mIsDirty = true;
        //    mTarget.LocalPitch = lNewLocalPitch;
        //}

        return(lIsDirty);
    }
Ejemplo n.º 11
0
        /// <summary>
        /// Draws the inspector for the pack
        /// </summary>
        /// <returns></returns>
        public static bool OnPackInspector(MotionController rMotionController)
        {
            EditorHelper.DrawSmallTitle(GroupName());
            EditorHelper.DrawLink("Mixamo Pro Magic Pack Animations", "http://www.ootii.com/Unity/MotionPacks/SpellCasting/SpellCastingUsersGuide.pdf");

            GUILayout.Space(5f);

            EditorGUILayout.LabelField("See included documentation:", EditorHelper.SmallBoldLabel);
            EditorGUILayout.LabelField("1. Download and import animations.", EditorHelper.SmallLabel);
            EditorGUILayout.LabelField("2. Unzip and replace animation meta files.", EditorHelper.SmallLabel);
            EditorGUILayout.LabelField("3. Select options and create motions.", EditorHelper.SmallLabel);

            EditorHelper.DrawLine();

            EditorHelper.BoolField("Create Mecanim States", "Determines if we create/override the existing sub-state machine", sCreateSubStateMachines);
            sCreateSubStateMachines = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Input Aliases", "Determines if we create input aliases", sCreateInputAliases);
            sCreateInputAliases = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Inventory", "Determines if we create/override the existing inventory", sCreateInventory);
            sCreateInventory = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Attributes", "Determines if we create/override the existing attributes", sCreateAttributes);
            sCreateAttributes = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Spell Inventory", "Create the spell inventory for the caster", sCreateSpellInventory);
            sCreateSpellInventory = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Combatant", "Determines if we create/override the existing core", sCreateCore);
            sCreateCore = EditorHelper.FieldBoolValue;

            EditorHelper.BoolField("Create Motions", "Determines if we create the archery motions", sCreateMotions);
            sCreateMotions = EditorHelper.FieldBoolValue;

            GUILayout.Space(5f);

            if (GUILayout.Button(new GUIContent("Setup Pack", "Create and setup the motion pack."), EditorStyles.miniButton))
            {
                if (sCreateInventory)
                {
                    BasicInventory lInventory = rMotionController.gameObject.GetComponent <BasicInventory>();
                    if (lInventory == null)
                    {
                        lInventory = rMotionController.gameObject.AddComponent <BasicInventory>();
                    }

                    BasicInventoryItem lItem = lInventory.GetInventoryItem("Spell_01");
                    if (lItem != null)
                    {
                        lInventory.Items.Remove(lItem);
                    }

                    lInventory.Items.Add(new BasicInventoryItem());
                    lInventory.Items[lInventory.Items.Count - 1].ID          = "Spell_01";
                    lInventory.Items[lInventory.Items.Count - 1].EquipMotion = "PMP_EquipSpell";
                    lInventory.Items[lInventory.Items.Count - 1].StoreMotion = "PMP_StoreSpell";

                    BasicInventorySlot lSlot = lInventory.GetInventorySlot("RIGHT_HAND");
                    if (lSlot == null)
                    {
                        lInventory.Slots.Add(new BasicInventorySlot());
                        lInventory.Slots[lInventory.Slots.Count - 1].ID     = "RIGHT_HAND";
                        lInventory.Slots[lInventory.Slots.Count - 1].ItemID = "";
                    }

                    if (lInventory.GetInventorySlot("LEFT_HAND") == null)
                    {
                        lInventory.Slots.Add(new BasicInventorySlot());
                        lInventory.Slots[lInventory.Slots.Count - 1].ID     = "LEFT_HAND";
                        lInventory.Slots[lInventory.Slots.Count - 1].ItemID = "";
                    }

                    lSlot = lInventory.GetInventorySlot("LEFT_LOWER_ARM");
                    if (lSlot == null)
                    {
                        lInventory.Slots.Add(new BasicInventorySlot());
                        lInventory.Slots[lInventory.Slots.Count - 1].ID     = "LEFT_LOWER_ARM";
                        lInventory.Slots[lInventory.Slots.Count - 1].ItemID = "";
                    }

                    if (lInventory.GetInventorySlot("READY_PROJECTILE") == null)
                    {
                        lInventory.Slots.Add(new BasicInventorySlot());
                        lInventory.Slots[lInventory.Slots.Count - 1].ID     = "READY_PROJECTILE";
                        lInventory.Slots[lInventory.Slots.Count - 1].ItemID = "";
                    }

                    BasicInventorySet lWeaponSet = lInventory.GetWeaponSet("Spell Casting");
                    if (lWeaponSet != null)
                    {
                        lInventory.WeaponSets.Remove(lWeaponSet);
                    }

                    lWeaponSet    = new BasicInventorySet();
                    lWeaponSet.ID = "Spell Casting";

                    BasicInventorySetItem lWeaponSetItem = new BasicInventorySetItem();
                    lWeaponSetItem.ItemID      = "";
                    lWeaponSetItem.SlotID      = "LEFT_HAND";
                    lWeaponSetItem.Instantiate = true;
                    lWeaponSet.Items.Add(lWeaponSetItem);

                    lWeaponSetItem             = new BasicInventorySetItem();
                    lWeaponSetItem.ItemID      = "";
                    lWeaponSetItem.SlotID      = "READY_PROJECTILE";
                    lWeaponSetItem.Instantiate = false;
                    lWeaponSet.Items.Add(lWeaponSetItem);

                    lWeaponSetItem             = new BasicInventorySetItem();
                    lWeaponSetItem.ItemID      = "Spell_01";
                    lWeaponSetItem.SlotID      = "RIGHT_HAND";
                    lWeaponSetItem.Instantiate = false;
                    lWeaponSet.Items.Add(lWeaponSetItem);

                    lWeaponSetItem             = new BasicInventorySetItem();
                    lWeaponSetItem.ItemID      = "";
                    lWeaponSetItem.SlotID      = "LEFT_LOWER_ARM";
                    lWeaponSetItem.Instantiate = false;
                    lWeaponSet.Items.Add(lWeaponSetItem);

                    if (lInventory.WeaponSets.Count == 0)
                    {
                        BasicInventorySet lFirstWeaponSet = new BasicInventorySet();
                        lFirstWeaponSet.ID = "Sword and Shield";

                        lInventory.WeaponSets.Add(lFirstWeaponSet);
                    }

                    if (lInventory.WeaponSets.Count == 1)
                    {
                        BasicInventorySet lSecondWeaponSet = new BasicInventorySet();
                        lSecondWeaponSet.ID = "Longbow";

                        lInventory.WeaponSets.Add(lSecondWeaponSet);
                    }

                    lInventory.WeaponSets.Insert(2, lWeaponSet);
                }

                if (sCreateAttributes)
                {
                    BasicAttributes lAttributes = rMotionController.gameObject.GetComponent <BasicAttributes>();
                    if (lAttributes == null)
                    {
                        lAttributes = rMotionController.gameObject.AddComponent <BasicAttributes>();
                    }

                    BasicAttribute lAttribute = lAttributes.GetAttribute("Health");
                    if (lAttribute != null)
                    {
                        lAttributes.Items.Remove(lAttribute);
                    }

                    lAttributes.Items.Add(new BasicAttribute());
                    lAttributes.Items[lAttributes.Items.Count - 1].ID = "Health";
                    lAttributes.Items[lAttributes.Items.Count - 1].SetValue <float>(100f);
                }

                if (sCreateSpellInventory)
                {
                    SpellInventory lAttributes = rMotionController.gameObject.GetComponent <SpellInventory>();
                    if (lAttributes == null)
                    {
                        lAttributes = rMotionController.gameObject.AddComponent <SpellInventory>();
                    }
                }

                if (sCreateCore)
                {
                    Combatant lCombatant = rMotionController.gameObject.GetComponent <Combatant>();
                    if (lCombatant == null)
                    {
                        lCombatant = rMotionController.gameObject.AddComponent <Combatant>();
                    }

                    if (rMotionController._ActorController == null || !rMotionController._ActorController.UseTransformPosition)
                    {
                        lCombatant.IsLockingEnabled = true;
                        lCombatant.TargetLockedIcon = AssetDatabase.LoadAssetAtPath <Texture>("Assets/ootii/Framework_v1/Content/Textures/UI/TargetIcon_2.png");
                    }

                    ActorCore lCore = rMotionController.gameObject.GetComponent <ActorCore>();
                    if (lCore == null)
                    {
                        lCore = rMotionController.gameObject.AddComponent <ActorCore>();
                    }

                    lCore.IsAlive = true;
                }

                if (sCreateInputAliases)
                {
                    // Sheathe
                    if (!InputManagerHelper.IsDefined("Spell Casting Equip"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name           = "Spell Casting Equip";
                        lEntry.PositiveButton = "3"; // "3" key
                        lEntry.Gravity        = 1000;
                        lEntry.Dead           = 0.001f;
                        lEntry.Sensitivity    = 1000;
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis           = 0;
                        lEntry.JoyNum         = 0;
                        InputManagerHelper.AddEntry(lEntry, true);

                        lEntry             = new InputManagerEntry();
                        lEntry.Name        = "Spell Casting Equip";
                        lEntry.Gravity     = 1000;
                        lEntry.Dead        = 0.001f;
                        lEntry.Sensitivity = 1000;
                        lEntry.JoyNum      = 0;

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                        lEntry.PositiveButton = "joystick button 8";
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON; // D-pad Y
                        lEntry.Axis           = 0;
#else
                        lEntry.PositiveButton = "";
                        lEntry.Type           = InputManagerEntryType.JOYSTICK_AXIS; // D-pad Y
                        lEntry.Axis           = 7;
#endif

                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Fire
                    if (!InputManagerHelper.IsDefined("Spell Casting Cast"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name              = "Spell Casting Cast";
                        lEntry.PositiveButton    = "left ctrl";
                        lEntry.AltPositiveButton = "mouse 0"; // Left mouse button
                        lEntry.Gravity           = 1000;
                        lEntry.Dead              = 0.001f;
                        lEntry.Sensitivity       = 1000;
                        lEntry.Type              = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis              = 0;
                        lEntry.JoyNum            = 0;
                        InputManagerHelper.AddEntry(lEntry, true);

                        lEntry      = new InputManagerEntry();
                        lEntry.Name = "Spell Casting Cast";

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                        lEntry.PositiveButton = "joystick button 16"; // Green A
#else
                        lEntry.PositiveButton = "joystick button 0";  // Green A
#endif

                        lEntry.Gravity     = 1000;
                        lEntry.Dead        = 0.001f;
                        lEntry.Sensitivity = 1000;
                        lEntry.Type        = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis        = 0;
                        lEntry.JoyNum      = 0;
                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Continue
                    if (!InputManagerHelper.IsDefined("Spell Casting Continue"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name              = "Spell Casting Continue";
                        lEntry.PositiveButton    = "left ctrl";
                        lEntry.AltPositiveButton = "mouse 0"; // Left mouse button
                        lEntry.Gravity           = 1000;
                        lEntry.Dead              = 0.001f;
                        lEntry.Sensitivity       = 1000;
                        lEntry.Type              = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis              = 0;
                        lEntry.JoyNum            = 0;
                        InputManagerHelper.AddEntry(lEntry, true);

                        lEntry      = new InputManagerEntry();
                        lEntry.Name = "Spell Casting Continue";

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                        lEntry.PositiveButton = "joystick button 16"; // Green A
#else
                        lEntry.PositiveButton = "joystick button 0";  // Green A
#endif

                        lEntry.Gravity     = 1000;
                        lEntry.Dead        = 0.001f;
                        lEntry.Sensitivity = 1000;
                        lEntry.Type        = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis        = 0;
                        lEntry.JoyNum      = 0;
                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Cancel
                    if (!InputManagerHelper.IsDefined("Spell Casting Cancel"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name           = "Spell Casting Cancel";
                        lEntry.PositiveButton = "escape";
                        lEntry.Gravity        = 1000;
                        lEntry.Dead           = 0.001f;
                        lEntry.Sensitivity    = 1000;
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis           = 0;
                        lEntry.JoyNum         = 0;
                        InputManagerHelper.AddEntry(lEntry, true);

                        lEntry      = new InputManagerEntry();
                        lEntry.Name = "Spell Casting Cancel";

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                        lEntry.PositiveButton = "joystick button 19"; // Yellow Y
#else
                        lEntry.PositiveButton = "joystick button 3";  // Yellow Y
#endif

                        lEntry.Gravity     = 1000;
                        lEntry.Dead        = 0.001f;
                        lEntry.Sensitivity = 1000;
                        lEntry.Type        = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis        = 0;
                        lEntry.JoyNum      = 0;
                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Move Up
                    if (!InputManagerHelper.IsDefined("Move Up"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name           = "Move Up";
                        lEntry.PositiveButton = "e";
                        lEntry.Gravity        = 1000;
                        lEntry.Dead           = 0.001f;
                        lEntry.Sensitivity    = 1000;
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis           = 0;
                        lEntry.JoyNum         = 0;

                        InputManagerHelper.AddEntry(lEntry, true);
                    }

                    // Move down
                    if (!InputManagerHelper.IsDefined("Move Down"))
                    {
                        InputManagerEntry lEntry = new InputManagerEntry();
                        lEntry.Name           = "Move Down";
                        lEntry.PositiveButton = "q";
                        lEntry.Gravity        = 1000;
                        lEntry.Dead           = 0.001f;
                        lEntry.Sensitivity    = 1000;
                        lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
                        lEntry.Axis           = 0;
                        lEntry.JoyNum         = 0;

                        InputManagerHelper.AddEntry(lEntry, true);
                    }
                }

                if (sCreateMotions || sCreateSubStateMachines)
                {
                    IBaseCameraRig lCameraRig = rMotionController.CameraRig;
                    if (lCameraRig == null)
                    {
                        lCameraRig = rMotionController.ExtractCameraRig(rMotionController.CameraTransform);
                    }

                    if (rMotionController.MotionLayers.Count == 0)
                    {
                        MotionControllerLayer lMotionLayer = new MotionControllerLayer();
                        rMotionController.MotionLayers.Add(lMotionLayer);
                    }

                    PMP_Idle lIdle = rMotionController.GetMotion <PMP_Idle>();
                    if (lIdle == null)
                    {
                        lIdle = rMotionController.CreateMotion <PMP_Idle>(0);
                    }

                    PMP_EquipSpell lEquip = rMotionController.GetMotion <PMP_EquipSpell>(0);
                    if (lEquip == null)
                    {
                        lEquip = rMotionController.CreateMotion <PMP_EquipSpell>(0);
                    }

                    PMP_StoreSpell lStore = rMotionController.GetMotion <PMP_StoreSpell>(0);
                    if (lStore == null)
                    {
                        lStore = rMotionController.CreateMotion <PMP_StoreSpell>(0);
                    }

                    PMP_WalkRunPivot lPivot = rMotionController.GetMotion <PMP_WalkRunPivot>(0);
                    if (lPivot == null)
                    {
                        lPivot = rMotionController.CreateMotion <PMP_WalkRunPivot>(0);
                    }

                    PMP_WalkRunStrafe lStrafe = rMotionController.GetMotion <PMP_WalkRunStrafe>(0);
                    if (lStrafe == null)
                    {
                        lStrafe = rMotionController.CreateMotion <PMP_WalkRunStrafe>(0);
                    }

                    PMP_BasicSpellCastings lCast = rMotionController.GetMotion <PMP_BasicSpellCastings>(0);
                    if (lCast == null)
                    {
                        lCast = rMotionController.CreateMotion <PMP_BasicSpellCastings>(0);
                    }

                    Cower lCower = rMotionController.GetMotion <Cower>(0);
                    if (lCower == null)
                    {
                        lCower = rMotionController.CreateMotion <Cower>(0);
                    }

                    Death lDeath = rMotionController.GetMotion <Death>(0);
                    if (lDeath == null)
                    {
                        lDeath = rMotionController.CreateMotion <Death>(0);
                    }

                    Damaged lDamaged = rMotionController.GetMotion <Damaged>(0);
                    if (lDamaged == null)
                    {
                        lDamaged = rMotionController.CreateMotion <Damaged>(0);
                    }

                    Frozen lFrozen = rMotionController.GetMotion <Frozen>(0);
                    if (lFrozen == null)
                    {
                        lFrozen = rMotionController.CreateMotion <Frozen>(0);
                    }

                    KnockedDown lKnockedDown = rMotionController.GetMotion <KnockedDown>(0);
                    if (lKnockedDown == null)
                    {
                        lKnockedDown = rMotionController.CreateMotion <KnockedDown>(0);
                    }

                    Levitate lLevitate = rMotionController.GetMotion <Levitate>(0);
                    if (lLevitate == null)
                    {
                        lLevitate = rMotionController.CreateMotion <Levitate>(0);
                    }

                    PushedBack lPushedBack = rMotionController.GetMotion <PushedBack>(0);
                    if (lPushedBack == null)
                    {
                        lPushedBack = rMotionController.CreateMotion <PushedBack>(0);
                    }

                    Sleep lSleep = rMotionController.GetMotion <Sleep>(0);
                    if (lSleep == null)
                    {
                        lSleep = rMotionController.CreateMotion <Sleep>(0);
                    }

                    Stunned lStunned = rMotionController.GetMotion <Stunned>(0);
                    if (lStunned == null)
                    {
                        lStunned = rMotionController.CreateMotion <Stunned>(0);
                    }

                    if (sCreateSubStateMachines)
                    {
                        Animator lAnimator = rMotionController.Animator;
                        if (lAnimator == null)
                        {
                            lAnimator = rMotionController.gameObject.GetComponent <Animator>();
                        }

                        if (lAnimator != null)
                        {
                            UnityEditor.Animations.AnimatorController lAnimatorController = lAnimator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController;

                            lIdle.CreateStateMachine(lAnimatorController);
                            lEquip.CreateStateMachine(lAnimatorController);
                            lPivot.CreateStateMachine(lAnimatorController);
                            lStrafe.CreateStateMachine(lAnimatorController);
                            lCast.CreateStateMachine(lAnimatorController);
                            lDeath.CreateStateMachine(lAnimatorController);
                            lLevitate.CreateStateMachine(lAnimatorController);
                        }
                    }
                }

                EditorUtility.DisplayDialog("Motion Pack: " + GroupName(), "Motion pack imported.", "ok");

                return(true);
            }

            return(false);
        }
Ejemplo n.º 12
0
    /// <summary>
    /// If the input manager entries don't exist, create them
    /// </summary>
    private void CreateInputManagerEntries()
    {
        if (!InputManagerHelper.IsDefined("WXButton0"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXButton0";
            lEntry.PositiveButton = "joystick button 0";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXButton1"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXButton1";
            lEntry.PositiveButton = "joystick button 1";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXButton2"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXButton2";
            lEntry.PositiveButton = "joystick button 2";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXButton3"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXButton3";
            lEntry.PositiveButton = "joystick button 3";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXLeftStickX"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXLeftStickX";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.1f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 1;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXLeftStickY"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXLeftStickY";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.1f;
            lEntry.Sensitivity = 1;
            lEntry.Invert      = true;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 2;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXLeftStickButton"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXLeftStickButton";
            lEntry.PositiveButton = "joystick button 8";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXRightStickX"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXRightStickX";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 4;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXRightStickY"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXRightStickY";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Invert      = true;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 5;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXRightStickButton"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXRightStickButton";
            lEntry.PositiveButton = "joystick button 9";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXLeftTrigger"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXLeftTrigger";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 9;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXRightTrigger"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXRightTrigger";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 10;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXDPadX"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXDPadX";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 6;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXDPadY"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "WXDPadY";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 7;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXLeftBumper"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXLeftBumper";
            lEntry.PositiveButton = "joystick button 4";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXRightBumper"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXRightBumper";
            lEntry.PositiveButton = "joystick button 5";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXBack"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXBack";
            lEntry.PositiveButton = "joystick button 6";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("WXStart"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "WXStart";
            lEntry.PositiveButton = "joystick button 7";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXButton0"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXButton0";
            lEntry.PositiveButton = "joystick button 16";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXButton1"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXButton1";
            lEntry.PositiveButton = "joystick button 17";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXButton2"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXButton2";
            lEntry.PositiveButton = "joystick button 18";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXButton3"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXButton3";
            lEntry.PositiveButton = "joystick button 19";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXLeftStickX"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "MXLeftStickX";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 1;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXLeftStickY"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "MXLeftStickY";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Invert      = true;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 2;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXLeftStickButton"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXLeftStickButton";
            lEntry.PositiveButton = "joystick button 11";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXRightStickX"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "MXRightStickX";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 3;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXRightStickY"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "MXRightStickY";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Invert      = true;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 4;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXRightStickButton"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXRightStickButton";
            lEntry.PositiveButton = "joystick button 12";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXLeftTrigger"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "MXLeftTrigger";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 5;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXRightTrigger"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name        = "MXRightTrigger";
            lEntry.Gravity     = 1;
            lEntry.Dead        = 0.3f;
            lEntry.Sensitivity = 1;
            lEntry.Type        = InputManagerEntryType.JOYSTICK_AXIS;
            lEntry.Axis        = 6;
            lEntry.JoyNum      = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXDPadX"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXDPadX";
            lEntry.PositiveButton = "joystick button 7";
            lEntry.NegativeButton = "joystick button 8";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXDPadY"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXDPadY";
            lEntry.PositiveButton = "joystick button 6";
            lEntry.NegativeButton = "joystick button 5";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXLeftBumper"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXLeftBumper";
            lEntry.PositiveButton = "joystick button 13";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXRightBumper"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXRightBumper";
            lEntry.PositiveButton = "joystick button 14";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXBack"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXBack";
            lEntry.PositiveButton = "joystick button 10";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }

        if (!InputManagerHelper.IsDefined("MXStart"))
        {
            InputManagerEntry lEntry = new InputManagerEntry();
            lEntry.Name           = "MXStart";
            lEntry.PositiveButton = "joystick button 9";
            lEntry.Gravity        = 1000;
            lEntry.Dead           = 0.001f;
            lEntry.Sensitivity    = 1000;
            lEntry.Type           = InputManagerEntryType.KEY_MOUSE_BUTTON;
            lEntry.Axis           = 0;
            lEntry.JoyNum         = 0;

            InputManagerHelper.AddEntry(lEntry);
        }
    }