/// <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 GrapplingHookControlType me) { switch (me) { case GrapplingHookControlType.AUTO_RETRACT: return("The character starts moving up the hook as soon as it latches on to something."); case GrapplingHookControlType.UP_ONLY: return("The character can press a button to move higher up the rope."); case GrapplingHookControlType.UP_AND_DOWN: return("The character can move both up and down the rope."); } return("No information available."); }