Manage multi scene

- Create position and check if user is in position to switch in the next scene.
 - When scene is load, we load all scene in the layer of name "exit".
 - Layer "exit" of map.json have a parametter "exitSceneKey" to identify next scene.
 - Add layer "start", the player could start in the scene on the object present in the layer of name "start".
This commit is contained in:
gparant
2020-05-09 21:28:50 +02:00
parent fb8d9bf9a8
commit 27c6034661
6 changed files with 162 additions and 26 deletions
+9 -2
View File
@@ -18,6 +18,11 @@ export interface HasMovedEvent {
character: string;
}
export interface MapObject {
key: string,
url: string
}
export class GameManager {
status: number;
private ConnexionInstance: Connexion;
@@ -25,6 +30,7 @@ export class GameManager {
private playerName: string;
SimplePeer : SimplePeerInterface;
private characterUserSelected: string;
Maps: Array<MapObject>;
constructor() {
this.status = StatusGameManagerEnum.IN_PROGRESS;
@@ -43,8 +49,9 @@ export class GameManager {
}
loadMaps(){
return this.ConnexionInstance.loadMaps().then((maps) => {
return maps;
return this.ConnexionInstance.loadMaps().then((data) => {
this.Maps = data.maps;
return data;
}).catch((err) => {
throw err;
});