Commenting out the notion of status in the GameManager
authorDavid Négrier <d.negrier@thecodingmachine.com>
Sun, 24 May 2020 21:33:56 +0000 (23:33 +0200)
committerDavid Négrier <d.negrier@thecodingmachine.com>
Mon, 25 May 2020 20:37:07 +0000 (22:37 +0200)
It seems to be useless

front/src/Phaser/Game/GameManager.ts
front/src/Phaser/Game/GameScene.ts

index 1e582f4ba56fed0eeac275aa4e09e34b01224bf2..7f895048ef1db4111938888a4ee3721c3dd931d2 100644 (file)
@@ -13,10 +13,10 @@ import {SimplePeerInterface, SimplePeer} from "../../WebRtc/SimplePeer";
 import {AddPlayerInterface} from "./AddPlayerInterface";
 import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene";
 
-export enum StatusGameManagerEnum {
+/*export enum StatusGameManagerEnum {
     IN_PROGRESS = 1,
     CURRENT_USER_CREATED = 2
-}
+}*/
 
 export interface HasMovedEvent {
     direction: string;
@@ -31,7 +31,7 @@ export interface MapObject {
 }
 
 export class GameManager {
-    status: number;
+    //status: number;
     private ConnectionInstance: Connection;
     private currentGameScene: GameScene;
     private playerName: string;
@@ -39,7 +39,7 @@ export class GameManager {
     private characterUserSelected: string;
 
     constructor() {
-        this.status = StatusGameManagerEnum.IN_PROGRESS;
+        //this.status = StatusGameManagerEnum.IN_PROGRESS;
     }
 
     connect(name: string, characterUserSelected : string) {
@@ -70,11 +70,11 @@ export class GameManager {
     /**
      * Permit to create player in started room
      */
-    createCurrentPlayer(): void {
+    /*createCurrentPlayer(): void {
         //Get started room send by the backend
         this.currentGameScene.createCurrentPlayer();
-        this.status = StatusGameManagerEnum.CURRENT_USER_CREATED;
-    }
+        //this.status = StatusGameManagerEnum.CURRENT_USER_CREATED;
+    }*/
 
     joinRoom(sceneKey: string, startX: number, startY: number, direction: string, moving: boolean){
         this.ConnectionInstance.joinARoom(sceneKey, startX, startY, direction, moving);
@@ -114,9 +114,9 @@ export class GameManager {
      * Share group position in game
      */
     shareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface): void {
-        if (this.status === StatusGameManagerEnum.IN_PROGRESS) {
+        /*if (this.status === StatusGameManagerEnum.IN_PROGRESS) {
             return;
-        }
+        }*/
         try {
             this.currentGameScene.shareGroupPosition(groupPositionMessage)
         } catch (e) {
@@ -125,9 +125,9 @@ export class GameManager {
     }
 
     deleteGroup(groupId: string): void {
-        if (this.status === StatusGameManagerEnum.IN_PROGRESS) {
+        /*if (this.status === StatusGameManagerEnum.IN_PROGRESS) {
             return;
-        }
+        }*/
         try {
             this.currentGameScene.deleteGroup(groupId)
         } catch (e) {
index b7afed02a1442bbf6bac1119e3784730038c5b28..41f6f212e2f957ccefe0dad35b0641c52411748b 100644 (file)
@@ -145,7 +145,7 @@ export class GameScene extends Phaser.Scene {
         this.MapPlayers = this.physics.add.group({ immovable: true });
 
         //notify game manager can to create currentUser in map
-        this.GameManager.createCurrentPlayer();
+        this.createCurrentPlayer();
 
         //initialise camera
         this.initCamera();