@polyzone/core
Version:
PolyZone core API
29 lines (28 loc) • 950 B
TypeScript
import { GameObject } from "./GameObject";
/**
* A component that lives on a GameObject.
* Components are used to build up behaviours for GameObjects (which
* by themselves do nothing).
* Extend from this class to create a custom Component.
*/
export declare abstract class GameObjectComponent {
/**
* Called once, after the game object is added to the world.
* When a scene is loaded, all objects are loaded before this is called.
*/
init(): void;
/**
* Called once per frame
* @param deltaTime Time (in seconds) since the previous frame
*/
onUpdate(deltaTime: number): void;
/**
* Called right before the GameObject this component is attached to
* is destroyed.
*/
onDestroy(): void;
/** Unique identifier for this GameObjectComponent */
abstract get id(): string;
/** The GameObject this component is attached to */
abstract get gameObject(): GameObject;
}