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

A special movement which starts the character swimming when the enter the water. More...

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

Public Member Functions

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 StartSwim ()
 Starts the swim. More...
 
virtual void StopSwim ()
 Stops the swim. More...
 
virtual void SurfaceSwim ()
 Starts Surface Swim. More...
 
virtual void EndSurfaceSwim ()
 Ends Surface 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

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 MoveInX ()
 Handle X movement More...
 
virtual void MoveInY ()
 

Protected Attributes

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 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 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.

Member Function Documentation

◆ DoMove()

override void PlatformerPro.SpecialMovement_Swim.DoMove ( )

Moves the character.

◆ EndSurfaceSwim()

virtual void PlatformerPro.SpecialMovement_Swim.EndSurfaceSwim ( )
virtual

Ends Surface Swim.

Reimplemented in PlatformerPro.SpecialMovement_DirectionalSwim.

◆ ForceMaintainControl()

override bool PlatformerPro.SpecialMovement_Swim.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_Swim.Init ( Character  character,
MovementVariable[]  movementData 
)

Initialise the mvoement with the given movement data.

Parameters
characterCharacter.
movementDataMovement data.

◆ LosingControl()

override void PlatformerPro.SpecialMovement_Swim.LosingControl ( )

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

◆ MoveInX()

virtual void PlatformerPro.SpecialMovement_Swim.MoveInX ( )
protectedvirtual

Handle X movement

◆ MoveInY()

virtual void PlatformerPro.SpecialMovement_Swim.MoveInY ( )
protectedvirtual

◆ StartSwim()

virtual void PlatformerPro.SpecialMovement_Swim.StartSwim ( )
virtual

Starts the swim.

Reimplemented in PlatformerPro.SpecialMovement_DirectionalSwim.

◆ StopSwim()

virtual void PlatformerPro.SpecialMovement_Swim.StopSwim ( )
virtual

Stops the swim.

◆ SurfaceSwim()

virtual void PlatformerPro.SpecialMovement_Swim.SurfaceSwim ( )
virtual

Starts Surface Swim.

Reimplemented in PlatformerPro.SpecialMovement_DirectionalSwim.

◆ WantsSpecialMove()

override bool PlatformerPro.SpecialMovement_Swim.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

◆ DefaultAcceleration

const float PlatformerPro.SpecialMovement_Swim.DefaultAcceleration = 12.0f
staticprotected

The default acceleration.

◆ DefaultDrag

const float PlatformerPro.SpecialMovement_Swim.DefaultDrag = 4.0f
staticprotected

The default drag.

◆ DefaultMaxSpeed

const float PlatformerPro.SpecialMovement_Swim.DefaultMaxSpeed = 4.0f
staticprotected

The default max speed.

◆ DefaultStrokeAcceleration

Vector2 PlatformerPro.SpecialMovement_Swim.DefaultStrokeAcceleration = new Vector2 (5, 3.5f)
staticprotected

The default stroke acceleration.

◆ DefaultStrokeSpeed

const float PlatformerPro.SpecialMovement_Swim.DefaultStrokeSpeed = 0.75f
staticprotected

The default stroke speed.

◆ DefaultSwimGravity

const float PlatformerPro.SpecialMovement_Swim.DefaultSwimGravity = -6.0f
staticprotected

The default swim gravity.

◆ DefaultTerminalVelocity

const float PlatformerPro.SpecialMovement_Swim.DefaultTerminalVelocity = -3.5f
staticprotected

The default terminal speed.

◆ drag

float PlatformerPro.SpecialMovement_Swim.drag

X drag.

◆ DragIndex

const int PlatformerPro.SpecialMovement_Swim.DragIndex = 6
staticprotected

The index of the drag.

◆ isOnSurface

bool PlatformerPro.SpecialMovement_Swim.isOnSurface
protected

Tracks if we are on surface of water or not.

◆ maxSpeedInX

float PlatformerPro.SpecialMovement_Swim.maxSpeedInX

Maximum x speed.

◆ MaxSpeedInXIndex

const int PlatformerPro.SpecialMovement_Swim.MaxSpeedInXIndex = 4
staticprotected

The index of the max speed in X.

◆ MovementVariableCount

const int PlatformerPro.SpecialMovement_Swim.MovementVariableCount = 8
staticprotected

The size of the movement variable array.

◆ strokeAcceleration

Vector2 PlatformerPro.SpecialMovement_Swim.strokeAcceleration

The stroke acceleration. X value is switched based on facing direction.

◆ StrokeAccelerationIndex

const int PlatformerPro.SpecialMovement_Swim.StrokeAccelerationIndex = 3
staticprotected

The index of the stroke acceleration.

◆ strokeSpeed

float PlatformerPro.SpecialMovement_Swim.strokeSpeed

How long does a swimming stroke say. 2.0 would mean the character can stroke every 2 seconds.

◆ StrokeSpeedIndex

const int PlatformerPro.SpecialMovement_Swim.StrokeSpeedIndex = 2
staticprotected

The index of the stroke speed.

◆ swimGravity

float PlatformerPro.SpecialMovement_Swim.swimGravity

Gravity to apply when swimming. Usually much lower than standard gravity,

◆ SwimGravityIndex

const int PlatformerPro.SpecialMovement_Swim.SwimGravityIndex = 0
staticprotected

The index of the swim gravity.

◆ swimStarted

bool PlatformerPro.SpecialMovement_Swim.swimStarted
protected

Tracks if we are swimming or not.

◆ swimStrokeTimer

float PlatformerPro.SpecialMovement_Swim.swimStrokeTimer
protected

The swim stroke timer, can't stroke until this is less than or equal to 0.

◆ swimTerminalVelocity

float PlatformerPro.SpecialMovement_Swim.swimTerminalVelocity

Maximum speed of descent when swimming. Usually much lower than the standard terminal velocity.

◆ SwimTerminalVelocityIndex

const int PlatformerPro.SpecialMovement_Swim.SwimTerminalVelocityIndex = 1
staticprotected

The index of the swim terminal velocity.

◆ useGroundMovementWhenGrounded

bool PlatformerPro.SpecialMovement_Swim.useGroundMovementWhenGrounded

If the character is on the ground when underwater should they use the default ground movement. If false they will always swim.

◆ UseGroundMovementWhenGroundedIndex

const int PlatformerPro.SpecialMovement_Swim.UseGroundMovementWhenGroundedIndex = 7
staticprotected

The index of the use ground movement when grounded.

◆ xAcceleration

float PlatformerPro.SpecialMovement_Swim.xAcceleration

How fast do we accelerate in X.

◆ XAccelerationIndex

const int PlatformerPro.SpecialMovement_Swim.XAccelerationIndex = 5
staticprotected

The index of the X acceleration.

Property Documentation

◆ AnimationPriority

override int PlatformerPro.SpecialMovement_Swim.AnimationPriority
get

Gets the priority of the animation state that this movement wants to set.

The animation priority.

◆ AnimationState

override AnimationState PlatformerPro.SpecialMovement_Swim.AnimationState
get

Gets the animation state that this movement wants to set.

◆ FacingDirection

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

Static movement info used by the editor.

◆ OnSurface

virtual bool PlatformerPro.SpecialMovement_Swim.OnSurface
get

Gets a value indicating whether this PlatformerPro.SpecialMovement_Swim is swimming on surface.

true if on surface; otherwise, false.

◆ ShouldApplyGravity

override bool PlatformerPro.SpecialMovement_Swim.ShouldApplyGravity
get

Shoulds the apply gravity.

Returns
true, if apply gravity was shoulded, false otherwise.

◆ ShouldDoBaseCollisions

override RaycastType PlatformerPro.SpecialMovement_Swim.ShouldDoBaseCollisions
get

Gets the should do base collisions.

The should do base collisions.


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