public override void OnInspectorGUI() { serializedObject.Update(); ReactiveObjectEditor.DrawActivatorCheck(targets); HedgehogEditorGUIUtility.DrawProperties(serializedObject, "RestoreOnExit", "ModifyDirection"); if (serializedObject.FindProperty("ModifyDirection").boolValue) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "Direction"); } HedgehogEditorGUIUtility.DrawProperties(serializedObject, "ModifyStrength"); if (serializedObject.FindProperty("ModifyStrength").boolValue) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "AirStrength", "GroundStrength"); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); HedgehogEditorGUIUtility.DrawProperties(serializedObject, "HitTrigger"); if (targets.Count() <= 1) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "BouncySides"); } HedgehogEditorGUIUtility.DrawProperties(serializedObject, "Power", "AccurateBounce", "LockControl"); if (targets.Count() == 1) { var lockControlProp = serializedObject.FindProperty("LockControl"); if (lockControlProp.boolValue) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "LockDuration"); } } HedgehogEditorGUIUtility.DrawProperties(serializedObject, "KeepOnGround"); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); HedgehogEditorGUIUtility.DrawProperties(serializedObject, "WhenColliding", "WhenOnSurface", "LimitAngle"); if (targets.Count() == 1) { var limitAngle = serializedObject.FindProperty("LimitAngle").boolValue; if (limitAngle) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "RelativeToRotation", "SurfaceAngleMin", "SurfaceAngleMax"); } } else { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "RelativeToRotation", "SurfaceAngleMin", "SurfaceAngleMax"); } serializedObject.ApplyModifiedProperties(); }
protected override void DrawControlProperties() { var useControlInput = serializedObject.FindProperty("UseControlInput"); HedgehogEditorGUIUtility.DrawProperties(serializedObject, "UseControlInput"); serializedObject.ApplyModifiedProperties(); var enabled = GUI.enabled; GUI.enabled = !useControlInput.boolValue; HedgehogEditorGUIUtility.DrawProperties(serializedObject, "ActivateAxis"); GUI.enabled = enabled; }
public override void OnInspectorGUI() { if (_instance == null) { return; } serializedObject.Update(); HedgehogEditorGUIUtility.DrawProperties(serializedObject, "Duration", "CurrentTime", "PositionCurve", "OnComplete", "Pivot", "Radius", "MidAngle", "Range"); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); if (targets.Count() > 1) { DrawDefaultInspector(); } else { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "TravelSpeed", "ExitSpeed", "EntryPoint", "Path", "DisablePathCollider", "NeverUpdate"); var neverUpdate = serializedObject.FindProperty("NeverUpdate"); if (!neverUpdate.boolValue) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "AlwaysUpdate"); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); ReactiveObjectEditor.DrawActivatorCheck(targets); if (targets.Count() > 1) { DrawDefaultInspector(); } else { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "DebrisObject", "DebrisSize", "UseSprite"); var useSpriteProp = serializedObject.FindProperty("UseSprite"); if (useSpriteProp.boolValue) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "SpriteRenderer"); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); var moveManager = target as MoveManager; HedgehogEditorGUIUtility.DrawProperties(serializedObject, "Controller", "Moves"); ShowEventsFoldout = EditorGUILayout.Foldout(ShowEventsFoldout, "Events"); if (ShowEventsFoldout) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "OnPerform", "OnEnd", "OnAvailable", "OnUnavailable", "OnInterrupted"); } GUI.enabled = Application.isPlaying; if ((ShowDebugFoldout = EditorGUILayout.Foldout(ShowDebugFoldout, "Debug")) && Application.isPlaying) { foreach (var layer in moveManager.Layers.Keys) { EditorGUILayout.LabelField(Enum.GetName(typeof(MoveLayer), layer), new GUIStyle(EditorStyles.boldLabel) { alignment = TextAnchor.UpperCenter }); var active = moveManager.Moves.Where(move => move.Layer == layer && move.CurrentState == Move.State.Active); var available = moveManager.Moves.Where(move => move.Layer == layer && move.CurrentState == Move.State.Available); // !WARNING! Very messy one-liner ahead. Quickly whipped it up to see move states from the manager. if (active.Any() || available.Any()) { EditorGUILayout.TextArea( (active.Any() ? ("<color=#006400>" + string.Join("\n", active.Select(move => move.GetType().Name + new string(' ', Mathf.Max(1, 23 - move.GetType().Name.Length)) + "\tActive").ToArray()) + "</color>" + (available.Any() ? "\n" : "")) : "") + (available.Any() ? ("<color=#646400>" + string.Join("\n", available.Select(move => move.GetType().Name + new string(' ', Mathf.Max(1, 20 - move.GetType().Name.Length)) + "\tAvailable") .ToArray()) + "</color>") : ""), new GUIStyle { alignment = TextAnchor.UpperCenter }); } } } GUI.enabled = true; serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { if (_instance == null) { return; } serializedObject.Update(); #region GUI Styles var titleStyle = new GUIStyle { fontSize = 12, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, richText = true }; var headerStyle = new GUIStyle { fontSize = 11, alignment = TextAnchor.MiddleCenter, }; var foldoutStyle = new GUIStyle(EditorStyles.foldout); #endregion #region Title GUILayout.Label("<color=\"#0000ff\">Hedgehog Controller</color>", titleStyle); #endregion HedgehogEditorGUIUtility.DrawProperties(serializedObject, "RendererObject", "Animator"); HedgehogEditorGUIUtility.DrawProperties(serializedObject, "CollisionMask"); #region Sensors Foldout ShowSensors = EditorGUILayout.Foldout(ShowSensors, "Sensors", foldoutStyle); if (ShowSensors) { EditorGUILayout.BeginHorizontal(); _fromRenderer = EditorGUILayout.ObjectField("From Renderer", _fromRenderer, typeof(Renderer), true) as Renderer; GUI.enabled = _fromRenderer != null && _fromRenderer.bounds != default(Bounds); if (GUILayout.Button("Create")) { HedgehogUtility.GenerateSensors(_instance, _fromRenderer.bounds); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); _fromCollider2D = EditorGUILayout.ObjectField("From Collider2D", _fromCollider2D, typeof(Collider2D), true) as Collider2D; GUI.enabled = _fromCollider2D != null; if (GUILayout.Button("Create")) { HedgehogUtility.GenerateSensors(_instance, _fromCollider2D.bounds); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); _fromBounds = EditorGUILayout.BoundsField("From Bounds", _fromBounds); GUI.enabled = _fromBounds != default(Bounds); if (GUILayout.Button("Create from Bounds")) { HedgehogUtility.GenerateSensors(_instance, _fromBounds, true); } GUI.enabled = true; EditorGUILayout.Space(); EditorGUILayout.PropertyField(serializedObject.FindProperty("Sensors")); } #endregion #region Physics Foldout ShowPhysics = EditorGUILayout.Foldout(ShowPhysics, "Physics", foldoutStyle); if (ShowPhysics) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "MaxSpeed", "GroundFriction", "GravityDirection", "SlopeGravity", "AirGravity", "AirDrag", "DetachSpeed", "MaxClimbAngle", "LedgeClimbHeight", "LedgeDropHeight" ); #region Advanced Physics ++EditorGUI.indentLevel; ShowAdvancedPhysics = EditorGUILayout.Foldout(ShowAdvancedPhysics, "Advanced"); if (ShowAdvancedPhysics) { ++EditorGUI.indentLevel; HedgehogEditorGUIUtility.DrawProperties(serializedObject, "AirDragRequiredSpeed", "AntiTunnelingSpeed", "SlopeGravityBeginAngle" ); --EditorGUI.indentLevel; } --EditorGUI.indentLevel; #endregion } #endregion ShowPerformance = EditorGUILayout.Foldout(ShowPerformance, "Performance"); if (ShowPerformance) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "DisableNotifyPlatforms", "DisableEvents", "DisableCeilingCheck", "DisableGroundCheck", "DisableSideCheck"); } #region Animation Foldout ShowAnimation = EditorGUILayout.Foldout(ShowAnimation, "Animation", foldoutStyle); if (ShowAnimation) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "AttachTrigger", "DetachTrigger", "AirSpeedXFloat", "AirSpeedYFloat", "GroundedBool", "FacingForwardBool", "GroundSpeedFloat", "GroundSpeedBool", "AbsGroundSpeedFloat", "SurfaceAngleFloat"); } #endregion #region Events Foldout ShowEvents = EditorGUILayout.Foldout(ShowEvents, "Events", foldoutStyle); if (ShowEvents) { HedgehogEditorGUIUtility.DrawProperties(serializedObject, "OnAttach", "OnDetach", "OnSteepDetach"); } #endregion #region Debug Foldout ShowDebugInfo = EditorGUILayout.Foldout(ShowDebugInfo, "Debug", foldoutStyle); if (ShowDebugInfo) { if (!Application.isPlaying) { EditorGUILayout.HelpBox("This section becomes active in Play Mode.", MessageType.Info); } GUI.enabled = Application.isPlaying; EditorGUILayout.LabelField("Collision", headerStyle); HedgehogEditorGUIUtility.DrawProperties(serializedObject, "CollisionMask", "Reactives", "Grounded", "LeftWall", "LeftCeiling", "RightWall", "RightCeiling"); EditorGUILayout.LabelField("Surface", headerStyle); GUI.enabled = Application.isPlaying && _instance.Grounded; EditorGUILayout.FloatField("Surface Angle", _instance.SurfaceAngle); EditorGUILayout.EnumPopup("Footing", _instance.Footing); EditorGUILayout.PropertyField(serializedObject.FindProperty("PrimarySurface")); EditorGUILayout.PropertyField(serializedObject.FindProperty("SecondarySurface")); GUI.enabled = Application.isPlaying; EditorGUILayout.Space(); EditorGUILayout.LabelField("Velocity", headerStyle); _instance.Vx = EditorGUILayout.FloatField("X", _instance.Vx); _instance.Vy = EditorGUILayout.FloatField("Y", _instance.Vy); GUI.enabled = Application.isPlaying && _instance.Grounded; _instance.GroundVelocity = EditorGUILayout.FloatField("Ground", _instance.GroundVelocity); GUI.enabled = Application.isPlaying; GUI.enabled = true; } #endregion if (GUI.changed) { serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(_instance); _serializedInstance.ApplyModifiedProperties(); EditorUtility.SetDirty(this); } }