/// <summary> /// Initialise the movement 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) { if (movementData != null && movementData.Length >= MovementVariableCount) { handOffset = movementData[HandOffsetIndex].Vector2Value; maxDistance = movementData[MaxDistanceIndex].FloatValue; controlType = (GrapplingHookControlType)movementData[ControlTypeIndex].IntValue; retractSpeed = movementData[RetractSpeedIndex].FloatValue; drag = movementData[DragIndex].FloatValue; slingshotRetractSpeed = movementData[SlingshotRetractSpeedIndex].FloatValue; slingshotLaunchVelocity = movementData[SlingshotLaunchVelocityIndex].Vector2Value; gravity = movementData[GravityIndex].FloatValue; grapplePrefab = movementData[GrapplePrefabIndex].GameObjectValue; ropePrefab = movementData[RopePrefabIndex].GameObjectValue; canLaunchWhenGrounded = movementData[CanLaunchWhenGroundedIndex].BoolValue; launchVelocityBoost = movementData[LaunchVelocityBoostIndex].Vector2Value; launchVelocityMultiplier = movementData[LaunchVelocityMultiplierIndex].Vector2Value; slowDownType = (SlowDownType)movementData[SlowDownTypeIndex].IntValue; } else { Debug.LogError("Invalid movement data."); } Init(character); return(this); }
public static string GetDescription(this SlowDownType me) { switch (me) { case SlowDownType.NATURAL: return("The swing will gradually slow down."); case SlowDownType.DRAG_FACTOR: return("The natural slow down will be multipled by drag, you can use a negative value for speed up."); case SlowDownType.EXPONENTIAL: return("The longer the swing goes the more rapidly we slow down."); } return("No information available."); }