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

A special movement which starts the character swimming when the enter the water. The directional version applies swim force in the direction the character is facing. More...

Inheritance diagram for PlatformerPro.SpecialMovement_DirectionalSwim:
PlatformerPro.SpecialMovement_Swim PlatformerPro.SpecialMovement PlatformerPro.BaseMovement< SpecialMovement >

Public Member Functions

override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the mvoement with the given movement data. More...
 
override void DoMove ()
 Moves the character. More...
 
override void StartSwim ()
 Starts the swim. More...
 
override void SurfaceSwim ()
 
override void EndSurfaceSwim ()
 
override bool WantsSpecialMove ()
 Gets a value indicating whether this movement wants to do a special move. More...
 
override bool ForceMaintainControl ()
 If this is true then the movement wants to maintain control of the character even if default transition conditions suggest it shouldn't. More...
 
override void LosingControl ()
 Called when the movement loses control. Override to do any reset type actions. More...
 
- Public Member Functions inherited from PlatformerPro.SpecialMovement_Swim
override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the mvoement with the given movement data. More...
 
override bool WantsSpecialMove ()
 Gets a value indicating whether this movement wants to do a special move. More...
 
override void DoMove ()
 Moves the character. More...
 
override bool ForceMaintainControl ()
 If this is true then the movement wants to maintain control of the character even if default transition conditions suggest it shouldn't. More...
 
override void LosingControl ()
 Called when the movement loses control. Override to do any reset type actions. More...
 
virtual void StopSwim ()
 Stops the swim. More...
 
- Public Member Functions inherited from PlatformerPro.SpecialMovement
virtual void DoSpecialMove ()
 Start the special mvoe More...
 
- Public Member Functions inherited from PlatformerPro.BaseMovement< SpecialMovement >
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

bool faceInHeldDirection
 When stroking should we face in held direction, if false we face in velocity direction. More...
 
DirectionalSwimType swimType
 What type of swim is this? More...
 
float swimSpeed
 Swim speed used when not stroking (for DirectionSwimType.SWIM_PLUS_STROKE). More...
 
- Public Attributes inherited from PlatformerPro.SpecialMovement_Swim
float swimGravity
 Gravity to apply when swimming. Usually much lower than standard gravity, More...
 
float swimTerminalVelocity
 Maximum speed of descent when swimming. Usually much lower than the standard terminal velocity. More...
 
float strokeSpeed
 How long does a swimming stroke say. 2.0 would mean the character can stroke every 2 seconds. More...
 
Vector2 strokeAcceleration
 The stroke acceleration. X value is switched based on facing direction. More...
 
float maxSpeedInX
 Maximum x speed. More...
 
float xAcceleration
 How fast do we accelerate in X. More...
 
float drag
 X drag. More...
 
bool useGroundMovementWhenGrounded
 If the character is on the ground when underwater should they use the default ground movement. If false they will always swim. More...
 

Protected Member Functions

virtual void ApplyDrag ()
 
virtual bool IsStroking ()
 Awe we holding the stroke key? More...
 
- Protected Member Functions inherited from PlatformerPro.SpecialMovement_Swim
virtual void MoveInX ()
 Handle X movement More...
 
virtual void MoveInY ()
 

Protected Attributes

float limitVelocityTimer
 The swim timer for non-stroke, swims. More...
 
- Protected Attributes inherited from PlatformerPro.SpecialMovement_Swim
bool swimStarted
 Tracks if we are swimming or not. More...
 
float swimStrokeTimer
 The swim stroke timer, can't stroke until this is less than or equal to 0. More...
 
bool isOnSurface
 Tracks if we are on surface of water or not. More...
 
- Protected Attributes inherited from PlatformerPro.BaseMovement< SpecialMovement >
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 FaceInHeldDirectionIndex = 8
 The index for face in held direction. More...
 
const int HoldJumpToSwimIndex = 9
 The index of hold jump to swim. More...
 
const int SwimSpeedIndex = 10
 The index ofswim speed for SWIM_PLUS_STROKE More...
 
new const int MovementVariableCount = 11
 The size of the movement variable array. More...
 
new const float DefaultSwimGravity = 0f
 The default swim gravity. More...
 
new const float DefaultTerminalVelocity = -3.5f
 The default terminal speed. More...
 
new const float DefaultStrokeSpeed = 0.75f
 The default stroke speed. More...
 
new static Vector2 DefaultStrokeAcceleration = new Vector2 (5, 0)
 The default stroke acceleration. More...
 
const float MinSpeedForRotate = 0.5f
 If going slower than this don't rotate (in velocity mode). More...
 
- Static Protected Attributes inherited from PlatformerPro.SpecialMovement_Swim
const int SwimGravityIndex = 0
 The index of the swim gravity. More...
 
const int SwimTerminalVelocityIndex = 1
 The index of the swim terminal velocity. More...
 
const int StrokeSpeedIndex = 2
 The index of the stroke speed. More...
 
const int StrokeAccelerationIndex = 3
 The index of the stroke acceleration. More...
 
const int MaxSpeedInXIndex = 4
 The index of the max speed in X. More...
 
const int XAccelerationIndex = 5
 The index of the X acceleration. More...
 
const int DragIndex = 6
 The index of the drag. More...
 
const int UseGroundMovementWhenGroundedIndex = 7
 The index of the use ground movement when grounded. More...
 
const int MovementVariableCount = 8
 The size of the movement variable array. More...
 
const float DefaultDrag = 4.0f
 The default drag. More...
 
const float DefaultAcceleration = 12.0f
 The default acceleration. More...
 
const float DefaultMaxSpeed = 4.0f
 The default max speed. More...
 
const float DefaultSwimGravity = -6.0f
 The default swim gravity. More...
 
const float DefaultTerminalVelocity = -3.5f
 The default terminal speed. More...
 
const float DefaultStrokeSpeed = 0.75f
 The default stroke speed. More...
 
static Vector2 DefaultStrokeAcceleration = new Vector2 (5, 3.5f)
 The default stroke acceleration. More...
 

Properties

new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
virtual Vector2 SwimDirection [get]
 Gets the direction we are swimming in. More...
 
virtual Vector2 SwimFacingDirection [get]
 Gets the direction we should face. 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...
 
- Properties inherited from PlatformerPro.SpecialMovement_Swim
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
virtual bool OnSurface [get]
 Gets a value indicating whether this PlatformerPro.SpecialMovement_Swim is swimming on surface. More...
 
override AnimationState AnimationState [get]
 Gets the animation state that this movement wants to set. More...
 
override int AnimationPriority [get]
 Gets the priority of the animation state that this movement wants to set. More...
 
override bool ShouldApplyGravity [get]
 Shoulds the apply gravity. More...
 
override RaycastType ShouldDoBaseCollisions [get]
 Gets the should do base collisions. 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...
 
- Properties inherited from PlatformerPro.SpecialMovement
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
- Properties inherited from PlatformerPro.BaseMovement< SpecialMovement >
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 special movement which starts the character swimming when the enter the water. The directional version applies swim force in the direction the character is facing.

Member Function Documentation

◆ ApplyDrag()

virtual void PlatformerPro.SpecialMovement_DirectionalSwim.ApplyDrag ( )
protectedvirtual

◆ DoMove()

override void PlatformerPro.SpecialMovement_DirectionalSwim.DoMove ( )

Moves the character.

◆ EndSurfaceSwim()

override void PlatformerPro.SpecialMovement_DirectionalSwim.EndSurfaceSwim ( )
virtual

Starts Surface Swim.

Reimplemented from PlatformerPro.SpecialMovement_Swim.

◆ ForceMaintainControl()

override bool PlatformerPro.SpecialMovement_DirectionalSwim.ForceMaintainControl ( )

If this is true then the movement wants to maintain control of the character even if default transition conditions suggest it shouldn't.

Returns
true if control is wanted, false otherwise.

◆ Init()

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

Initialise the mvoement with the given movement data.

Parameters
characterCharacter.
movementDataMovement data.

◆ IsStroking()

virtual bool PlatformerPro.SpecialMovement_DirectionalSwim.IsStroking ( )
protectedvirtual

Awe we holding the stroke key?

◆ LosingControl()

override void PlatformerPro.SpecialMovement_DirectionalSwim.LosingControl ( )

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

◆ StartSwim()

override void PlatformerPro.SpecialMovement_DirectionalSwim.StartSwim ( )
virtual

Starts the swim.

Reimplemented from PlatformerPro.SpecialMovement_Swim.

◆ SurfaceSwim()

override void PlatformerPro.SpecialMovement_DirectionalSwim.SurfaceSwim ( )
virtual

Starts Surface Swim.

Reimplemented from PlatformerPro.SpecialMovement_Swim.

◆ WantsSpecialMove()

override bool PlatformerPro.SpecialMovement_DirectionalSwim.WantsSpecialMove ( )
virtual

Gets a value indicating whether this movement wants to do a special move.

true if this instance wants control; otherwise, false.

Reimplemented from PlatformerPro.SpecialMovement.

Member Data Documentation

◆ DefaultStrokeAcceleration

new static Vector2 PlatformerPro.SpecialMovement_DirectionalSwim.DefaultStrokeAcceleration = new Vector2 (5, 0)
staticprotected

The default stroke acceleration.

◆ DefaultStrokeSpeed

new const float PlatformerPro.SpecialMovement_DirectionalSwim.DefaultStrokeSpeed = 0.75f
staticprotected

The default stroke speed.

◆ DefaultSwimGravity

new const float PlatformerPro.SpecialMovement_DirectionalSwim.DefaultSwimGravity = 0f
staticprotected

The default swim gravity.

◆ DefaultTerminalVelocity

new const float PlatformerPro.SpecialMovement_DirectionalSwim.DefaultTerminalVelocity = -3.5f
staticprotected

The default terminal speed.

◆ faceInHeldDirection

bool PlatformerPro.SpecialMovement_DirectionalSwim.faceInHeldDirection

When stroking should we face in held direction, if false we face in velocity direction.

◆ FaceInHeldDirectionIndex

const int PlatformerPro.SpecialMovement_DirectionalSwim.FaceInHeldDirectionIndex = 8
staticprotected

The index for face in held direction.

◆ HoldJumpToSwimIndex

const int PlatformerPro.SpecialMovement_DirectionalSwim.HoldJumpToSwimIndex = 9
staticprotected

The index of hold jump to swim.

◆ limitVelocityTimer

float PlatformerPro.SpecialMovement_DirectionalSwim.limitVelocityTimer
protected

The swim timer for non-stroke, swims.

◆ MinSpeedForRotate

const float PlatformerPro.SpecialMovement_DirectionalSwim.MinSpeedForRotate = 0.5f
staticprotected

If going slower than this don't rotate (in velocity mode).

◆ MovementVariableCount

new const int PlatformerPro.SpecialMovement_DirectionalSwim.MovementVariableCount = 11
staticprotected

The size of the movement variable array.

◆ swimSpeed

float PlatformerPro.SpecialMovement_DirectionalSwim.swimSpeed

Swim speed used when not stroking (for DirectionSwimType.SWIM_PLUS_STROKE).

◆ SwimSpeedIndex

const int PlatformerPro.SpecialMovement_DirectionalSwim.SwimSpeedIndex = 10
staticprotected

The index ofswim speed for SWIM_PLUS_STROKE

◆ swimType

DirectionalSwimType PlatformerPro.SpecialMovement_DirectionalSwim.swimType

What type of swim is this?

Property Documentation

◆ FacingDirection

override int PlatformerPro.SpecialMovement_DirectionalSwim.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.SpecialMovement_DirectionalSwim.Info
staticget

Static movement info used by the editor.

◆ SwimDirection

virtual Vector2 PlatformerPro.SpecialMovement_DirectionalSwim.SwimDirection
get

Gets the direction we are swimming in.

The swim direction.

◆ SwimFacingDirection

virtual Vector2 PlatformerPro.SpecialMovement_DirectionalSwim.SwimFacingDirection
get

Gets the direction we should face.

The direction we should face.


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