chore: sync latest changes
This commit is contained in:
@@ -5,6 +5,7 @@ import { StateManager } from './StateManager'
|
||||
import { ChoiceSystem } from '../systems/ChoiceSystem'
|
||||
import { QTESystem } from '../systems/QTESystem'
|
||||
import { AudioSystem } from '../systems/AudioSystem'
|
||||
import { AchievementSystem } from '../systems/AchievementSystem'
|
||||
|
||||
type EventHandler = (...args: any[]) => void
|
||||
|
||||
@@ -15,6 +16,7 @@ export class Engine {
|
||||
choiceSystem: ChoiceSystem
|
||||
qteSystem: QTESystem
|
||||
audioSystem: AudioSystem
|
||||
achievementSystem: AchievementSystem
|
||||
|
||||
private currentScene: SceneNode | null = null
|
||||
private events: Map<EngineEvent, Set<EventHandler>> = new Map()
|
||||
@@ -42,6 +44,11 @@ export class Engine {
|
||||
this.choiceSystem = new ChoiceSystem()
|
||||
this.qteSystem = new QTESystem()
|
||||
this.audioSystem = new AudioSystem()
|
||||
this.achievementSystem = new AchievementSystem()
|
||||
|
||||
this.stateManager.onAfterApply = (vars) => {
|
||||
this.achievementSystem.check(vars)
|
||||
}
|
||||
|
||||
this.videoManager.onTimeUpdate(this.onTimeUpdate)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ export class StateManager {
|
||||
variables: Record<string, number> = {}
|
||||
flags: Set<string> = new Set()
|
||||
history: ChoiceRecord[] = []
|
||||
onAfterApply: ((variables: Record<string, number>) => void) | null = null
|
||||
|
||||
init(initialVars: Record<string, number>) {
|
||||
this.variables = { ...initialVars }
|
||||
@@ -72,6 +73,7 @@ export class StateManager {
|
||||
break
|
||||
}
|
||||
}
|
||||
this.onAfterApply?.(this.variables)
|
||||
}
|
||||
|
||||
recordChoice(choice: ChoiceRecord) {
|
||||
|
||||
Reference in New Issue
Block a user