26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
/**
|
|
* ╔══════════════════════════════════════════════════════════════╗
|
|
* ║ DORMANT PROTOTYPE ║
|
|
* ║ This file is not part of the active architecture. ║
|
|
* ║ Preserved for reference only. See active game logic elsewhere. ║
|
|
* ╚══════════════════════════════════════════════════════════════╝
|
|
*/
|
|
|
|
class NPCStateMachine {
|
|
constructor(states) {
|
|
this.states = states;
|
|
this.current = 'idle';
|
|
}
|
|
update(context) {
|
|
const state = this.states[this.current];
|
|
for (const transition of state.transitions) {
|
|
if (transition.condition(context)) {
|
|
this.current = transition.target;
|
|
console.log(`NPC transitioned to ${this.current}`);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
export default NPCStateMachine;
|