![]() |
Platformer Pro
2.3.2
A platform game kit for Unity.
|
A climb movement for swinging climbables (i.e ropes!) It does not handle collisions so make sure there is room around your ropes. More...
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... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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... | |
A climb movement for swinging climbables (i.e ropes!) It does not handle collisions so make sure there is room around your ropes.
override void PlatformerPro.ClimbMovement_Rope.DoMove | ( | ) |
Moves the character.
override bool PlatformerPro.ClimbMovement_Rope.ForceMaintainControl | ( | ) |
Keep control until dismount.
override Movement PlatformerPro.ClimbMovement_Rope.Init | ( | Character | character, |
MovementVariable[] | movementData | ||
) |
override void PlatformerPro.ClimbMovement_Rope.LosingControl | ( | ) |
Called when the movement loses control. Override to do any reset type actions.
|
virtual |
The rope controller can only work with 2D Box Colliders.
true
if the character should climb; otherwise, false
.
Reimplemented from PlatformerPro.ClimbMovement.
bool PlatformerPro.ClimbMovement_Rope.autograb |
If true we automatically grab this rope as we move past it.
|
staticprotected |
The index of the auto grab value.
int PlatformerPro.ClimbMovement_Rope.availableDismounts |
Enum mask for the ways in which the chracter can dismount the rope.
|
staticprotected |
The index of the available dismounts mask.
float PlatformerPro.ClimbMovement_Rope.baseJumpHeight |
How high does the character jump when the press jump, before any rope force is added?
|
staticprotected |
The index of the base jump height.
bool PlatformerPro.ClimbMovement_Rope.calculateAngles |
Should we calculate rope angles and rotate chracter to match.
|
staticprotected |
The index of the calculate angles value.
float PlatformerPro.ClimbMovement_Rope.climbSpeed |
The speed the character climbs at.
|
staticprotected |
The index for the speed value in the movement data.
|
protected |
The rope character is currently on.
|
protected |
Cached section length of current rope. Assumes ropes always have same sized sections.
|
staticprotected |
The default autograb.
|
staticprotected |
The default available dismounts.
|
staticprotected |
The default height of the base jump.
|
staticprotected |
The default calculate angles.
|
staticprotected |
The default leeway.
|
staticprotected |
The default climb speed.
|
staticprotected |
The default downforce.
|
staticprotected |
The default hand offset.
|
staticprotected |
The default impart force on jump.
|
staticprotected |
The default impart force on latch.
|
staticprotected |
The default leeway.
|
staticprotected |
The default swing force.
|
protected |
If the user is dismounting we will relinquish control.
|
staticprotected |
How long should we not be able to mount rope after dismounting from the bottom of a rope?
|
protected |
Ensure we have time to dismount if we dismount off of bottom.
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.
|
staticprotected |
The index of the down force.
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.
|
staticprotected |
The index of the hand offset value.
Vector2 PlatformerPro.ClimbMovement_Rope.impartForceOnJump |
How much force does the rope impart to the character when they jump off.
|
staticprotected |
The index of the impart force on jump.
float PlatformerPro.ClimbMovement_Rope.impartForceOnLatch |
How much force does the character impart to the rope when they latch on to it.
|
staticprotected |
The index of impart force on latch.
|
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.
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.
|
staticprotected |
The index for the leeway value in the movement data.
|
staticprotected |
The size of the movement variable array.
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.
|
staticprotected |
The index of the only climb ropes flag.
|
protected |
Position on the current rope section from 0 bottom to 1 top).
|
protected |
If true we swung this frame and should play swing animation.
float PlatformerPro.ClimbMovement_Rope.swingForce |
How much force, if any, to impart when the user presses an arrow key.
|
staticprotected |
Time between swings.
|
protected |
Stores the direction we were moving when we last did a swing. We wont be able to swing again until this changes.
|
staticprotected |
The index of the swing velocity.
|
get |
Gets the animation state that this movement wants to set.
|
staticget |
Static movement info used by the editor.
|
get |
No gravity when climbing.
|
get |
Ignore collisions when climbing.
|
get |
How does this movement use Velocity.