BehaviorDef
此内容尚不支持你的语言。
Defined in: behavior.ts:62
Type Parameters
Section titled “Type Parameters”S extends object
Properties
Section titled “Properties”metadata?
Section titled “metadata?”
optionalmetadata?:ComponentMetadata
Defined in: behavior.ts:68
Field-presentation metadata for state (ranges, enums, …), forwarded to the component.
schedule?
Section titled “schedule?”
optionalschedule?:Schedule
Defined in: behavior.ts:66
Schedule the lifecycle system runs in (default Schedule.Update).
state?
Section titled “state?”
optionalstate?:S
Defined in: behavior.ts:64
Per-entity state → a defineComponent, editable in the Details panel.
touches?
Section titled “touches?”
optionaltouches?:SystemTouches
Defined in: behavior.ts:74
The components this behaviour reaches for through ctx.get/ctx.set, by
name — its own state component is already declared. Undeclared, the
schedule assumes anything, and this conflicts with every other system.
Methods
Section titled “Methods”destroy()?
Section titled “destroy()?”
optionaldestroy(ctx):void
Defined in: behavior.ts:80
Run once when the component is removed OR the entity is despawned.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
start()?
Section titled “start()?”
optionalstart(ctx):void
Defined in: behavior.ts:76
Run once, the frame the behavior’s component first appears on an entity.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
update()?
Section titled “update()?”
optionalupdate(ctx,dt):void
Defined in: behavior.ts:78
Run every frame for each entity carrying the behavior. dt == ctx.time.delta.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void