@polyzone/core
Version:
PolyZone core API
35 lines (34 loc) • 1.3 kB
TypeScript
import { IModule } from '../IModule';
import { GameObject } from "../../world/GameObject";
import { WorldQuery, IQueryResult, GameObjectQuery } from './WorldQuery';
export type QueryFn<TQuery, TResult> = (query: TQuery) => IQueryResult<TResult>;
/**
* The game world, containing all the current {@link GameObject}s
* and everything loaded in the game.
*/
export declare class WorldModule implements IModule {
/** All {@link GameObject}s currently in the world. */
readonly gameObjects: GameObject[];
constructor();
/**
* Called once per frame.
* @param deltaTime Time (in seconds) since the last frame.
*/
onUpdate(deltaTime: number): void;
/**
* Destroy the world and everything in it.
*/
addObject(gameObject: GameObject): void;
/**
* Destroys a {@link GameObject}, removing it from the world.
* @param gameObject The {@link GameObject} to remove.
*/
destroyObject(gameObject: GameObject): void;
query<TResult>(queryFn: QueryFn<WorldQuery, TResult>): TResult;
query<TResult>(relativeTo: GameObject, queryFn: QueryFn<GameObjectQuery, TResult>): TResult;
}
/**
* The game world, containing all the current {@link GameObject}s
* and everything loaded in the game.
*/
export declare const World: WorldModule;