constructor() {
this.status = StatusGameManagerEnum.IN_PROGRESS;
}
-
- connect(email:string) {
- this.ConnexionInstance = new Connexion(email, this);
+
+ connect(name:string) {
+ this.playerName = name;
+ this.ConnexionInstance = new Connexion(name, this);
- ConnexionInstance = this.ConnexionInstance;
return this.ConnexionInstance.createConnexion().then(() => {
- this.SimplePeer = new SimplePeer(ConnexionInstance);
+ this.SimplePeer = new SimplePeer(this.ConnexionInstance);
});
}
}
}
+ getPlayerName(): string {
+ return this.playerName;
+ }
++
+ pushPlayerPosition(event: HasMovedEvent) {
+ this.ConnexionInstance.sharePosition(event.x, event.y, event.direction);
+ }
}
-export const gameManager = new GameManager();
+export const gameManager = new GameManager();