/// <summary> /// Initialise the mvoement with the given movement data. /// </summary> /// <param name="character">Character.</param> /// <param name="movementData">Movement data.</param> override public Movement Init(Character character, MovementVariable[] movementData) { AssignReferences(character); if (movementData != null && movementData.Length >= MovementVariableCount) { swimGravity = movementData[SwimGravityIndex].FloatValue; useGroundMovementWhenGrounded = movementData[UseGroundMovementWhenGroundedIndex].BoolValue; maxSpeedInX = movementData[MaxSpeedInXIndex].FloatValue; swimTerminalVelocity = movementData[SwimTerminalVelocityIndex].FloatValue; xAcceleration = movementData[XAccelerationIndex].FloatValue; drag = movementData[DragIndex].FloatValue; strokeSpeed = movementData[StrokeSpeedIndex].FloatValue; // By setting this we ensure we can't jump as soon as we hit the water swimStrokeTimer = strokeSpeed / 2.0f; limitVelocityTimer = strokeSpeed / 2.0f; strokeAcceleration = movementData[StrokeAccelerationIndex].Vector2Value; faceInHeldDirection = movementData[FaceInHeldDirectionIndex].BoolValue; swimType = (DirectionalSwimType)movementData[HoldJumpToSwimIndex].IntValue; swimSpeed = movementData[SwimSpeedIndex].FloatValue; } else { Debug.LogError("Invalid movement data."); } return(this); }
public static string GetDescription(this DirectionalSwimType me) { switch (me) { case DirectionalSwimType.AUTO_STROKE: return("Use strokes to swim automatically. No need to press a button."); case DirectionalSwimType.JUMP_TO_STROKE: return("Hover in place, use JUMP to stroke and thus swim."); case DirectionalSwimType.SWIM_PLUS_STROKE: return("Gently swim in any direction, press JUMP to stroke and swim faster."); } return("No information available."); }