/** * Lifecycle Method Naming Convention * =================================== * * The SAGE engine uses consistent naming for lifecycle methods: * * - `$teardown()` - Engine/Manager shutdown. Called when the engine or a manager is being * shut down completely. Releases all resources and unsubscribes from events. Part of * the Disposable interface. * * - `$dispose()` - Level scene disposal. Called when a level is being unloaded. Disposes * the BabylonJS scene and clears references to allow the level to be reloaded later. * Follows BabylonJS naming conventions for scene objects. * * - `$destroy()` - Entity removal. Called when an entity is being removed from the game. * Handles cleanup of entity-specific resources and removal from the entity manager. * Part of the Destroyable interface. * * The `$` prefix indicates these are internal lifecycle methods that should generally * not be called by external game code. They are invoked by the engine/manager layer. */ /** * Interface for components that manage resources and require cleanup. * Components implementing this interface will have their $teardown method * called during engine shutdown. */ export interface Disposable { /** * Tears down the component and releases any held resources. * This method is called during engine shutdown. */ $teardown(): Promise; } /** * Interface for entities that can be destroyed and removed from the game. * Entities implementing this interface will have their $destroy method * called when they are removed from the entity manager. */ export interface Destroyable { /** * Destroys the entity and releases any held resources. * This method is called when the entity is removed from the game. */ $destroy(): Promise; }