UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

127 lines (58 loc) 2.54 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [BaseEntityController](./server.baseentitycontroller.md) ## BaseEntityController class A base class for entity controller implementations. **Signature:** ```typescript export default abstract class BaseEntityController extends EventRouter ``` **Extends:** [EventRouter](./server.eventrouter.md) ## Remarks The BaseEntityController should be extended by a more specific entity controller that you or a plugin implements. Entity controllers are intended to be used as one controller instance per entity, but are flexible enough for edge cases such as if you want to create niche behavior of one controller for many entities that behave in unison. <h2>Events</h2> This class is an EventRouter, and instances of it emit events with payloads listed under [BaseEntityControllerEventPayloads](./server.baseentitycontrollereventpayloads.md) ## Methods <table><thead><tr><th> Method </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [attach(entity)](./server.baseentitycontroller.attach.md) </td><td> </td><td> Override this method to handle the attachment of an entity to your entity controller. </td></tr> <tr><td> [despawn(entity)](./server.baseentitycontroller.despawn.md) </td><td> </td><td> Override this method to handle the despawn of an entity from your entity controller. </td></tr> <tr><td> [detach(entity)](./server.baseentitycontroller.detach.md) </td><td> </td><td> Override this method to handle the detachment of an entity from your entity controller. </td></tr> <tr><td> [spawn(entity)](./server.baseentitycontroller.spawn.md) </td><td> </td><td> Override this method to handle the spawning of an entity to your entity controller. </td></tr> <tr><td> [tick(entity, deltaTimeMs)](./server.baseentitycontroller.tick.md) </td><td> </td><td> Override this method to handle entity movements based on your entity controller. </td></tr> <tr><td> [tickWithPlayerInput(entity, input, cameraOrientation, deltaTimeMs)](./server.baseentitycontroller.tickwithplayerinput.md) </td><td> </td><td> Override this method to handle entity movements based on player input for your entity controller. This is called every tick by a PlayerEntity with a entity controller. </td></tr> </tbody></table>