/// <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]; } // Climb speed if (movementData[ClimbUpSpeedIndex] == null) { movementData[ClimbUpSpeedIndex] = new MovementVariable(DefaultClimbUpSpeed); } movementData[ClimbUpSpeedIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Climb Up Speed", "How fast the character climbs up the wall when the user presses up."), movementData[ClimbUpSpeedIndex].FloatValue); if (movementData[ClimbUpSpeedIndex].FloatValue < 0) { movementData[ClimbUpSpeedIndex].FloatValue = 0; } // Climb speed if (movementData[SlideDownSpeedIndex] == null) { movementData[SlideDownSpeedIndex] = new MovementVariable(DefaultSlideDownSpeed); } movementData[SlideDownSpeedIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Slide Down Speed", "How fast the character slides down the wall (negative)."), movementData[SlideDownSpeedIndex].FloatValue); if (movementData[SlideDownSpeedIndex].FloatValue > 0) { movementData[SlideDownSpeedIndex].FloatValue = 0; } // Cling drag if (movementData[ClingDragIndex] == null) { movementData[ClingDragIndex] = new MovementVariable(DefaultClingDrag); } movementData[ClingDragIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Cling Drag", "How quickly we come to a halt when the user is not pressing down."), movementData[ClingDragIndex].FloatValue); if (movementData[ClingDragIndex].FloatValue < 0) { movementData[ClingDragIndex].FloatValue = 0; } // Draw base inspector and copy values MovementVariable[] baseMovementData = WallMovement_WallCling.DrawInspectorWithOptions(movementData, ref showDetails, target, false, false); System.Array.Copy(baseMovementData, movementData, baseMovementData.Length); 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]; } // Ledge climb types GUILayout.Label("Wall Running", EditorStyles.boldLabel); // Climb speed if (movementData[RunSpeedIndex] == null) { movementData[RunSpeedIndex] = new MovementVariable(DefaultRunSpeed); } movementData[RunSpeedIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Run Speed", "How fast the character runs up the wall."), movementData[RunSpeedIndex].FloatValue); if (movementData[RunSpeedIndex].FloatValue < 0) { movementData[RunSpeedIndex].FloatValue = 0; } if (movementData[RunTimeLimitIndex] == null) { movementData[RunTimeLimitIndex] = new MovementVariable(1); } movementData[RunTimeLimitIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Run Time", "How long we can run up the wall."), movementData[RunTimeLimitIndex].FloatValue); if (movementData[RunTimeLimitIndex].FloatValue < 0) { movementData[RunTimeLimitIndex].FloatValue = 0; } // Ledge climb types GUILayout.Label("Opposite Look", EditorStyles.boldLabel); if (movementData[OppositeLookTimeIndex] == null) { movementData[OppositeLookTimeIndex] = new MovementVariable(1); } movementData[OppositeLookTimeIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Opposite Look Time", "How long can we look in opposite direction."), movementData[OppositeLookTimeIndex].FloatValue); if (movementData[OppositeLookTimeIndex].FloatValue < 0) { movementData[RunTimeLimitIndex].FloatValue = 0; } // Ledge climb types GUILayout.Label("Speed and Gravity", EditorStyles.boldLabel); // Slide down speed if (movementData[SlideDownSpeedIndex] == null) { movementData[SlideDownSpeedIndex] = new MovementVariable(DefaultSlideDownSpeed); } movementData[SlideDownSpeedIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Slide Down Speed", "How fast the character slides down the wall (negative)."), movementData[SlideDownSpeedIndex].FloatValue); if (movementData[SlideDownSpeedIndex].FloatValue > 0) { movementData[SlideDownSpeedIndex].FloatValue = 0; } // Cling drag if (movementData[ClingDragIndex] == null) { movementData[ClingDragIndex] = new MovementVariable(DefaultClingDrag); } movementData[ClingDragIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Cling Drag", "How quickly we come to a halt when the user is not pressing down."), movementData[ClingDragIndex].FloatValue); if (movementData[ClingDragIndex].FloatValue < 0) { movementData[ClingDragIndex].FloatValue = 0; } // Speed where jump ends if (movementData[SpeedWhereWallJumpEndsIndex] == null) { movementData[SpeedWhereWallJumpEndsIndex] = new MovementVariable(DefaultSpeedWhereWallJumpEnds); } movementData[SpeedWhereWallJumpEndsIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Speed where Jump ends", "How fast does the character need to be falling before the wall jump finishes and control reverts back to player?"), movementData[SpeedWhereWallJumpEndsIndex].FloatValue); if (movementData[SpeedWhereWallJumpEndsIndex].FloatValue > 0) { movementData[SpeedWhereWallJumpEndsIndex].FloatValue = 0; } // Draw base inspector and copy values MovementVariable[] baseMovementData = WallMovement_WallCling.DrawInspectorWithOptions(movementData, ref showDetails, target, true, false); System.Array.Copy(baseMovementData, movementData, baseMovementData.Length); return(movementData); }