GazePoint.js 676 Bytes
Newer Older
1 2 3 4 5
const schema = require("@colyseus/schema");
const Schema = schema.Schema;

class GazePoint extends Schema {

6 7
  constructor(screenX, screenY, createdAt, player, id) {
    super();
8 9
    this.screenX = screenX;
    this.screenY = screenY;
10 11 12 13 14 15 16 17
    this.createdAt = createdAt;
    this.player = player;
    this.id = id;
    this.relativeAge = 0;
  }

  static fromClientData(data) {
    return new GazePoint(data.screenX, data.screenY, data.createdAt, data.player, data.id);
18 19 20 21 22 23 24 25
  }

}

schema.defineTypes(GazePoint, {
    screenX: "number",
    screenY: "number",
    createdAt: "number",
26 27
    relativeAge: "number",
    player: "string",
28 29 30 31
    id: "number",
});

module.exports = GazePoint;