From 7e526e18c13fb153e337ca9c887679114cbed0f0 Mon Sep 17 00:00:00 2001 From: Praccen Date: Mon, 2 Oct 2023 22:51:27 +0200 Subject: [PATCH] Made pointlights dissapear with character when ascending. Fixed bot number in lobby. --- code/src/Game/OpponentCharacter.ts | 1 + code/src/Game/PlayerCharacter.ts | 5 +---- code/src/Game/States/LobbyState.ts | 6 ++++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/src/Game/OpponentCharacter.ts b/code/src/Game/OpponentCharacter.ts index 0900e71..b6583ac 100755 --- a/code/src/Game/OpponentCharacter.ts +++ b/code/src/Game/OpponentCharacter.ts @@ -45,6 +45,7 @@ export default class OpponentCharacter extends Character { character_specific_accended_operations(dt) { // this.allCharacterDict["bots"].remove(this.bot_number); this.ecsManager.removeEntity(this.bodyEntity.id); + this.ecsManager.removeEntity(this.fireEntity.id); } accend() { diff --git a/code/src/Game/PlayerCharacter.ts b/code/src/Game/PlayerCharacter.ts index 5f5801e..5f84a48 100644 --- a/code/src/Game/PlayerCharacter.ts +++ b/code/src/Game/PlayerCharacter.ts @@ -23,10 +23,7 @@ export default class PlayerCharacter extends Character { } character_specific_accended_operations(dt) { - let particleSpawnerComp = this.fireEntity.getComponent( - ComponentTypeEnum.PARTICLESPAWNER - ) as ParticleSpawnerComponent; - particleSpawnerComp.destructor(); + this.ecsManager.removeEntity(this.fireEntity.id); this.ecsManager.removeEntity(this.bodyEntity.id); } diff --git a/code/src/Game/States/LobbyState.ts b/code/src/Game/States/LobbyState.ts index ac2532d..16776a4 100644 --- a/code/src/Game/States/LobbyState.ts +++ b/code/src/Game/States/LobbyState.ts @@ -74,7 +74,7 @@ export default class LobbyState extends State { this.addBotButton.position.y = 0.7; this.addBotButton.textString = "Add bot"; this.addBotButton.onClick(() => { - this.addParticipant("Bot " + Game.getInstanceNoSa().num_bots++); + this.addParticipant("Bot " + Game.getInstanceNoSa().num_bots); }); this.removeParticipantButton = this.overlay.getNewButton(); @@ -86,7 +86,7 @@ export default class LobbyState extends State { if (length > 2) { this.participantsDiv.children[length - 1].remove(); this.participantsDiv.children.pop(); - Game.getInstanceNoSa().num_bots--; + Game.getInstanceNoSa().num_bots = this.participantsDiv.children.length - 2; } }); } @@ -94,11 +94,13 @@ export default class LobbyState extends State { private addParticipant(name: string) { let participantText = this.overlay.getNew2DText(this.participantsDiv); participantText.textString = name; + Game.getInstanceNoSa().num_bots = this.participantsDiv.children.length - 2; } async init() { super.init(); this.overlay.show(); + Game.getInstanceNoSa().num_bots = this.participantsDiv.children.length - 2; } reset() {