Exemplo n.º 1
0
        /// <summary>
        /// Draws the inspector for a combo attack.
        /// </summary>
        /// <param name="attack">Attack.</param>
        virtual protected void DrawComboAttackEditor(ComboAttackData attack)
        {
            string name = EditorGUILayout.TextField(new GUIContent("Name", "Human readable name (optional)."), attack.name);

            if (name != attack.name)
            {
                attack.name = name;
                EditorUtility.SetDirty(target);
            }

            EditorGUILayout.LabelField("Combo Data", EditorStyles.boldLabel);

            // Type
            ComboType comboType = (ComboType)EditorGUILayout.EnumPopup(new GUIContent("Combo Type ", "What type of combo move is this."), attack.comboType);

            if (comboType != attack.comboType)
            {
                attack.comboType = comboType;
                EditorUtility.SetDirty(target);
            }
            EditorGUILayout.HelpBox(comboType.GetDescription(), MessageType.Info);


            // Inital Attack
            string initialAttack = EditorGUILayout.TextField(new GUIContent("Initial Attack", "Human readable name (optional)."), attack.initialAttack);

            if (initialAttack != attack.initialAttack)
            {
                attack.initialAttack = initialAttack;
                EditorUtility.SetDirty(target);
            }

            // Window
            float min = attack.minWindowTime;
            float max = attack.maxWindowTime;

            EditorGUILayout.MinMaxSlider(new GUIContent("Trigger Window", "The window within the initial attack where the combos action button must be pressed (normalised time)."), ref min, ref max, 0, 1);
            if (min > 0.9f)
            {
                min = 0.9f;
            }
            if (max <= min + 0.1f)
            {
                max = min + 0.1f;
            }
            if (min != attack.minWindowTime || max != attack.maxWindowTime)
            {
                attack.minWindowTime = min;
                attack.maxWindowTime = max;
                EditorUtility.SetDirty(target);
            }

            // Combo count

            EditorGUILayout.LabelField("Attack Data", EditorStyles.boldLabel);
            DrawBasicAttackEditor(attack);
        }