aboutsummaryrefslogtreecommitdiff
path: root/Assets/Scripts/DamageVolumeSystem/Editor/DamageGeneratorEditor.cs
blob: 91a21239d03aaff3afc0076a6c7a8267940f36eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;

namespace DamageVolumeSystem.Editor
{
    [CustomEditor(typeof(DamageGenerator))]
    public class DamageGeneratorEditor : UnityEditor.Editor
    {
        /*
         * Editor page created by Mountools
         * Author : WangSoul Team
         * Date : 2026 / 05 / 09 - 16:20:21
         */
    
        public DamageGenerator damageGenerator;

        private void OnEnable()
        {
            damageGenerator = (DamageGenerator) target;
        }

        private void DrawDamageGeneratorEditor()
        {
            if (GUILayout.Button("生成伤害"))
            {
                damageGenerator.Emit();
            }
        }
        
        #region _
        
        public override void OnInspectorGUI()
        {
            Undo.RecordObject(damageGenerator, "Edit DamageGenerator");
            EditorGUI.BeginChangeCheck();
            
            DrawDefaultInspector();
            DrawDamageGeneratorEditor();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(damageGenerator);
                Undo.FlushUndoRecordObjects();
                serializedObject.ApplyModifiedProperties();
            }
        }
        
        private bool Property(string label, string propertyName, params GUILayoutOption[] options)
        {
            return EditorGUILayout.PropertyField(serializedObject.FindProperty(propertyName), new GUIContent(label), options);
        }
        
        #endregion
    }
}
#endif