GameplayAPI
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:100
API of the gameplay plugin: common game-logic components.
Methods
Section titled “Methods”health()
Section titled “health()”health(
hp,maxHp?):HealthComp
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:102
Component: hit points, hurt/heal and "hurt"/"heal"/"death" events.
Parameters
Section titled “Parameters”number
maxHp?
Section titled “maxHp?”number
Returns
Section titled “Returns”lifespan()
Section titled “lifespan()”lifespan(
seconds,opts?):LifespanComp
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:106
Destroys the object after seconds (fading out the last fade seconds if it has opacity).
Parameters
Section titled “Parameters”seconds
Section titled “seconds”number
number
Returns
Section titled “Returns”offscreen()
Section titled “offscreen()”offscreen(
opts?):OffscreenComp
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:110
Component: detects when the object is far from the camera (or outside its view).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”state()
Section titled “state()”state(
initial,allowed?):StateComp
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:104
Component: a state machine starting in initial; allowed (optional) restricts the names.
Parameters
Section titled “Parameters”initial
Section titled “initial”string
allowed?
Section titled “allowed?”string[]
Returns
Section titled “Returns”timer()
Section titled “timer()”timer():
TimerComp
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:108
Component: timers that tick and die with the object.