radar4mob
Version:
Detects and emits an event when the position of an mob with coordinates changes.
30 lines (29 loc) • 1.08 kB
TypeScript
import { Mob } from './Mob';
export declare class Area {
readonly mobs: Map<string, Mob>;
readonly dirties: Set<Mob>;
/**
* Create a new mobility object. You can use `mob.id` property for `getMob` or `removeMob` method.
* @param id Mobility identifier. If same id is already exists, it will be not create mob and returns exists one.
* @param thresholdRadius Sight of mob.
*/
addMob(id: string, thresholdRadius: number): Mob;
/**
* Get a added mobility object from area instance. If object not exists, It will be returns `null`.
* @param id Mobility identifier what you want find.
*/
getMob(id: string): Mob | null;
/**
* Remove a added mobility. If object exists, returns `true`. otherwise, returns `false`.
* @param id Mobility identifier what you want remove.
*/
removeMob(id: string): boolean;
/**
* When this function is called, an 'in', 'out' event emits according to the coordinates of the mob.
*/
update(): void;
/**
* Destroys all mob.
*/
destroy(): void;
}