public override void OnInspectorGUI() { TweenTest tweenTest = (TweenTest)target; if (tweenEventsFoldout == null) { tweenEventsFoldout = new EventsFoldout("Tween Events", tweenTest.tweenEvents); } tweenTest.tweenEvents = tweenEventsFoldout.Display(); if (GUILayout.Button("Play")) { tweenTest.Play(); SceneView.RepaintAll(); } if (GUILayout.Button("Reset")) { tweenTest.Reset(); SceneView.RepaintAll(); } // Add undo support Undo.RecordObject(tweenTest, "Tween Test Undo"); }
public void OnEnable() { // The actionScriptableObject instance being edited by this inspector ActionScriptableObject actionScriptableObject = (ActionScriptableObject)target; // Retrieves the action instance from the scriptable object being edited. This is a data container for the action's properties Action actionInfo = actionScriptableObject.action; // The foldout for the events performed at the same time this action is performed onStartEventsFoldout = new EventsFoldout("Events On Start", actionInfo.onStartEvents); showHitOptionsFoldouts = new bool[actionInfo.hitBoxes.Length]; // The GameObjects which serve as templates for the hit boxes. // One is supplied for each hit box in this action. If a Gameobject // is dragged and dropped, its values are copactionInfoEditoried to the hit box templateHitBoxes = new GameObject[actionInfo.hitBoxes.Length]; // The foldouts which edit the events which happen on collision for each hit box. hitSelfEventsFoldouts = new EventsFoldout[actionInfo.hitBoxes.Length]; hitAdversaryEventsFoldouts = new EventsFoldout[actionInfo.hitBoxes.Length]; for (int i = 0; i < actionInfo.hitBoxes.Length; i++) { hitSelfEventsFoldouts[i] = new EventsFoldout("Events [Self]", actionInfo.hitBoxes[i].hitInfo.selfEvents); hitAdversaryEventsFoldouts[i] = new EventsFoldout("Events [Adversary]", actionInfo.hitBoxes[i].hitInfo.adversaryEvents); } // "Forces" foldouts showStartTimeFoldouts = new bool[actionInfo.forces.Length]; showDurationFoldouts = new bool[actionInfo.forces.Length]; showOnCompleteEventFoldouts = new bool[actionInfo.forces.Length]; }
/// <summary> /// Creates a new editor for the given basic action /// </summary> public BasicActionEditor(BasicAction basicAction) { this.basicAction = basicAction; onStartEventsFoldout = new EventsFoldout("Events", basicAction.onStartEvents); }
public void OnEnable() { TweenTest tweenTest = (TweenTest)target; tweenEventsFoldout = new EventsFoldout("Tween Events", tweenTest.tweenEvents); }