Added real-time game timer that starts when VR headset tracking is active. **Modified: src/ship.ts** - Added public getter for gameStats to allow Level1 to access it **Modified: src/level1.ts** - Call ship.gameStats.startTimer() in onInitialXRPoseSetObservable - Timer starts when XR pose is set (when VR tracking begins) - Added debug log to confirm timer start The Game Time statistic now tracks actual play time from when the user enters VR, displayed in MM:SS format on the status screen. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
854f43ecf3
commit
ff9d9faa2a
@ -43,6 +43,11 @@ export class Level1 implements Level {
|
||||
xr.baseExperience.camera.parent = this._ship.transformNode;
|
||||
const currPose = xr.baseExperience.camera.globalPosition.y;
|
||||
xr.baseExperience.camera.position = new Vector3(0, 0, 0);
|
||||
|
||||
// Start game timer when XR pose is set
|
||||
this._ship.gameStats.startTimer();
|
||||
debugLog('Game timer started');
|
||||
|
||||
const observer = xr.input.onControllerAddedObservable.add((controller) => {
|
||||
debugLog('🎮 onControllerAddedObservable FIRED for:', controller.inputSource.handedness);
|
||||
this._ship.addController(controller);
|
||||
|
||||
@ -59,6 +59,10 @@ export class Ship {
|
||||
return this._scoreboard;
|
||||
}
|
||||
|
||||
public get gameStats(): GameStats {
|
||||
return this._gameStats;
|
||||
}
|
||||
|
||||
public set position(newPosition: Vector3) {
|
||||
const body = this._ship.physicsBody;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user