Skip to content

Commit

Permalink
game container check
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud.gregoire committed Oct 28, 2021
1 parent 33c7550 commit 5e7d5fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions app/public/src/game/game-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,16 @@ class GameContainer {

handlePokemonAdd(playerId, pokemon) {
// console.log('simulation add' + pokemon.name);
this.game.scene.getScene('gameScene').battleManager.addPokemon(playerId, pokemon);
if(this.game && this.game.scene && this.game.scene.getScene('gameScene') && this.game.scene.getScene('gameScene').battleManager){
this.game.scene.getScene('gameScene').battleManager.addPokemon(playerId, pokemon);
}
}

handlePokemonRemove(playerId, pokemon) {
// console.log('simulation remove' + pokemon.name);
this.game.scene.getScene('gameScene').battleManager.removePokemon(playerId, pokemon);
if(this.game && this.game.scene && this.game.scene.getScene('gameScene') && this.game.scene.getScene('gameScene').battleManager){
this.game.scene.getScene('gameScene').battleManager.removePokemon(playerId, pokemon);
}
}

handleStuffChange(change, player) {
Expand All @@ -176,11 +180,15 @@ class GameContainer {

handlePokemonChange(playerId, change, pokemon) {
// console.log('simulation change' + change.field);
this.game.scene.getScene('gameScene').battleManager.changePokemon(playerId, change, pokemon);
if(this.game && this.game.scene && this.game.scene.getScene('gameScene') && this.game.scene.getScene('gameScene').battleManager){
this.game.scene.getScene('gameScene').battleManager.changePokemon(playerId, change, pokemon);
}
}

handlePokemonItemsChange(playerId, change, pokemon) {
this.game.scene.getScene('gameScene').battleManager.changePokemonItems(playerId, change, pokemon);
if(this.game && this.game.scene && this.game.scene.getScene('gameScene') && this.game.scene.getScene('gameScene').battleManager){
this.game.scene.getScene('gameScene').battleManager.changePokemonItems(playerId, change, pokemon);
}
}


Expand Down
2 changes: 1 addition & 1 deletion app/public/src/game/scenes/game-scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export default class GameScene extends Scene {

this.input.on('drop', (pointer, gameObject, dropZone) => {
this.removeRectangles();
console.log(dropZone.name);
//console.log(dropZone.name);
if (dropZone.name == 'sell-zone') {
if (gameObject.objType == 'item') {
this.itemsContainer.updateItem(gameObject.place);
Expand Down

0 comments on commit 5e7d5fa

Please sign in to comment.