C# Class UnityPlatformer.CharacterAction

Inheritance: UnityEngine.MonoBehaviour
Show file Open project: llafuente/unity-platformer Class Usage Examples

Public Properties

Property Type Description
character Character
input PlatformerInput
onGrainControl System.Action
onLoseControl System.Action

Public Methods

Method Description
GainControl ( float delta ) : void

Called (once) when this action is going to be 'PerformAction' for first time Can be use to enter states

GetPostUpdateActions ( ) : PostUpdateActions

Return what to do next. By default should be: APPLY_GRAVITY | WORLD_COLLISIONS

LoseControl ( float delta ) : void

Called (once) when other action 'WantsToUpdate' or this action don't anymore Can be used to exit states and clean up

OnDisable ( ) : void

keep Character.actions in sync

OnEnable ( ) : void

keep Character.actions in sync

PerformAction ( float delta ) : void

Do your action here.

WantsToUpdate ( float delta ) : int

Tells the character we want to take control * Positive numbers fight: Higher number wins * Negative numbers are used to ignore fight and force Character to call PerformAction, but! because it doesn't win the fight onLoseControl, onGrainControl and GetPostUpdateActions are ignored.\n NOTE can be used as a replace for UpdateManager.PlatformerUpdate

Method Details

GainControl() public method

Called (once) when this action is going to be 'PerformAction' for first time Can be use to enter states
public GainControl ( float delta ) : void
delta float
return void

GetPostUpdateActions() public abstract method

Return what to do next. By default should be: APPLY_GRAVITY | WORLD_COLLISIONS
public abstract GetPostUpdateActions ( ) : PostUpdateActions
return PostUpdateActions

LoseControl() public method

Called (once) when other action 'WantsToUpdate' or this action don't anymore Can be used to exit states and clean up
public LoseControl ( float delta ) : void
delta float
return void

OnDisable() public method

keep Character.actions in sync
public OnDisable ( ) : void
return void

OnEnable() public method

keep Character.actions in sync
public OnEnable ( ) : void
return void

PerformAction() public abstract method

Do your action here.
public abstract PerformAction ( float delta ) : void
delta float
return void

WantsToUpdate() public abstract method

Tells the character we want to take control * Positive numbers fight: Higher number wins * Negative numbers are used to ignore fight and force Character to call PerformAction, but! because it doesn't win the fight onLoseControl, onGrainControl and GetPostUpdateActions are ignored.\n NOTE can be used as a replace for UpdateManager.PlatformerUpdate
public abstract WantsToUpdate ( float delta ) : int
delta float
return int

Property Details

character public property

Target character that will be affected by this movement
public Character character
return Character

input public property

Input to listen
public PlatformerInput input
return PlatformerInput

onGrainControl public property

Callback when this movement WantsToUpdate and has highest priority.
public Action,System onGrainControl
return System.Action

onLoseControl public property

Callback when this movement don't WantsToUpdate or another movement has higher priority
public Action,System onLoseControl
return System.Action