/// <summary> /// Draws the inspector. /// </summary> new public static MovementVariable[] DrawInspector(MovementVariable[] movementData, ref bool showDetails, Character target) { if (movementData == null || movementData.Length < MovementVariableCount) { movementData = new MovementVariable[MovementVariableCount]; } // Draw base inspector and copy values MovementVariable[] baseMovementData = GroundMovement_Physics.DrawInspector(movementData, ref showDetails, target); System.Array.Copy(baseMovementData, movementData, baseMovementData.Length); if (showDetails) { // Loop Speed if (movementData[LoopSpeedIndex] == null) { movementData[LoopSpeedIndex] = new MovementVariable(DefaultLoopSpeed); } movementData[LoopSpeedIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Loop Speed", "Speed required to be able to run the loop."), movementData[LoopSpeedIndex].FloatValue); if (movementData[LoopSpeedIndex].FloatValue < 0) { movementData[LoopSpeedIndex].FloatValue = 0; } // Slide Time if (movementData[SlideTimeIndex] == null) { movementData[SlideTimeIndex] = new MovementVariable(DefaultSlideTime); } movementData[SlideTimeIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("SlideTime", "How long will the character slide down a slope if they get to 90 degrees without required speed."), movementData[SlideTimeIndex].FloatValue); if (movementData[SlideTimeIndex].FloatValue < 0) { movementData[SlideTimeIndex].FloatValue = 0; } } // Not rotate warning if (!target.rotateToSlopes) { EditorGUILayout.HelpBox("A character with a Loop movement must use rotate to slopes.", MessageType.Error); } else if (target.maxSlopeRotation < 90) { EditorGUILayout.HelpBox("If your character cannot rotate to an angle of 90 degrees you don't need a Loop movement.", MessageType.Warning); } if (!target.rotateToSlopes || target.maxSlopeRotation < 90) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix Now")) { target.rotateToSlopes = true; target.maxSlopeRotation = 180; } GUILayout.EndHorizontal(); } return(movementData); }
/// <summary> /// Draws the inspector. /// </summary> new public static MovementVariable[] DrawInspector(MovementVariable[] movementData, ref bool showDetails, Character target) { if (movementData == null || movementData.Length < MovementVariableCount) { movementData = new MovementVariable[MovementVariableCount]; } // Draw base inspector and copy values MovementVariable[] baseMovementData = GroundMovement_Physics.DrawInspector(movementData, ref showDetails, target); System.Array.Copy(baseMovementData, movementData, baseMovementData.Length); return(movementData); }