transmit companion to remote players
This commit is contained in:
@@ -159,6 +159,7 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
private openChatIcon!: OpenChatIcon;
|
||||
private playerName!: string;
|
||||
private characterLayers!: string[];
|
||||
private companion!: string|null;
|
||||
private messageSubscription: Subscription|null = null;
|
||||
private popUpElements : Map<number, DOMElement> = new Map<number, Phaser.GameObjects.DOMElement>();
|
||||
|
||||
@@ -335,7 +336,7 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
}
|
||||
this.playerName = playerName;
|
||||
this.characterLayers = gameManager.getCharacterLayers();
|
||||
|
||||
this.companion = gameManager.getCompanion();
|
||||
|
||||
//initalise map
|
||||
this.Map = this.add.tilemap(this.MapUrlFile);
|
||||
@@ -459,7 +460,9 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
top: camera.scrollY,
|
||||
right: camera.scrollX + camera.width,
|
||||
bottom: camera.scrollY + camera.height,
|
||||
}).then((onConnect: OnConnectInterface) => {
|
||||
},
|
||||
this.companion
|
||||
).then((onConnect: OnConnectInterface) => {
|
||||
this.connection = onConnect.connection;
|
||||
|
||||
this.connection.onUserJoins((message: MessageUserJoined) => {
|
||||
@@ -467,7 +470,8 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
userId: message.userId,
|
||||
characterLayers: message.characterLayers,
|
||||
name: message.name,
|
||||
position: message.position
|
||||
position: message.position,
|
||||
companion: message.companion
|
||||
}
|
||||
this.addPlayer(userMessage);
|
||||
});
|
||||
@@ -1019,7 +1023,8 @@ ${escapedMessage}
|
||||
texturesPromise,
|
||||
PlayerAnimationDirections.Down,
|
||||
false,
|
||||
this.userInputManager
|
||||
this.userInputManager,
|
||||
this.companion
|
||||
);
|
||||
}catch (err){
|
||||
if(err instanceof TextureError) {
|
||||
@@ -1211,7 +1216,8 @@ ${escapedMessage}
|
||||
addPlayerData.name,
|
||||
texturesPromise,
|
||||
addPlayerData.position.direction as PlayerAnimationDirections,
|
||||
addPlayerData.position.moving
|
||||
addPlayerData.position.moving,
|
||||
addPlayerData.companion
|
||||
);
|
||||
this.MapPlayers.add(player);
|
||||
this.MapPlayersByKey.set(player.userId, player);
|
||||
|
||||
Reference in New Issue
Block a user