Add NPC FSM
Some checks failed
Accessibility Checks / a11y-audit (pull_request) Failing after 2s
Smoke Test / smoke (pull_request) Failing after 4s

This commit is contained in:
2026-04-12 16:15:31 +00:00
parent 4ee5819398
commit 58c55176ae

18
game/npc-logic.js Normal file
View File

@@ -0,0 +1,18 @@
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;