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

Physics based air movement. More...

Inheritance diagram for PlatformerPro.AirMovement_Physics:
PlatformerPro.AirMovement PlatformerPro.IPhysicsMovement PlatformerPro.BaseMovement< AirMovement >

Public Member Functions

override bool WantsJump ()
 Gets a value indicating whether this movement wants to intiate the jump. More...
 
override void DoMove ()
 Moves the character. More...
 
override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the mvoement with the given movement data. More...
 
override bool ForceMaintainControl ()
 If the jump just started force control. More...
 
override void GainControl ()
 Called when the movement gets control. Typically used to do initialisation of velocity and the like. More...
 
override void LosingControl ()
 Called when the movement loses control. Reset the jump count. More...
 
override void DoJump ()
 Do the jump by translating and applying velocity. More...
 
override void DoOverridenJump (float newHeight, int jumpCount, bool skipPowerUps=false)
 Does a jump with overriden values for the key variables. Primarily used to allow platforms and wall jumps to affect jump height in non-physics based jumps. More...
 
- Public Member Functions inherited from PlatformerPro.AirMovement
virtual bool WantsAirControl ()
 Gets a value indicating whether this movement wants to control the movement in the air. Default is false with movement falling back to default air. Override if you want control. More...
 
virtual void DoOverridenMove (bool moveInX, bool moveInY, float xInput, ButtonState runButton)
 Partially moves the character. A lot of movements (e.g. wall movements) require partial air movement. This allows them to use the air movement instead of re-implementing the movement. More...
 
virtual float GetSpeed (float baseSpeed)
 Gets the air speed. More...
 
virtual float GetRunSpeed (float baseRunSpeed)
 Gets the run speed. More...
 
virtual float GetAcceleration (float baseAcceleration)
 Gets the acceleration. More...
 
virtual float GetJumpHeightOrForce (float baseHeight)
 Gets the jump height or the jump force. More...
 
virtual float GetDoubleJumpHeightOrForce (float baseHeight)
 Gets the double jump height or the double jump force. More...
 
- Public Member Functions inherited from PlatformerPro.BaseMovement< AirMovement >
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 jumpVelocity
 The velocity applied in y when the character jumps. More...
 
float acceleration
 The speed the character accelerates at in x . More...
 
float maxSpeed
 The maximum speed the character can accelerate to in x. Note they can go faster than this if they do a running and jump and don't change direction. More...
 
float drag
 The air drag. More...
 
bool useAnalogueInput
 If true the acceleration will be multiplied via the analogue input value. More...
 
float jumpGroundedLeeway
 After the user leaves the ground how much additional time do we give the user to press jump and still consider them grounded. More...
 
float ignoreForce
 Forces smaller than this will be ignored (generally applies to very small input values). More...
 
bool canDoubleJump
 Can the character double jump. More...
 
float doubleJumpVelocity
 The velocity applied in y when the character double jumps. More...
 
bool jumpAway
 Should we jump away from the current angle, or just jump up? More...
 
int maxDoubleJumpCount
 How many times the character can double jump. -1 means infinite. More...
 

Protected Member Functions

override void MoveInX (float horizontalAxis, int horizontalAxisDigital, ButtonState runButton)
 Do the X movement. More...
 
override void MoveInY ()
 Do the Y movement. More...
 
virtual void DoRotation ()
 Rotate towards the target rotation. More...
 
- Protected Member Functions inherited from PlatformerPro.AirMovement
virtual void AddGravityFlipHandler ()
 Add handler for the gravity flip event More...
 
virtual void HandleGravityFlipped (object sender, System.EventArgs e)
 Handles the gravity being flipped. More...
 

Protected Attributes

float readyToJumpTimer
 Character can only jump if this timer is less than zero. More...
 
bool jumpStart
 True before the jump leaves the ground. More...
 
bool showJumpStartedAnimation
 Ensure we play the jump start animation. More...
 
bool hasRecievedCounterInput
 If a user keeps holding in the direction they jumped, they will jump further. If they stop doing so they can no longer move faster than max speed. More...
 
int initialDirection
 The direction the character was moving when they started the jump. More...
 
int jumpCount
 Jump count, set to 0 while not jumping, 1 while jumping, 2 while double More...
 
bool jumpWhenButtonHeld
 Automatically jump when the character holds the jump button down. More...
 
- Protected Attributes inherited from PlatformerPro.AirMovement
FlippableGravity flippableGravity
 Cached reference to a flippable gravity. More...
 
- Protected Attributes inherited from PlatformerPro.BaseMovement< AirMovement >
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 int AccelerationIndex = 0
 The index for the acceleration value in the movement data. More...
 
const int MaxSpeedIndex = 1
 The index for the max speed value in the movement data. More...
 
const int DragIndex = 2
 The index for the drag index value in the movement data. More...
 
const int UseAnalogueIndex = 3
 The index for use analgoue input in the movement data. More...
 
const int GroundedLeewayIndex = 4
 The index for the ground leeay in the movement data. More...
 
const int IgnoreForceIndex = 5
 The index for the ignore force value in the movement data. More...
 
const int JumpVelocityIndex = 6
 The index for the jump velocity value in the movement data. More...
 
const int CanDoubleJumpIndex = 7
 The index for can double jump in the movement data. More...
 
const int DoubleJumpVelocityIndex = 8
 The index for the double jump velocity in the movement data. More...
 
const int JumpWhenButtonHeldIndex = 9
 The index for the Jump When Button Held in the movement data. More...
 
const int JumpAwayIndex = 10
 The index for the Jump Away setting in the movement data. More...
 
const int MaxDoubleJumpCountIndex = 11
 The index for the Max Double Jump Count in the movement data. More...
 
const int MovementVariableCount = 12
 The size of the movement variable array. More...
 
const float DefaultJumpVelocity = 10.0f
 The default jump velocity. More...
 
const float DefaultAcceleration = 60.0f
 The default acceleration. More...
 
const float DefaultDoubleJumpVelocity = 7.0f
 The default double jump velocity. More...
 
const float DefaultMaxSpeed = 7.0f
 The default max speed. More...
 
const float DefaultDrag = 5.0f
 The default drag. More...
 

Properties

new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
override AnimationState AnimationState [get]
 Gets the animation state that this movement wants to set. More...
 
override int AnimationPriority [get]
 Gets the priority for the animation state. More...
 
override int FacingDirection [get]
 Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. This overriden version always returns the input direction. More...
 
override VelocityType VelocityType [get]
 How does this movement use Velocity. More...
 
override bool ShouldDoRotations [get]
 Gets a value indicating whether this PlatformerPro.Movement expects the rotations to be calculated and applied by the character. More...
 
override bool ShouldApplyGravity [get]
 This class will handle gravity internally. More...
 
- Properties inherited from PlatformerPro.AirMovement
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
- Properties inherited from PlatformerPro.BaseMovement< AirMovement >
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

Physics based air movement.

Member Function Documentation

◆ DoJump()

override void PlatformerPro.AirMovement_Physics.DoJump ( )
virtual

Do the jump by translating and applying velocity.

Reimplemented from PlatformerPro.AirMovement.

◆ DoMove()

override void PlatformerPro.AirMovement_Physics.DoMove ( )

Moves the character.

◆ DoOverridenJump()

override void PlatformerPro.AirMovement_Physics.DoOverridenJump ( float  newHeight,
int  jumpCount,
bool  skipPowerUps = false 
)
virtual

Does a jump with overriden values for the key variables. Primarily used to allow platforms and wall jumps to affect jump height in non-physics based jumps.

Parameters
newHeightNew height.
jumpCountJump count.

Reimplemented from PlatformerPro.AirMovement.

◆ DoRotation()

virtual void PlatformerPro.AirMovement_Physics.DoRotation ( )
protectedvirtual

Rotate towards the target rotation.

◆ ForceMaintainControl()

override bool PlatformerPro.AirMovement_Physics.ForceMaintainControl ( )

If the jump just started force control.

◆ GainControl()

override void PlatformerPro.AirMovement_Physics.GainControl ( )

Called when the movement gets control. Typically used to do initialisation of velocity and the like.

◆ Init()

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

Initialise the mvoement with the given movement data.

Parameters
charactercharacter.
movementDataMovement data.

◆ LosingControl()

override void PlatformerPro.AirMovement_Physics.LosingControl ( )

Called when the movement loses control. Reset the jump count.

◆ MoveInX()

override void PlatformerPro.AirMovement_Physics.MoveInX ( float  horizontalAxis,
int  horizontalAxisDigital,
ButtonState  runButton 
)
protectedvirtual

Do the X movement.

Reimplemented from PlatformerPro.AirMovement.

◆ MoveInY()

override void PlatformerPro.AirMovement_Physics.MoveInY ( )
protectedvirtual

Do the Y movement.

Reimplemented from PlatformerPro.AirMovement.

◆ WantsJump()

override bool PlatformerPro.AirMovement_Physics.WantsJump ( )
virtual

Gets a value indicating whether this movement wants to intiate the jump.

true if this instance should jump; otherwise, false.

Reimplemented from PlatformerPro.AirMovement.

Member Data Documentation

◆ acceleration

float PlatformerPro.AirMovement_Physics.acceleration

The speed the character accelerates at in x .

◆ AccelerationIndex

const int PlatformerPro.AirMovement_Physics.AccelerationIndex = 0
staticprotected

The index for the acceleration value in the movement data.

◆ canDoubleJump

bool PlatformerPro.AirMovement_Physics.canDoubleJump

Can the character double jump.

◆ CanDoubleJumpIndex

const int PlatformerPro.AirMovement_Physics.CanDoubleJumpIndex = 7
staticprotected

The index for can double jump in the movement data.

◆ DefaultAcceleration

const float PlatformerPro.AirMovement_Physics.DefaultAcceleration = 60.0f
staticprotected

The default acceleration.

◆ DefaultDoubleJumpVelocity

const float PlatformerPro.AirMovement_Physics.DefaultDoubleJumpVelocity = 7.0f
staticprotected

The default double jump velocity.

◆ DefaultDrag

const float PlatformerPro.AirMovement_Physics.DefaultDrag = 5.0f
staticprotected

The default drag.

◆ DefaultJumpVelocity

const float PlatformerPro.AirMovement_Physics.DefaultJumpVelocity = 10.0f
staticprotected

The default jump velocity.

◆ DefaultMaxSpeed

const float PlatformerPro.AirMovement_Physics.DefaultMaxSpeed = 7.0f
staticprotected

The default max speed.

◆ doubleJumpVelocity

float PlatformerPro.AirMovement_Physics.doubleJumpVelocity

The velocity applied in y when the character double jumps.

◆ DoubleJumpVelocityIndex

const int PlatformerPro.AirMovement_Physics.DoubleJumpVelocityIndex = 8
staticprotected

The index for the double jump velocity in the movement data.

◆ drag

float PlatformerPro.AirMovement_Physics.drag

The air drag.

◆ DragIndex

const int PlatformerPro.AirMovement_Physics.DragIndex = 2
staticprotected

The index for the drag index value in the movement data.

◆ GroundedLeewayIndex

const int PlatformerPro.AirMovement_Physics.GroundedLeewayIndex = 4
staticprotected

The index for the ground leeay in the movement data.

◆ hasRecievedCounterInput

bool PlatformerPro.AirMovement_Physics.hasRecievedCounterInput
protected

If a user keeps holding in the direction they jumped, they will jump further. If they stop doing so they can no longer move faster than max speed.

◆ ignoreForce

float PlatformerPro.AirMovement_Physics.ignoreForce

Forces smaller than this will be ignored (generally applies to very small input values).

◆ IgnoreForceIndex

const int PlatformerPro.AirMovement_Physics.IgnoreForceIndex = 5
staticprotected

The index for the ignore force value in the movement data.

◆ initialDirection

int PlatformerPro.AirMovement_Physics.initialDirection
protected

The direction the character was moving when they started the jump.

◆ jumpAway

bool PlatformerPro.AirMovement_Physics.jumpAway

Should we jump away from the current angle, or just jump up?

◆ JumpAwayIndex

const int PlatformerPro.AirMovement_Physics.JumpAwayIndex = 10
staticprotected

The index for the Jump Away setting in the movement data.

◆ jumpCount

int PlatformerPro.AirMovement_Physics.jumpCount
protected

Jump count, set to 0 while not jumping, 1 while jumping, 2 while double

◆ jumpGroundedLeeway

float PlatformerPro.AirMovement_Physics.jumpGroundedLeeway

After the user leaves the ground how much additional time do we give the user to press jump and still consider them grounded.

◆ jumpStart

bool PlatformerPro.AirMovement_Physics.jumpStart
protected

True before the jump leaves the ground.

◆ jumpVelocity

float PlatformerPro.AirMovement_Physics.jumpVelocity

The velocity applied in y when the character jumps.

◆ JumpVelocityIndex

const int PlatformerPro.AirMovement_Physics.JumpVelocityIndex = 6
staticprotected

The index for the jump velocity value in the movement data.

◆ jumpWhenButtonHeld

bool PlatformerPro.AirMovement_Physics.jumpWhenButtonHeld
protected

Automatically jump when the character holds the jump button down.

◆ JumpWhenButtonHeldIndex

const int PlatformerPro.AirMovement_Physics.JumpWhenButtonHeldIndex = 9
staticprotected

The index for the Jump When Button Held in the movement data.

◆ maxDoubleJumpCount

int PlatformerPro.AirMovement_Physics.maxDoubleJumpCount

How many times the character can double jump. -1 means infinite.

◆ MaxDoubleJumpCountIndex

const int PlatformerPro.AirMovement_Physics.MaxDoubleJumpCountIndex = 11
staticprotected

The index for the Max Double Jump Count in the movement data.

◆ maxSpeed

float PlatformerPro.AirMovement_Physics.maxSpeed

The maximum speed the character can accelerate to in x. Note they can go faster than this if they do a running and jump and don't change direction.

◆ MaxSpeedIndex

const int PlatformerPro.AirMovement_Physics.MaxSpeedIndex = 1
staticprotected

The index for the max speed value in the movement data.

◆ MovementVariableCount

const int PlatformerPro.AirMovement_Physics.MovementVariableCount = 12
staticprotected

The size of the movement variable array.

◆ readyToJumpTimer

float PlatformerPro.AirMovement_Physics.readyToJumpTimer
protected

Character can only jump if this timer is less than zero.

◆ showJumpStartedAnimation

bool PlatformerPro.AirMovement_Physics.showJumpStartedAnimation
protected

Ensure we play the jump start animation.

◆ UseAnalogueIndex

const int PlatformerPro.AirMovement_Physics.UseAnalogueIndex = 3
staticprotected

The index for use analgoue input in the movement data.

◆ useAnalogueInput

bool PlatformerPro.AirMovement_Physics.useAnalogueInput

If true the acceleration will be multiplied via the analogue input value.

Property Documentation

◆ AnimationPriority

override int PlatformerPro.AirMovement_Physics.AnimationPriority
get

Gets the priority for the animation state.

◆ AnimationState

override AnimationState PlatformerPro.AirMovement_Physics.AnimationState
get

Gets the animation state that this movement wants to set.

◆ FacingDirection

override int PlatformerPro.AirMovement_Physics.FacingDirection
get

Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. This overriden version always returns the input direction.

◆ Info

new static MovementInfo PlatformerPro.AirMovement_Physics.Info
staticget

Static movement info used by the editor.

◆ ShouldApplyGravity

override bool PlatformerPro.AirMovement_Physics.ShouldApplyGravity
get

This class will handle gravity internally.

◆ ShouldDoRotations

override bool PlatformerPro.AirMovement_Physics.ShouldDoRotations
get

Gets a value indicating whether this PlatformerPro.Movement expects the rotations to be calculated and applied by the character.

◆ VelocityType

override VelocityType PlatformerPro.AirMovement_Physics.VelocityType
get

How does this movement use Velocity.


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