예제 #1
0
        private void Reset()
        {
            inputs.Add(new InputRow("Jump", "Jump", KeyCode.Space, InputButton.Press, InputType.Input));
            inputs.Add(new InputRow("Shift", "Fire3", KeyCode.LeftShift, InputButton.Press, InputType.Input));
            inputs.Add(new InputRow("Attack1", "Fire1", KeyCode.Mouse0, InputButton.Press, InputType.Input));
            inputs.Add(new InputRow("Attack2", "Fire2", KeyCode.Mouse1, InputButton.Press, InputType.Input));
            inputs.Add(new InputRow("Speed1", "Speed1", KeyCode.Alpha1, InputButton.Down, InputType.Key));
            inputs.Add(new InputRow("Speed2", "Speed2", KeyCode.Alpha2, InputButton.Down, InputType.Key));
            inputs.Add(new InputRow("Speed3", "Speed3", KeyCode.Alpha3, InputButton.Down, InputType.Key));

            InputRow speedUP = new InputRow("SpeedUp", "SpeedUp", KeyCode.Alpha2, InputButton.Down, InputType.Key)
            {
                active = false
            };

            InputRow speedDown = new InputRow("SpeedDown", "SpeedDown", KeyCode.Alpha1, InputButton.Down, InputType.Key)
            {
                active = false
            };

            inputs.Add(speedDown);
            inputs.Add(speedUP);

            inputs.Add(new InputRow("Action", "Action", KeyCode.E, InputButton.Down, InputType.Key));
            inputs.Add(new InputRow("Fly", "Fly", KeyCode.Q, InputButton.Down, InputType.Key));
            inputs.Add(new InputRow("Dodge", "Dodge", KeyCode.R, InputButton.Down, InputType.Key));
            inputs.Add(new InputRow("Down", "Down", KeyCode.C, InputButton.Press, InputType.Key));
            inputs.Add(new InputRow("Stun", "Stun", KeyCode.T, InputButton.Press, InputType.Key));

            inputs.Add(new InputRow("Death", "Death", KeyCode.K, InputButton.Down, InputType.Key));
            inputs.Add(new InputRow("Damaged", "Damaged", KeyCode.H, InputButton.Down, InputType.Key));
        }
예제 #2
0
        /// <summary>
        /// Enable/Disable the Input
        /// </summary>
        public virtual void EnableInput(string inputName, bool value)
        {
            InputRow i = inputs.Find(item => item.name == inputName);

            if (i != null)
            {
                i.active = value;
            }
        }
예제 #3
0
        public virtual InputRow FindInput(string name)
        {
            InputRow input = inputs.Find(item => item.name.ToUpper() == name.ToUpper());

            if (input != null)
            {
                return(input);
            }

            return(null);
        }
예제 #4
0
        /// <summary>
        /// Check if the input is active
        /// </summary>
        public virtual bool IsActive(string name)
        {
            InputRow input = inputs.Find(item => item.name.ToUpper() == name.ToUpper());

            if (input != null)
            {
                return(input.active);
            }

            return(false);
        }
예제 #5
0
        /// <summary>
        /// Thit will set the correct Input, from the Unity Input Manager or Keyboard.. you can always modify this code
        /// </summary>
        protected bool GetInput(string name)
        {
            InputRow input = inputs.Find(item => item.name.ToUpper() == name.ToUpper());

            if (input != null)
            {
                return(input.GetInput);
            }

            return(false);
        }
예제 #6
0
 private void FindAllInputs()
 {
     Attack1 = FindInput("Attack1");
     Attack2 = FindInput("Attack2");
     Action  = FindInput("Action");
     Jump    = FindInput("Jump");
     Shift   = FindInput("Shift");
     Fly     = FindInput("Fly");
     Down    = FindInput("Down");
     Dodge   = FindInput("Dodge");
     Death   = FindInput("Death");
     Stun    = FindInput("Stun");
     Damaged = FindInput("Damaged");
     Speed1  = FindInput("Speed1");
     Speed2  = FindInput("Speed2");
     Speed3  = FindInput("Speed3");
 }
예제 #7
0
        protected void CreateInputs()
        {
#if UNITY_EDITOR
            MInput input = GetComponent <MInput>();

            if (input == null)
            {
                input = gameObject.AddComponent <MInput>();
            }

            input.IgnoreOnPause.Value = false;

            #region Open Close Input
            var OpenCloseInput = input.FindInput("Freeze");
            if (OpenCloseInput == null)
            {
                OpenCloseInput = new InputRow("Freeze", "Freeze", KeyCode.Escape, InputButton.Down, InputType.Key);
                input.inputs.Add(OpenCloseInput);
                UnityEditor.Events.UnityEventTools.AddPersistentListener(OpenCloseInput.OnInputDown, Freeze_Game);
            }
            #endregion

            #region Submit Input
            var Submit = input.FindInput("Pause Editor");
            if (Submit == null)
            {
                Submit = new InputRow("Pause Editor", "Pause Editor", KeyCode.P, InputButton.Down, InputType.Key);
                input.inputs.Add(Submit);
                UnityEditor.Events.UnityEventTools.AddPersistentListener(Submit.OnInputDown, PauseEditor);
            }
            #endregion

            #region ChangeLeft Input
            var ChangeLeft = input.FindInput("SlowMo");
            if (ChangeLeft == null)
            {
                ChangeLeft = new InputRow("SlowMo", "SlowMo", KeyCode.Mouse2, InputButton.Down, InputType.Key);
                input.inputs.Add(ChangeLeft);
                UnityEditor.Events.UnityEventTools.AddPersistentListener(ChangeLeft.OnInputDown, Slow_Motion);
            }
            #endregion
            UnityEditor.EditorUtility.SetDirty(this);
            UnityEditor.EditorUtility.SetDirty(input);
#endif
        }
예제 #8
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.BeginVertical(MalbersEditor.StyleBlue);
            EditorGUILayout.HelpBox("Connects the INPUTS to the Locomotion System. The 'Name' is actually the Properties to access", MessageType.None);
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                EditorGUI.BeginDisabledGroup(true);
                script = (MonoScript)EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false);
                EditorGUI.EndDisabledGroup();

                EditorGUI.BeginChangeCheck();
#if REWIRED
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("PlayerID"), new GUIContent("Player ID", "Rewired Player ID"));
                EditorGUILayout.EndVertical();
#endif

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Horizontal"), new GUIContent("Horizontal", "Axis for the Horizontal Movement"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Vertical"), new GUIContent("Vertical", "Axis for the Forward/Backward Movement"));
                    //EditorGUILayout.PropertyField(serializedObject.FindProperty("UpDown"), new GUIContent("UpDown", "Axis for the Up and Down Movement"));
                }
                EditorGUILayout.EndVertical();

                list.DoLayoutList();
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("cameraBaseInput"), new GUIContent("Camera Input", "The Character will follow the camera forward axis"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("alwaysForward"), new GUIContent("Always Forward", "The Character will move forward forever"));
                EditorGUILayout.EndVertical();

                if (list.index != -1)
                {
                    if (list.index < list.count)
                    {
                        SerializedProperty Element = inputs.GetArrayElementAtIndex(list.index);

                        InputRow inputRow = M.inputs[list.index];

                        if (inputRow.active)
                        {
                            if (inputRow.GetPressed == InputButton.Down || inputRow.GetPressed == InputButton.Press)
                            {
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnInputDown"));
                            }

                            if (inputRow.GetPressed == InputButton.Up || inputRow.GetPressed == InputButton.Press)
                            {
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnInputUp"));
                            }

                            if (inputRow.GetPressed == InputButton.Press)
                            {
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnInputPressed"));
                            }
                            EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnInputChanged"));
                        }
                    }
                }


                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(target);
                }
                serializedObject.ApplyModifiedProperties();
            }
            EditorGUILayout.EndVertical();
        }