@willyuum/pixi-gameobject-system
Version:
24 lines (23 loc) • 1.04 kB
TypeScript
import { Component } from "./Component";
import { Container, ViewContainer } from "pixi.js";
/**
* GameObject class is a container for components and visual components.
* This class will help to keep game and rendering logic separate
* but still accessible to each other.
*
* Each GameObject will need a holder so if it had visual components,
* it can be added to the stage and be rendered.
*/
export declare class GameObject {
name: string;
components: Component[];
viewComponents: ViewContainer[];
holder: Container;
constructor(name: string, parent: Container);
addComponent<T extends Component>(component: T): T;
getComponent<T extends Component>(componentClass: new (...args: any[]) => T): T | undefined;
removeComponent(component: Component): Boolean;
addVisualComponent<T extends ViewContainer>(viewComponent: T): T;
getVisualComponent<T extends ViewContainer>(componentClass: new (...args: any[]) => T): T | undefined;
removeVisualComponent(viewComponent: ViewContainer): void;
}