Add scene heartbeat diagnostics
This commit is contained in:
parent
bc2e37bf2f
commit
dc0b7f9591
@ -46,6 +46,7 @@ class GameScene extends Phaser.Scene {
|
||||
this.lastPlayerShot = 0;
|
||||
this.lastPlayerHitAt = -Infinity;
|
||||
this.pendingPlayerHits = [];
|
||||
this.lastDiagnosticsAt = -Infinity;
|
||||
this.wave = 1;
|
||||
this.defeated = 0;
|
||||
|
||||
@ -354,6 +355,20 @@ class GameScene extends Phaser.Scene {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.time.now - this.lastDiagnosticsAt >= 1000) {
|
||||
this.lastDiagnosticsAt = this.time.now;
|
||||
airshipLog('scene:heartbeat', {
|
||||
gameState: this.gameState,
|
||||
hull: this.playerHull,
|
||||
pendingHits: this.pendingPlayerHits.length,
|
||||
activePirates: this.pirates?.countActive?.(true) || 0,
|
||||
playerShots: this.playerShots?.countActive?.(true) || 0,
|
||||
pirateShots: this.pirateShots?.countActive?.(true) || 0,
|
||||
wave: this.wave,
|
||||
now: this.time.now,
|
||||
}, 'debug');
|
||||
}
|
||||
|
||||
this.updatePlayer(dt, deltaMs);
|
||||
this.updatePirates(dt);
|
||||
this.updateProjectiles();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user