Merge pull request #83 from thecodingmachine/cleanup_rename_frame

Cleanup: renaming "frame" to "character"
This commit is contained in:
David Négrier 2020-05-08 16:21:16 +02:00 committed by GitHub
commit c59d693f6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 49 deletions

View file

@ -18,7 +18,7 @@ export interface HasMovedEvent {
direction: string;
x: number;
y: number;
frame: string;
character: string;
}
export class GameManager {
@ -27,17 +27,17 @@ export class GameManager {
private currentGameScene: GameScene;
private playerName: string;
SimplePeer : SimplePeerInterface;
private frameUserSelected: string;
private characterUserSelected: string;
constructor() {
this.status = StatusGameManagerEnum.IN_PROGRESS;
}
connect(name: string, frameUserSelected : string) {
connect(name: string, characterUserSelected : string) {
this.playerName = name;
this.frameUserSelected = frameUserSelected;
this.characterUserSelected = characterUserSelected;
this.ConnexionInstance = new Connexion(name, this);
return this.ConnexionInstance.createConnexion(frameUserSelected).then(() => {
return this.ConnexionInstance.createConnexion(characterUserSelected).then(() => {
this.SimplePeer = new SimplePeer(this.ConnexionInstance);
});
}
@ -100,12 +100,12 @@ export class GameManager {
return this.playerName;
}
getFrameSelected(): string {
return this.frameUserSelected;
getCharacterSelected(): string {
return this.characterUserSelected;
}
pushPlayerPosition(event: HasMovedEvent) {
this.ConnexionInstance.sharePosition(event.x, event.y, event.frame, event.direction);
this.ConnexionInstance.sharePosition(event.x, event.y, event.character, event.direction);
}
}

View file

@ -192,7 +192,7 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
this.startX,
this.startY,
this.GameManager.getPlayerName(),
this.GameManager.getFrameSelected()
this.GameManager.getCharacterSelected()
);
this.CurrentPlayer.initAnimation();
@ -286,16 +286,16 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
MessageUserPosition.position.x,
MessageUserPosition.position.y,
MessageUserPosition.name,
MessageUserPosition.frame
MessageUserPosition.character
);
player.initAnimation();
this.MapPlayers.add(player);
player.updatePosition(MessageUserPosition);
//init colision
this.physics.add.collider(this.CurrentPlayer, player, (CurrentPlayer: CurrentGamerInterface, MapPlayer: GamerInterface) => {
//init collision
/*this.physics.add.collider(this.CurrentPlayer, player, (CurrentPlayer: CurrentGamerInterface, MapPlayer: GamerInterface) => {
CurrentPlayer.say("Hello, how are you ? ");
});
});*/
}
shareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface) {

View file

@ -83,12 +83,12 @@ export class Player extends PlayableCaracter implements CurrentGamerInterface, G
}
if (x !== 0 || y !== 0) {
this.move(x, y);
this.emit(hasMovedEventName, {direction, x: this.x, y: this.y, frame: this.PlayerTexture});
this.emit(hasMovedEventName, {direction, x: this.x, y: this.y, character: this.PlayerTexture});
} else {
if (this.previousMove !== PlayerAnimationNames.None) {
direction = PlayerAnimationNames.None;
this.stop();
this.emit(hasMovedEventName, {direction, x: this.x, y: this.y, frame: this.PlayerTexture});
this.emit(hasMovedEventName, {direction, x: this.x, y: this.y, character: this.PlayerTexture});
}
}