change event dispatcher

This commit is contained in:
2025-11-11 15:15:13 +02:00
parent 35fa1863ff
commit 351c6097f3
10 changed files with 71 additions and 67 deletions
@@ -1,5 +1,6 @@
import { MazeObject } from "./MazeObject";
import Utils from "@/lib/Utils";
import { EventDispatcher } from "three";
const params = {
scale: 5,
@@ -34,7 +35,7 @@ const defaults = {
const tl = 4;
class MazeQuizGame {
class MazeQuizGame extends EventDispatcher {
constructor(engine, data) {
data.noPhysics = true;
return new Promise(async (resolve, reject)=>{
@@ -57,7 +58,7 @@ class MazeQuizGame {
engine.hero.characterControls.direction += Math.PI;
//engine.hero.model.rotation.y += Math.PI;
await Utils.wait(10000);
this.onfinish?.()
this.dispatchEvent({type:'finish'})
}else{
engine.hero.animationsMap.idle = engine.hero.animationsMap._idle
engine.hero.characterControls.cameraDelta = 0