Merge remote-tracking branch 'origin/metadataScriptingApi' into metadataScriptingApi
This commit is contained in:
commit
b4fa38bf8c
4 changed files with 14 additions and 45 deletions
|
@ -10,6 +10,6 @@ export const isGameStateEvent =
|
|||
tags : tg.isArray(tg.isString),
|
||||
}).get();
|
||||
/**
|
||||
* A message sent from the game to the iFrame when the gameState is got by the script
|
||||
* A message sent from the game to the iFrame when the gameState is received by the script
|
||||
*/
|
||||
export type GameStateEvent = tg.GuardedType<typeof isGameStateEvent>;
|
||||
export type GameStateEvent = tg.GuardedType<typeof isGameStateEvent>;
|
||||
|
|
|
@ -11,7 +11,7 @@ export const isHasPlayerMovedEvent =
|
|||
}).get();
|
||||
|
||||
/**
|
||||
* A message sent from the game to the iFrame when the player move after the iFrame send a message to the game that it want to listen to the position of the player
|
||||
* A message sent from the game to the iFrame to notify a movement from the current player.
|
||||
*/
|
||||
export type HasPlayerMovedEvent = tg.GuardedType<typeof isHasPlayerMovedEvent>;
|
||||
|
||||
|
|
|
@ -117,41 +117,14 @@ export class GameMap {
|
|||
}
|
||||
|
||||
public findLayer(layerName: string): ITiledMapLayer | undefined {
|
||||
let i = 0;
|
||||
let found = false;
|
||||
while (!found && i<this.flatLayers.length) {
|
||||
if (this.flatLayers[i].name === layerName) {
|
||||
found = true;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
return this.flatLayers[i];
|
||||
}
|
||||
return undefined;
|
||||
return this.flatLayers.find((layer) => layer.name = layerName);
|
||||
}
|
||||
|
||||
public findPhaserLayer(layerName: string): TilemapLayer | undefined {
|
||||
let i = 0;
|
||||
let found = false;
|
||||
while (!found && i<this.phaserLayers.length) {
|
||||
if (this.phaserLayers[i].layer.name === layerName) {
|
||||
found = true;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
return this.phaserLayers[i];
|
||||
}
|
||||
return undefined;
|
||||
return this.phaserLayers.find((layer) => layer.layer.name = layerName);
|
||||
}
|
||||
|
||||
public addTerrain(terrain : Phaser.Tilemaps.Tileset): void {
|
||||
console.log('Add');
|
||||
for (const phaserLayer of this.phaserLayers) {
|
||||
phaserLayer.tileset.push(terrain);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue