Migrating position notification into the User class

This commit is contained in:
David Négrier 2020-09-25 15:25:06 +02:00
parent 892d1555b8
commit 23cea1c835
7 changed files with 59 additions and 52 deletions

View file

@ -74,6 +74,13 @@ export class PositionNotifier {
return things;
}
public enter(thing: Movable): void {
const position = thing.getPosition();
const zoneDesc = this.getZoneDescriptorFromCoordinates(position.x, position.y);
const zone = this.getZone(zoneDesc.i, zoneDesc.j);
zone.enter(thing, null, position);
}
public updatePosition(thing: Movable, newPosition: PositionInterface, oldPosition: PositionInterface): void {
// Did we change zone?
const oldZoneDesc = this.getZoneDescriptorFromCoordinates(oldPosition.x, oldPosition.y);