platformer
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
UnityPlatformer.Track Class Reference

Track tile: Modify characters velocity, could be used for wind, moving floors More...

Inheritance diagram for UnityPlatformer.Track:
UnityPlatformer.BoxTileTrigger UnityPlatformer.Physhic2DMonoBehaviour

Public Member Functions

delegate void CharacterEvent (Character c)
 Delegate type More...
 
override void CharacterEnter (Character character)
 Character enter: set track property and call onEnter More...
 
override void CharacterExit (Character character)
 Character leaves: remove track property and call onExit More...
 
override void CharacterStay (Character character)
 This is called when Character is in, two things can happen I'm alredy in this track: OK I'm not in this track: Enter if no other track is used More...
 
- Public Member Functions inherited from UnityPlatformer.BoxTileTrigger
override void Start ()
 Force BoxCollider2D to be trigger using: Utils.KinematicTrigger and initialize character list More...
 
virtual Vector3 GetCenter ()
 Get real-world-coordinates center More...
 
virtual void OnDestroy ()
 exit all player More...
 
virtual void OnTriggerEnter2D (Collider2D o)
 if Hitbox with EnterAreas enter -> CharacterEnter More...
 
virtual void OnTriggerExit2D (Collider2D o)
 if Hitbox with EnterAreas leave -> CharacterExit More...
 
virtual void OnTriggerStay2D (Collider2D o)
 if Hitbox with EnterAreas leave -> CharacterExit More...
 

Public Attributes

Vector3 velocity = Vector3.zero
 Velocity that will be added to characters inside track More...
 
float accelerationTime = 0.5f
 Time to reach max velocity More...
 
CharacterStatesCheck characterState
 Combo to check character state More...
 
CharacterEvent onEnter
 Called when a new Character enter the Track area More...
 
CharacterEvent onExit
 Called when a new Character leave the Track area More...
 
- Public Attributes inherited from UnityPlatformer.BoxTileTrigger
BoxCollider2D body
 cached BoxCollider2D component More...
 
Character [] characters
 List of character in the Tile More...
 
int charCount
 How many character are in the Tile More...
 
- Public Attributes inherited from UnityPlatformer.Physhic2DMonoBehaviour
bool debug = false
 Display collider as flat color More...
 

Protected Member Functions

void Accelerate (Character character, float delta)
 Calculate character velocity More...
 

Detailed Description

Track tile: Modify characters velocity, could be used for wind, moving floors

NOTE: The velocity applied is applied after terminal velocity so it's an extra.
NOTE: Tracks should not overlap. Character will enter the first one it hit then when leave the track will enter the other, only one track at a time

Member Function Documentation

◆ Accelerate()

void UnityPlatformer.Track.Accelerate ( Character  character,
float  delta 
)
inlineprotected

Calculate character velocity

◆ CharacterEnter()

override void UnityPlatformer.Track.CharacterEnter ( Character  character)
inlinevirtual

Character enter: set track property and call onEnter

Reimplemented from UnityPlatformer.BoxTileTrigger.

◆ CharacterEvent()

delegate void UnityPlatformer.Track.CharacterEvent ( Character  c)

Delegate type

◆ CharacterExit()

override void UnityPlatformer.Track.CharacterExit ( Character  character)
inlinevirtual

Character leaves: remove track property and call onExit

Reimplemented from UnityPlatformer.BoxTileTrigger.

◆ CharacterStay()

override void UnityPlatformer.Track.CharacterStay ( Character  character)
inlinevirtual

This is called when Character is in, two things can happen I'm alredy in this track: OK I'm not in this track: Enter if no other track is used

Reimplemented from UnityPlatformer.BoxTileTrigger.

Member Data Documentation

◆ accelerationTime

float UnityPlatformer.Track.accelerationTime = 0.5f

Time to reach max velocity

◆ characterState

CharacterStatesCheck UnityPlatformer.Track.characterState

Combo to check character state

◆ onEnter

CharacterEvent UnityPlatformer.Track.onEnter

Called when a new Character enter the Track area

◆ onExit

CharacterEvent UnityPlatformer.Track.onExit

Called when a new Character leave the Track area

◆ velocity

Vector3 UnityPlatformer.Track.velocity = Vector3.zero

Velocity that will be added to characters inside track


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