2020-04-04 12:42:02 +02:00
|
|
|
import {Message} from "./Message";
|
2020-04-04 16:25:03 +02:00
|
|
|
import {PointInterface} from "./PointInterface";
|
|
|
|
|
|
|
|
export class Point implements PointInterface{
|
|
|
|
x: number;
|
|
|
|
y: number;
|
2020-04-07 21:02:23 +02:00
|
|
|
direction: string;
|
2020-04-04 16:25:03 +02:00
|
|
|
|
2020-04-07 21:02:23 +02:00
|
|
|
constructor(x : number, y : number, direction : string = "none") {
|
2020-04-05 20:57:14 +02:00
|
|
|
if(x === null || y === null){
|
2020-04-04 17:56:43 +02:00
|
|
|
throw Error("position x and y cannot be null");
|
2020-04-04 17:22:02 +02:00
|
|
|
}
|
2020-04-04 16:25:03 +02:00
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
2020-04-07 21:02:23 +02:00
|
|
|
this.direction = direction;
|
2020-04-04 16:25:03 +02:00
|
|
|
}
|
|
|
|
}
|
2020-04-04 12:42:02 +02:00
|
|
|
|
|
|
|
export class MessageUserPosition extends Message{
|
2020-04-04 22:43:07 +02:00
|
|
|
position: PointInterface;
|
2020-04-04 12:42:02 +02:00
|
|
|
|
2020-04-27 00:44:25 +02:00
|
|
|
constructor(message: any) {
|
2020-04-04 12:42:02 +02:00
|
|
|
super(message);
|
2020-04-27 00:44:25 +02:00
|
|
|
this.position = new Point(message.position.x, message.position.y, message.position.direction);
|
2020-04-04 12:42:02 +02:00
|
|
|
}
|
2020-04-28 22:31:54 +02:00
|
|
|
}
|