33 lines
968 B
TypeScript
33 lines
968 B
TypeScript
import { Group } from "./Group";
|
|
import { PointInterface } from "./Websocket/PointInterface";
|
|
import {Zone} from "_Model/Zone";
|
|
import {Movable} from "_Model/Movable";
|
|
import {PositionInterface} from "_Model/PositionInterface";
|
|
import {PositionNotifier} from "_Model/PositionNotifier";
|
|
|
|
export class User implements Movable {
|
|
public listenedZones: Set<Zone>;
|
|
public group?: Group;
|
|
|
|
public constructor(
|
|
public id: number,
|
|
private position: PointInterface,
|
|
public silent: boolean,
|
|
private positionNotifier: PositionNotifier
|
|
) {
|
|
this.listenedZones = new Set<Zone>();
|
|
|
|
this.positionNotifier.enter(this);
|
|
}
|
|
|
|
public getPosition(): PointInterface {
|
|
return this.position;
|
|
}
|
|
|
|
public setPosition(position: PointInterface): void {
|
|
const oldPosition = this.position;
|
|
this.position = position;
|
|
this.positionNotifier.updatePosition(this, position, oldPosition);
|
|
}
|
|
}
|