const colyseus = require("colyseus"), Logger = require("../utils/Logger.js"); GazePoint = require("../game/GazePoint.js"); StarGazerState = require("../game/StarGazerState.js"); var deltaTime; class StarGazerRoom extends colyseus.Room { onCreate(options) { Logger.log("Creating StarGazerRoom", "Game Room"); this.setSimulationInterval(this.update.bind(this)); this.setState(new StarGazerState()); } onJoin(client, options) { Logger.log(`Player ${client.sessionId} joined StarGazerRoom`, "Game Room"); } onMessage(client, message) { if(message.type === "gaze") { message.data.player = client.id; this.state.addGazePoint(GazePoint.fromClientData(message.data)); } } onLeave(client, consented) { Logger.log(`Player ${client.sessionId} left StarGazerRoom`, "Game Room"); } onDispose() { Logger.log("Disposing StarGazerRoom", "Game Room"); } startGame() { } update(deltaTime) { this.state.update(deltaTime); } } module.exports = StarGazerRoom;