Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LootableBaseInspector.cs
- // Allows clean and easy editing of lootable items
- // Place in the Editor folder and forget
- using UnityEngine;
- using UnityEditor;
- using System.Collections;
- using System.Collections.Generic;
- [CustomEditor(typeof(LootableBase))]
- public class LootableBaseInspector : Editor {
- protected LootableBase thisTarget;
- public override void OnInspectorGUI() {
- EditorGUIUtility.LookLikeInspector();
- thisTarget = (LootableBase)target;
- thisTarget.isLootable = EditorGUILayout.Toggle("Is Lootable", thisTarget.isLootable);
- thisTarget.animateWhenLooting = EditorGUILayout.Toggle("Animate When Looting", thisTarget.animateWhenLooting);
- if (thisTarget.animateWhenLooting)
- thisTarget.thisAnimation = EditorGUILayout.ObjectField("Animation", thisTarget.thisAnimation, typeof (Animation)) as Animation;
- thisTarget.destroyWhenEmpty = EditorGUILayout.Toggle("Destroy When Empty", thisTarget.destroyWhenEmpty);
- if (thisTarget.destroyWhenEmpty){
- thisTarget.delayBeforeDestroying = EditorGUILayout.FloatField("Delay Before Destroying",thisTarget.delayBeforeDestroying);
- thisTarget.fadeBeforeDestroying = EditorGUILayout.Toggle("Fade Before Destroying",thisTarget.fadeBeforeDestroying);
- thisTarget.fadeDuration = EditorGUILayout.FloatField("Fade Duration",thisTarget.fadeDuration);
- }
- if (GUI.changed)
- EditorUtility.SetDirty(target);
- }
- }
- // ©2011 Adam Buckner (aka: Little Angel) and theantranch.com (mailto: adam@theantranch.com)
- // Not for reuse or resale without permission.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement