Constructor

new()

Available on clay

Variables

@:keepread onlyentity:E

Inherited Events

Defined by StateMachineImpl

@:dox(show)stateChange(current:T, previous:T):Void

Event when state field changes.

@:dox(show)observedDirty(instance:StateMachineBase, fromSerializedField:Bool):Void

Event when any observable value as changed on this instance.

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by StateMachineImpl

@:value(StateMachineBase.NO_STATE)@observestate:T = StateMachineBase.NO_STATE

The current state

@:value(StateMachineBase.NO_STATE)read onlynextState:T = StateMachineBase.NO_STATE

When transitioning from one state to another, this will be set to the next incoming state

Defined by StateMachineBase

@:value(false)observedDirty:Bool = false

Default is false, automatically set to true when any of this instance's observable variables has changed.

@:value(false)paused:Bool = false

When set to true, the state machine will stop calling update() on current state and related.

@:value(true)autoUpdate:Bool = true

When set to true (default). This state machine will be updated automatically. If false, you'll need to call update() manually.

@:value(false)read onlystateDefined:Bool = false

Is true if a state has been assigned, false otherwise.

@:value(false)read onlynextStateDefined:Bool = false

Is true if a nextState has been assigned, false otherwise.

@:value(false)locked:Bool = false

If set to true, changing state will be forbidden and trigger an error.

@:value(null)read onlyinitializerName:String = null

Defined by Entity

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

components:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by StateMachineImpl

set(key:T, stateInstance:State):Void

get(key:T):State

scheduleOnceEnterState(owner:Entity, state:T, callback:() ‑> Void):Void

scheduleOnceExitState(owner:Entity, state:T, callback:() ‑> Void):Void

Defined by StateMachineBase

Defined by Entity

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

Start a tween associated with this entity.

Parameters:

easing

The easing to use

duration

The duration of the tween

fromValue

The start value of the tween

toValue

The end value of the tween

update

An update function called at each iteration of the tween

Returns:

The instance of the created Tween object

eagerTween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

Start an eager tween associated with this entity. This is the same as a regular tween, except that it will start updating itself using current frame's delta time instead of next frame like in a regular tween.

Parameters:

easing

The easing to use

duration

The duration of the tween

fromValue

The start value of the tween

toValue

The end value of the tween

update

An update function called at each iteration of the tween

Returns:

The instance of the created Tween object

@:value({ hasField : false })component<C>(?name:String, ?component:Null<C>, hasField:Bool = false):C