Merge branch 'master' into webrtc
authorgparant <g.parant@thecodingmachine.com>
Sat, 2 May 2020 18:51:49 +0000 (20:51 +0200)
committergparant <g.parant@thecodingmachine.com>
Sat, 2 May 2020 18:51:49 +0000 (20:51 +0200)
# Conflicts:
# front/src/Phaser/Player/Player.ts

1  2 
front/src/Phaser/Player/Player.ts

index 59c1f96ed33e3047f1bcfa2495cfcb096416520b,4f5e790a950246c997e6524c046ca911bc6885f2..8c4688b8085d8f3cc5574f1142654ad8828f4ed8
@@@ -89,18 -89,11 +90,11 @@@ export class Player extends PlayableCar
              direction = PlayerAnimationNames.None;
              this.stop();
          }
-         if(this.previousMove !== PlayerAnimationNames.None || direction !== PlayerAnimationNames.None){
-             this.sharePosition(direction);
-         }
-         this.previousMove = direction;
-     }
 -        
 +
-     private sharePosition(direction: string) {
-         if (ConnexionInstance) {
-             ConnexionInstance.sharePosition(this.x, this.y, direction);
-         }
+         this.emit(hasMovedEventName, {direction, x: this.x, y: this.y});
      }
  
+     //todo: put this method into the NonPlayer class instead
      updatePosition(MessageUserPosition: MessageUserPositionInterface) {
          playAnimation(this, MessageUserPosition.position.direction);
          this.setX(MessageUserPosition.position.x);