multiple xr toolkit package
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VRC_DestructibleStandardEditor.cs 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEditor;
  4. using VRCSDK2;
  5. [CustomEditor(typeof(VRC_DestructibleStandard))]
  6. [CanEditMultipleObjects]
  7. public class VRC_DestructibleStandardEditor : Editor
  8. {
  9. VRC_DestructibleStandard ds;
  10. SerializedProperty maxHealth;
  11. SerializedProperty currentHealth;
  12. SerializedProperty healable;
  13. SerializedProperty onDamagedTrigger;
  14. SerializedProperty onDestroyedTrigger;
  15. SerializedProperty onHealedTrigger;
  16. SerializedProperty onFullHealedTrigger;
  17. void OnEnable()
  18. {
  19. maxHealth = serializedObject.FindProperty("maxHealth");
  20. currentHealth = serializedObject.FindProperty("currentHealth");
  21. healable = serializedObject.FindProperty("healable");
  22. onDamagedTrigger = serializedObject.FindProperty("onDamagedTrigger");
  23. onDestroyedTrigger = serializedObject.FindProperty("onDestructedTrigger");
  24. onHealedTrigger = serializedObject.FindProperty("onHealedTrigger");
  25. onFullHealedTrigger = serializedObject.FindProperty("onFullHealedTrigger");
  26. }
  27. public override void OnInspectorGUI()
  28. {
  29. ds = (VRC_DestructibleStandard)target;
  30. // Update the serializedProperty - always do this in the beginning of OnInspectorGUI.
  31. serializedObject.Update ();
  32. EditorGUILayout.PropertyField(maxHealth, new GUIContent("Max Health"));
  33. EditorGUILayout.PropertyField(currentHealth, new GUIContent("Current Health"));
  34. EditorGUILayout.PropertyField(healable, new GUIContent("Is Healable"));
  35. EditorGUILayout.PropertyField(onDamagedTrigger, new GUIContent("On Damaged Trigger"));
  36. VRC_EditorTools.DrawTriggerActionCallback("On Damaged Action", ds.onDamagedTrigger, ds.onDamagedEvent);
  37. EditorGUILayout.PropertyField(onDestroyedTrigger, new GUIContent("On Destructed Trigger"));
  38. VRC_EditorTools.DrawTriggerActionCallback("On Destructed Action", ds.onDestructedTrigger, ds.onDestructedEvent);
  39. EditorGUILayout.PropertyField(onHealedTrigger, new GUIContent("On Healed Trigger"));
  40. VRC_EditorTools.DrawTriggerActionCallback("On Healed Action", ds.onHealedTrigger, ds.onHealedEvent);
  41. EditorGUILayout.PropertyField(onFullHealedTrigger, new GUIContent("On Full Healed Trigger"));
  42. VRC_EditorTools.DrawTriggerActionCallback("On Full Healed Action", ds.onFullHealedTrigger, ds.onFullHealedEvent);
  43. // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI.
  44. serializedObject.ApplyModifiedProperties ();
  45. }
  46. }