Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.ClimbMovement_Rope Class Reference

A climb movement for swinging climbables (i.e ropes!) It does not handle collisions so make sure there is room around your ropes. More...

Inheritance diagram for PlatformerPro.ClimbMovement_Rope:
PlatformerPro.ClimbMovement PlatformerPro.BaseMovement< ClimbMovement >

Public Member Functions

override void DoMove ()
 Moves the character. More...
 
override void LosingControl ()
 Called when the movement loses control. Override to do any reset type actions. More...
 
override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the mvoement with the given movement data. More...
 
override bool WantsClimb ()
 The rope controller can only work with 2D Box Colliders. More...
 
override bool ForceMaintainControl ()
 Keep control until dismount. More...
 
- Public Member Functions inherited from PlatformerPro.BaseMovement< ClimbMovement >
sealed override Movement Init (Character character)
 Initialise this movement. More...
 
bool IsMovementDataDifferent (MovementVariable[] originalMovementData)
 Determines whether this instances movement data is different from the supplied originalMovementData. More...
 

Public Attributes

float climbSpeed
 The speed the character climbs at. More...
 
float leeway
 The character can only climb the rope if the distance between their transform and the ladders transform is smaller than this. More...
 
int availableDismounts
 Enum mask for the ways in which the chracter can dismount the rope. More...
 
bool onlyClimbRopes
 Should this movement only be used for climbing ropes. If false it will also be used for ladders and other climbables. More...
 
float downforce
 How much force does the character apply downwards on the rope section. Makes the rope behave like the character has weight. More...
 
float impartForceOnLatch
 How much force does the character impart to the rope when they latch on to it. More...
 
float baseJumpHeight
 How high does the character jump when the press jump, before any rope force is added? More...
 
Vector2 impartForceOnJump
 How much force does the rope impart to the character when they jump off. More...
 
bool autograb
 If true we automatically grab this rope as we move past it. More...
 
float swingForce
 How much force, if any, to impart when the user presses an arrow key. More...
 
bool calculateAngles
 Should we calculate rope angles and rotate chracter to match. More...
 
float handOffset
 If calculating angles we can average the angle across multiple rope sections (i.e. between hands and feet). This value is the distance between the hand contact pooint and feet contact point. More...
 

Protected Attributes

bool dismount
 If the user is dismounting we will relinquish control. More...
 
bool jumpDismount
 When a character jumps while holding up or down you don't want them to automatically stick back on the rope. We track if the way they dismounted was a jump, and if it was we only stick back to the rope when the y velocity is smaller than 0. More...
 
RopeSection currentRopeSection
 The rope character is currently on. More...
 
float positionOnSection
 Position on the current rope section from 0 bottom to 1 top). More...
 
float currentRopeSectionLength
 Cached section length of current rope. Assumes ropes always have same sized sections. More...
 
float dismountTimer
 Ensure we have time to dismount if we dismount off of bottom. More...
 
float swingTimer
 Stores the direction we were moving when we last did a swing. We wont be able to swing again until this changes. More...
 
bool showSwingAnimation
 If true we swung this frame and should play swing animation. More...
 
- Protected Attributes inherited from PlatformerPro.BaseMovement< ClimbMovement >
Movement implementation
 The class that will do the movement. More...
 
string movementType
 The type of movement as a string. More...
 
MovementVariable[] movementData
 Data that should be applied to the movement type on init. More...
 

Static Protected Attributes

const float swingTime = 0.5f
 Time between swings. More...
 
const float DismountTime = 0.33f
 How long should we not be able to mount rope after dismounting from the bottom of a rope? More...
 
const int ClimbSpeedIndex = 0
 The index for the speed value in the movement data. More...
 
const int LeewayIndex = 1
 The index for the leeway value in the movement data. More...
 
const int AvailableDismountsIndex = 2
 The index of the available dismounts mask. More...
 
const int OnlyClimbRopesIndex = 3
 The index of the only climb ropes flag. More...
 
const int DownForceIndex = 4
 The index of the down force. More...
 
const int ImpartForceOnLatchIndex = 5
 The index of impart force on latch. More...
 
const int ImpartForceOnJumpIndex = 6
 The index of the impart force on jump. More...
 
const int AutoGrabIndex = 7
 The index of the auto grab value. More...
 
const int SwingVelocityIndex = 9
 The index of the swing velocity. More...
 
const int CalculateAnglesIndex = 9
 The index of the calculate angles value. More...
 
const int HandOffsetIndex = 10
 The index of the hand offset value. More...
 
const int BaseJumpHeightIndex = 11
 The index of the base jump height. More...
 
const int MovementVariableCount = 12
 The size of the movement variable array. More...
 
const float DefaultClimbSpeed = 3.0f
 The default climb speed. More...
 
const float DefaultLeeway = 0.5f
 The default leeway. More...
 
const float DefaultCenteringRate = 1.0f
 The default leeway. More...
 
const int DefaultAvailableDismounts = (int)LadderDismountType.TOP_BOTTOM_AND_JUMP
 The default available dismounts. More...
 
const float DefaultDownforce = 5.0f
 The default downforce. More...
 
const float DefaultImpartForceOnLatch = 2.0f
 The default impart force on latch. More...
 
const float DefaultBaseJumpHeight = 1.5f
 The default height of the base jump. More...
 
static Vector2 DefaultImpartForceOnJump = new Vector2 (1.5f, 1.5f)
 The default impart force on jump. More...
 
const bool DefaultAutograb = true
 The default autograb. More...
 
const float DefaultSwingForce = 2.0f
 The default swing force. More...
 
const bool DefaultCalculateAngles = false
 The default calculate angles. More...
 
const float DefaultHandOffset = 0.0f
 The default hand offset. More...
 

Properties

new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
override bool ShouldApplyGravity [get]
 No gravity when climbing. More...
 
override RaycastType ShouldDoBaseCollisions [get]
 Ignore collisions when climbing. More...
 
override VelocityType VelocityType [get]
 How does this movement use Velocity. More...
 
override AnimationState AnimationState [get]
 Gets the animation state that this movement wants to set. More...
 
- Properties inherited from PlatformerPro.ClimbMovement
virtual bool DetectLaddersByTag [get, protected set]
 Should we find ladders by tag or by layer. If true we will use tags, if false we will use layers. Tags are easier to use but come with an allocation cost. More...
 
virtual string LadderLayerOrTagName [get, protected set]
 The name of the ladder lyaer if we find by layers, or the tag name if we find by tags. More...
 
override bool ShouldDoRotations [get]
 Gets a value indicating whether this PlatformerPro.Movement expects the rotations to be calculated and applied by the character. By default ladders don't do this. More...
 
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
- Properties inherited from PlatformerPro.BaseMovement< ClimbMovement >
virtual string MovementType [get, set]
 The type of movement as a string. More...
 
virtual MovementVariable[] MovementData [get, set]
 Data that should be applied to the movement type on init. More...
 
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
override bool Enabled [get, set]
 A custom enable which base movements can use to pass on enable values. More...
 
override Movement Implementation [get]
 Gets the underlying implementation. More...
 

Detailed Description

A climb movement for swinging climbables (i.e ropes!) It does not handle collisions so make sure there is room around your ropes.

Member Function Documentation

◆ DoMove()

override void PlatformerPro.ClimbMovement_Rope.DoMove ( )

Moves the character.

◆ ForceMaintainControl()

override bool PlatformerPro.ClimbMovement_Rope.ForceMaintainControl ( )

Keep control until dismount.

◆ Init()

override Movement PlatformerPro.ClimbMovement_Rope.Init ( Character  character,
MovementVariable[]  movementData 
)

Initialise the mvoement with the given movement data.

Parameters
characterCharacter.
movementDataMovement data.

◆ LosingControl()

override void PlatformerPro.ClimbMovement_Rope.LosingControl ( )

Called when the movement loses control. Override to do any reset type actions.

◆ WantsClimb()

override bool PlatformerPro.ClimbMovement_Rope.WantsClimb ( )
virtual

The rope controller can only work with 2D Box Colliders.

true if the character should climb; otherwise, false.

Reimplemented from PlatformerPro.ClimbMovement.

Member Data Documentation

◆ autograb

bool PlatformerPro.ClimbMovement_Rope.autograb

If true we automatically grab this rope as we move past it.

◆ AutoGrabIndex

const int PlatformerPro.ClimbMovement_Rope.AutoGrabIndex = 7
staticprotected

The index of the auto grab value.

◆ availableDismounts

int PlatformerPro.ClimbMovement_Rope.availableDismounts

Enum mask for the ways in which the chracter can dismount the rope.

◆ AvailableDismountsIndex

const int PlatformerPro.ClimbMovement_Rope.AvailableDismountsIndex = 2
staticprotected

The index of the available dismounts mask.

◆ baseJumpHeight

float PlatformerPro.ClimbMovement_Rope.baseJumpHeight

How high does the character jump when the press jump, before any rope force is added?

◆ BaseJumpHeightIndex

const int PlatformerPro.ClimbMovement_Rope.BaseJumpHeightIndex = 11
staticprotected

The index of the base jump height.

◆ calculateAngles

bool PlatformerPro.ClimbMovement_Rope.calculateAngles

Should we calculate rope angles and rotate chracter to match.

◆ CalculateAnglesIndex

const int PlatformerPro.ClimbMovement_Rope.CalculateAnglesIndex = 9
staticprotected

The index of the calculate angles value.

◆ climbSpeed

float PlatformerPro.ClimbMovement_Rope.climbSpeed

The speed the character climbs at.

◆ ClimbSpeedIndex

const int PlatformerPro.ClimbMovement_Rope.ClimbSpeedIndex = 0
staticprotected

The index for the speed value in the movement data.

◆ currentRopeSection

RopeSection PlatformerPro.ClimbMovement_Rope.currentRopeSection
protected

The rope character is currently on.

◆ currentRopeSectionLength

float PlatformerPro.ClimbMovement_Rope.currentRopeSectionLength
protected

Cached section length of current rope. Assumes ropes always have same sized sections.

◆ DefaultAutograb

const bool PlatformerPro.ClimbMovement_Rope.DefaultAutograb = true
staticprotected

The default autograb.

◆ DefaultAvailableDismounts

const int PlatformerPro.ClimbMovement_Rope.DefaultAvailableDismounts = (int)LadderDismountType.TOP_BOTTOM_AND_JUMP
staticprotected

The default available dismounts.

◆ DefaultBaseJumpHeight

const float PlatformerPro.ClimbMovement_Rope.DefaultBaseJumpHeight = 1.5f
staticprotected

The default height of the base jump.

◆ DefaultCalculateAngles

const bool PlatformerPro.ClimbMovement_Rope.DefaultCalculateAngles = false
staticprotected

The default calculate angles.

◆ DefaultCenteringRate

const float PlatformerPro.ClimbMovement_Rope.DefaultCenteringRate = 1.0f
staticprotected

The default leeway.

◆ DefaultClimbSpeed

const float PlatformerPro.ClimbMovement_Rope.DefaultClimbSpeed = 3.0f
staticprotected

The default climb speed.

◆ DefaultDownforce

const float PlatformerPro.ClimbMovement_Rope.DefaultDownforce = 5.0f
staticprotected

The default downforce.

◆ DefaultHandOffset

const float PlatformerPro.ClimbMovement_Rope.DefaultHandOffset = 0.0f
staticprotected

The default hand offset.

◆ DefaultImpartForceOnJump

Vector2 PlatformerPro.ClimbMovement_Rope.DefaultImpartForceOnJump = new Vector2 (1.5f, 1.5f)
staticprotected

The default impart force on jump.

◆ DefaultImpartForceOnLatch

const float PlatformerPro.ClimbMovement_Rope.DefaultImpartForceOnLatch = 2.0f
staticprotected

The default impart force on latch.

◆ DefaultLeeway

const float PlatformerPro.ClimbMovement_Rope.DefaultLeeway = 0.5f
staticprotected

The default leeway.

◆ DefaultSwingForce

const float PlatformerPro.ClimbMovement_Rope.DefaultSwingForce = 2.0f
staticprotected

The default swing force.

◆ dismount

bool PlatformerPro.ClimbMovement_Rope.dismount
protected

If the user is dismounting we will relinquish control.

◆ DismountTime

const float PlatformerPro.ClimbMovement_Rope.DismountTime = 0.33f
staticprotected

How long should we not be able to mount rope after dismounting from the bottom of a rope?

◆ dismountTimer

float PlatformerPro.ClimbMovement_Rope.dismountTimer
protected

Ensure we have time to dismount if we dismount off of bottom.

◆ downforce

float PlatformerPro.ClimbMovement_Rope.downforce

How much force does the character apply downwards on the rope section. Makes the rope behave like the character has weight.

◆ DownForceIndex

const int PlatformerPro.ClimbMovement_Rope.DownForceIndex = 4
staticprotected

The index of the down force.

◆ handOffset

float PlatformerPro.ClimbMovement_Rope.handOffset

If calculating angles we can average the angle across multiple rope sections (i.e. between hands and feet). This value is the distance between the hand contact pooint and feet contact point.

◆ HandOffsetIndex

const int PlatformerPro.ClimbMovement_Rope.HandOffsetIndex = 10
staticprotected

The index of the hand offset value.

◆ impartForceOnJump

Vector2 PlatformerPro.ClimbMovement_Rope.impartForceOnJump

How much force does the rope impart to the character when they jump off.

◆ ImpartForceOnJumpIndex

const int PlatformerPro.ClimbMovement_Rope.ImpartForceOnJumpIndex = 6
staticprotected

The index of the impart force on jump.

◆ impartForceOnLatch

float PlatformerPro.ClimbMovement_Rope.impartForceOnLatch

How much force does the character impart to the rope when they latch on to it.

◆ ImpartForceOnLatchIndex

const int PlatformerPro.ClimbMovement_Rope.ImpartForceOnLatchIndex = 5
staticprotected

The index of impart force on latch.

◆ jumpDismount

bool PlatformerPro.ClimbMovement_Rope.jumpDismount
protected

When a character jumps while holding up or down you don't want them to automatically stick back on the rope. We track if the way they dismounted was a jump, and if it was we only stick back to the rope when the y velocity is smaller than 0.

◆ leeway

float PlatformerPro.ClimbMovement_Rope.leeway

The character can only climb the rope if the distance between their transform and the ladders transform is smaller than this.

◆ LeewayIndex

const int PlatformerPro.ClimbMovement_Rope.LeewayIndex = 1
staticprotected

The index for the leeway value in the movement data.

◆ MovementVariableCount

const int PlatformerPro.ClimbMovement_Rope.MovementVariableCount = 12
staticprotected

The size of the movement variable array.

◆ onlyClimbRopes

bool PlatformerPro.ClimbMovement_Rope.onlyClimbRopes

Should this movement only be used for climbing ropes. If false it will also be used for ladders and other climbables.

◆ OnlyClimbRopesIndex

const int PlatformerPro.ClimbMovement_Rope.OnlyClimbRopesIndex = 3
staticprotected

The index of the only climb ropes flag.

◆ positionOnSection

float PlatformerPro.ClimbMovement_Rope.positionOnSection
protected

Position on the current rope section from 0 bottom to 1 top).

◆ showSwingAnimation

bool PlatformerPro.ClimbMovement_Rope.showSwingAnimation
protected

If true we swung this frame and should play swing animation.

◆ swingForce

float PlatformerPro.ClimbMovement_Rope.swingForce

How much force, if any, to impart when the user presses an arrow key.

◆ swingTime

const float PlatformerPro.ClimbMovement_Rope.swingTime = 0.5f
staticprotected

Time between swings.

◆ swingTimer

float PlatformerPro.ClimbMovement_Rope.swingTimer
protected

Stores the direction we were moving when we last did a swing. We wont be able to swing again until this changes.

◆ SwingVelocityIndex

const int PlatformerPro.ClimbMovement_Rope.SwingVelocityIndex = 9
staticprotected

The index of the swing velocity.

Property Documentation

◆ AnimationState

override AnimationState PlatformerPro.ClimbMovement_Rope.AnimationState
get

Gets the animation state that this movement wants to set.

◆ Info

new static MovementInfo PlatformerPro.ClimbMovement_Rope.Info
staticget

Static movement info used by the editor.

◆ ShouldApplyGravity

override bool PlatformerPro.ClimbMovement_Rope.ShouldApplyGravity
get

No gravity when climbing.

◆ ShouldDoBaseCollisions

override RaycastType PlatformerPro.ClimbMovement_Rope.ShouldDoBaseCollisions
get

Ignore collisions when climbing.

◆ VelocityType

override VelocityType PlatformerPro.ClimbMovement_Rope.VelocityType
get

How does this movement use Velocity.


The documentation for this class was generated from the following file: