This commit is contained in:
2024-08-07 09:45:15 +02:00
commit 9d7b1e71ce
88 changed files with 21647 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
import { World } from "@minecraft/server";
class Level {
levelCompleteCallback: Function;
levelCheckCallback: Function;
levelSetupCallback: Function;
levelUpdateCallback: Function;
levelResetCallback: Function;
isCompleted: boolean = false;
isSetup: boolean = false;
constructor(
levelSetupCallback: Function,
levelUpdateCallback: Function,
levelCompleteCallback: Function,
levelCheckCallback: Function,
levelResetCallback: Function = () => {}
) {
this.levelSetupCallback = levelSetupCallback;
this.levelCompleteCallback = levelCompleteCallback;
this.levelCheckCallback = levelCheckCallback;
this.levelUpdateCallback = levelUpdateCallback;
this.levelResetCallback = levelResetCallback;
}
setup() {
this.levelSetupCallback();
}
update() {
if (!this.isSetup) {
this.setup();
this.isSetup = true;
}
this.levelUpdateCallback();
if (this.levelCheckCallback() && !this.isCompleted) {
this.levelCompleteCallback();
this.isCompleted = true;
}
}
reset() {
this.levelResetCallback();
this.isCompleted = false;
}
}
//nextlevel
//mindkeeper
//pupeteer
export default Level;