Advertisement
LittleAngel

Untitled

Mar 15th, 2011
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. // LootableBaseInspector.cs
  2. // Allows clean and easy editing of lootable items
  3. // Place in the Editor folder and forget
  4.  
  5. using UnityEngine;
  6. using UnityEditor;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9.  
  10. [CustomEditor(typeof(LootableBase))]
  11.  
  12. public class LootableBaseInspector : Editor {
  13.  
  14. protected LootableBase thisTarget;
  15.  
  16. public override void OnInspectorGUI() {
  17. EditorGUIUtility.LookLikeInspector();
  18. thisTarget = (LootableBase)target;
  19. thisTarget.isLootable = EditorGUILayout.Toggle("Is Lootable", thisTarget.isLootable);
  20. thisTarget.animateWhenLooting = EditorGUILayout.Toggle("Animate When Looting", thisTarget.animateWhenLooting);
  21. if (thisTarget.animateWhenLooting)
  22. thisTarget.thisAnimation = EditorGUILayout.ObjectField("Animation", thisTarget.thisAnimation, typeof (Animation)) as Animation;
  23. thisTarget.destroyWhenEmpty = EditorGUILayout.Toggle("Destroy When Empty", thisTarget.destroyWhenEmpty);
  24. if (thisTarget.destroyWhenEmpty){
  25. thisTarget.delayBeforeDestroying = EditorGUILayout.FloatField("Delay Before Destroying",thisTarget.delayBeforeDestroying);
  26. thisTarget.fadeBeforeDestroying = EditorGUILayout.Toggle("Fade Before Destroying",thisTarget.fadeBeforeDestroying);
  27. thisTarget.fadeDuration = EditorGUILayout.FloatField("Fade Duration",thisTarget.fadeDuration);
  28. }
  29.  
  30. if (GUI.changed)
  31. EditorUtility.SetDirty(target);
  32. }
  33. }
  34.  
  35.  
  36. // ©2011 Adam Buckner (aka: Little Angel) and theantranch.com (mailto: adam@theantranch.com)
  37. // Not for reuse or resale without permission.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement