Files
WarhammerQuest/src/engine/game/TurnManager.js
marti 9234a2e3a0 feat: Implement door interaction system and UI improvements
- Add interactive door system with click detection on door meshes
- Create custom DoorModal component replacing browser confirm()
- Implement door opening with texture change to door1_open.png
- Add additive door rendering to preserve opened doors
- Remove exploration button and requestExploration method
- Implement camera orbit controls with smooth animations
- Add active view indicator (yellow highlight) on camera buttons
- Add vertical zoom slider with label
- Fix camera to maintain isometric perspective while rotating
- Integrate all systems into main game loop
2026-01-01 17:16:58 +01:00

66 lines
2.0 KiB
JavaScript

import { GAME_PHASES, GAME_EVENTS } from './GameConstants.js';
export class TurnManager {
constructor() {
this.currentTurn = 0;
this.currentPhase = GAME_PHASES.SETUP;
this.listeners = {}; // Simple event system
}
startGame() {
this.currentTurn = 1;
this.setPhase(GAME_PHASES.HERO); // Jump straight to Hero phase for now
console.log(`--- TURN ${this.currentTurn} START ---`);
}
nextPhase() {
// Simple sequential flow for now
switch (this.currentPhase) {
case GAME_PHASES.POWER:
this.setPhase(GAME_PHASES.HERO);
break;
case GAME_PHASES.HERO:
// Usually goes to Exploration if at edge, or Monster if not.
// For this dev stage, let's allow manual triggering of Exploration
// via UI, so we stay in HERO until confirmed done.
this.setPhase(GAME_PHASES.MONSTER);
break;
case GAME_PHASES.MONSTER:
this.endTurn();
break;
// Exploration is usually triggered as an interrupt, not strictly sequential
}
}
setPhase(phase) {
if (this.currentPhase !== phase) {
console.log(`Phase Switch: ${this.currentPhase} -> ${phase}`);
this.currentPhase = phase;
this.emit(GAME_EVENTS.PHASE_CHANGED, phase);
}
}
triggerExploration() {
this.setPhase(GAME_PHASES.EXPLORATION);
// Logic to return to HERO phase would handle elsewhere
}
endTurn() {
console.log(`--- TURN ${this.currentTurn} END ---`);
this.currentTurn++;
this.setPhase(GAME_PHASES.POWER);
}
// -- Simple Observer Pattern --
on(event, callback) {
if (!this.listeners[event]) this.listeners[event] = [];
this.listeners[event].push(callback);
}
emit(event, data) {
if (this.listeners[event]) {
this.listeners[event].forEach(cb => cb(data));
}
}
}