public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField("Particle Properties", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Particle Prefab", "The particle prefab to use."), GUILayout.Width(180)); interaction.ParticlePrefab = EditorGUILayout.ObjectField(interaction.ParticlePrefab, typeof(ImpactParticles), false) as ImpactParticles; EditorGUILayout.EndHorizontal(); if (interaction.ParticlePrefab == null) { EditorGUILayout.HelpBox("You must assign an Particle Prefab for this interaction.", MessageType.Error); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Is Particle Looped", "Is the particle prefab looped?"), GUILayout.Width(180)); interaction.IsParticleLooped = EditorGUILayout.Toggle(interaction.IsParticleLooped); EditorGUILayout.EndHorizontal(); ImpactEditorUtilities.Separator(); EditorGUILayout.LabelField("Interaction Properties", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Minimum Velocity", "The minimum velocity magnitude required to show particles."), GUILayout.Width(180)); interaction.MinimumVelocity = EditorGUILayout.FloatField(interaction.MinimumVelocity); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Collision Normal Influence", "How much the collision normal should influence the calculated intensity."), GUILayout.Width(180)); interaction.CollisionNormalInfluence = EditorGUILayout.Slider(interaction.CollisionNormalInfluence, 0, 1); EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); interaction.EmitOnCollision = EditorGUILayout.ToggleLeft(new GUIContent("Emit On Collision", "Should particles be emitted on single collisions?"), interaction.EmitOnCollision); interaction.EmitOnSlide = EditorGUILayout.ToggleLeft(new GUIContent("Emit On Slide", "Should particles be emitted when sliding?"), interaction.EmitOnSlide); interaction.EmitOnRoll = EditorGUILayout.ToggleLeft(new GUIContent("Emit On Roll", "Should particles be emitted when rolling?"), interaction.EmitOnRoll); GUI.enabled = !interaction.IsParticleLooped && (interaction.EmitOnSlide || interaction.EmitOnRoll); interaction.EmissionInterval = ImpactEditorUtilities.RangeEditor(interaction.EmissionInterval, new GUIContent("Emission Interval (Min/Max)", "The interval at which particles should be emitted when sliding or rolling.")); interaction.EmissionIntervalType = (InteractionIntervalType)EditorGUILayout.EnumPopup(new GUIContent("Interval Type", "Whether the Emission Interval is defined in Time (seconds) or Distance."), interaction.EmissionIntervalType); GUI.enabled = true; if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(interaction); } }
private void drawInteractionProperties() { EditorGUILayout.LabelField("Interaction Properties", EditorStyles.boldLabel); interaction.VelocityRange = ImpactEditorUtilities.RangeEditor(interaction.VelocityRange, new GUIContent("Velocity Range (Min/Max)", "The velocity magnitude range to use when calculating collision intensity.")); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Collision Normal Influence", "How much the normal should affect the intensity."), GUILayout.Width(180)); interaction.CollisionNormalInfluence = EditorGUILayout.Slider("", interaction.CollisionNormalInfluence, 0, 1); EditorGUILayout.EndHorizontal(); interaction.ScaleVolumeWithVelocity = EditorGUILayout.ToggleLeft(new GUIContent("Scale Volume With Velocity", "Should volume be scaled based on the velocity?"), interaction.ScaleVolumeWithVelocity); if (interaction.ScaleVolumeWithVelocity) { EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Volume Scale Curve", ""), GUILayout.Width(150)); interaction.VelocityVolumeScaleCurve = EditorGUILayout.CurveField("", interaction.VelocityVolumeScaleCurve); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } EditorGUILayout.Separator(); interaction.RandomPitchRange = ImpactEditorUtilities.RangeEditor(interaction.RandomPitchRange, new GUIContent("Pitch Randomness (Min/Max)", "Random multiplier for the pitch.")); interaction.RandomVolumeRange = ImpactEditorUtilities.RangeEditor(interaction.RandomVolumeRange, new GUIContent("Volume Randomness (Min/Max)", "Random multiplier for the volume.")); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Slide Velocity Pitch Modifier", "How much to increase the pitch as sliding and rolling velocity increases."), GUILayout.Width(180)); interaction.SlideVelocityPitchMultiplier = EditorGUILayout.Slider("", interaction.SlideVelocityPitchMultiplier, 0, 1); EditorGUILayout.EndHorizontal(); }