diff options
Diffstat (limited to 'Assets/Scripts/DamageVolumeSystem/Editor')
| -rw-r--r-- | Assets/Scripts/DamageVolumeSystem/Editor/HealthDataEditor.cs | 57 | ||||
| -rw-r--r-- | Assets/Scripts/DamageVolumeSystem/Editor/HealthDataEditor.cs.meta | 11 |
2 files changed, 68 insertions, 0 deletions
diff --git a/Assets/Scripts/DamageVolumeSystem/Editor/HealthDataEditor.cs b/Assets/Scripts/DamageVolumeSystem/Editor/HealthDataEditor.cs new file mode 100644 index 0000000..7cba9a1 --- /dev/null +++ b/Assets/Scripts/DamageVolumeSystem/Editor/HealthDataEditor.cs @@ -0,0 +1,57 @@ +#if UNITY_EDITOR +using UnityEditor; +using UnityEngine; + +namespace DamageVolumeSystem.Editor +{ + [CustomEditor(typeof(HealthData))] + public class HealthDataEditor : UnityEditor.Editor + { + /* + * Editor page created by Mountools + * Author : WangSoul Team + * Date : 2026 / 05 / 12 - 08:30:25 + */ + + public HealthData healthData; + + private void OnEnable() + { + healthData = (HealthData) target; + } + + private void DrawHealthDataEditor() + { + if (Application.isPlaying) + { + healthData.Health = EditorGUILayout.IntSlider($"Health ({(float) healthData.Health / healthData.maxHealth * 100}%)", healthData.Health, 0, healthData.maxHealth); + } + } + + #region _ + + public override void OnInspectorGUI() + { + Undo.RecordObject(healthData, "Edit HealthData"); + EditorGUI.BeginChangeCheck(); + + DrawDefaultInspector(); + DrawHealthDataEditor(); + + if (EditorGUI.EndChangeCheck()) + { + EditorUtility.SetDirty(healthData); + 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
\ No newline at end of file diff --git a/Assets/Scripts/DamageVolumeSystem/Editor/HealthDataEditor.cs.meta b/Assets/Scripts/DamageVolumeSystem/Editor/HealthDataEditor.cs.meta new file mode 100644 index 0000000..763ffe3 --- /dev/null +++ b/Assets/Scripts/DamageVolumeSystem/Editor/HealthDataEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a763b024ebd37341a900fd60f6c71ef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |
