diff --git a/src/levels/hints/levelHintSystem.ts b/src/levels/hints/levelHintSystem.ts index c63e721..9f836b0 100644 --- a/src/levels/hints/levelHintSystem.ts +++ b/src/levels/hints/levelHintSystem.ts @@ -146,6 +146,16 @@ export class LevelHintSystem { } } + /** + * Trigger mission brief shown hints - call when mission brief is displayed + */ + public triggerMissionBriefShown(): void { + const hints = this._hints.filter(h => h.eventType === 'mission_brief_shown'); + for (const hint of hints) { + this.queueHint(hint); + } + } + /** * Queue a hint for audio playback */ diff --git a/src/levels/level1.ts b/src/levels/level1.ts index 9cfe6b5..5406581 100644 --- a/src/levels/level1.ts +++ b/src/levels/level1.ts @@ -239,6 +239,9 @@ export class Level1 implements Level { inputManager.enableShipControls("MissionBrief"); this.startGameplay(); }); + + // Trigger mission brief hints (e.g., welcome_rookie audio) + this._hintSystem?.triggerMissionBriefShown(); } /** diff --git a/src/services/hintService.ts b/src/services/hintService.ts index 460036e..1c31586 100644 --- a/src/services/hintService.ts +++ b/src/services/hintService.ts @@ -7,7 +7,7 @@ import log from '../core/logger'; export interface HintEntry { id: string; levelId: string; - eventType: 'ship_status' | 'asteroid_destroyed' | 'collision'; + eventType: 'ship_status' | 'asteroid_destroyed' | 'collision' | 'mission_brief_shown'; eventConfig: Record; audioUrl: string; playMode: 'once' | 'always'; diff --git a/src/ui/hud/missionBrief.ts b/src/ui/hud/missionBrief.ts index bcaaa97..2a0267e 100644 --- a/src/ui/hud/missionBrief.ts +++ b/src/ui/hud/missionBrief.ts @@ -8,7 +8,7 @@ import { } from "@babylonjs/gui"; import { DefaultScene } from "../../core/defaultScene"; import {MeshBuilder, Vector3, Observable, Observer} from "@babylonjs/core"; -import type { AudioEngineV2, StaticSound } from "@babylonjs/core"; +import type { AudioEngineV2 } from "@babylonjs/core"; import log from '../../core/logger'; import { LevelConfig } from "../../levels/config/levelConfig"; import { CloudLevelEntry } from "../../services/cloudLevelService"; @@ -24,7 +24,6 @@ export class MissionBrief { private _onStartCallback: (() => void) | null = null; private _triggerObserver: Observer | null = null; private _audioEngine: AudioEngineV2 | null = null; - private _currentSound: StaticSound | null = null; /** * Initialize the mission brief as a fullscreen overlay @@ -236,21 +235,6 @@ export class MissionBrief { this._container.isVisible = true; this._isVisible = true; - // Play mission brief audio if specified - if (directoryEntry?.missionBriefAudio && this._audioEngine) { - log.info('[MissionBrief] Playing audio:', directoryEntry.missionBriefAudio); - this._audioEngine.createSoundAsync( - "missionBriefAudio", - directoryEntry.missionBriefAudio, - { loop: false, volume: 1.0 } - ).then(sound => { - this._currentSound = sound; - sound.play(); - }).catch(err => { - log.error('[MissionBrief] Failed to load audio:', err); - }); - } - log.info('[MissionBrief] ========== CONTAINER NOW VISIBLE =========='); log.info('[MissionBrief] Container.isVisible:', this._container.isVisible); log.info('[MissionBrief] _isVisible flag:', this._isVisible); @@ -317,10 +301,6 @@ export class MissionBrief { * Clean up resources */ public dispose(): void { - if (this._currentSound) { - this._currentSound.dispose(); - this._currentSound = null; - } if (this._advancedTexture) { this._advancedTexture.dispose(); this._advancedTexture = null;