new structure, spawner, rebind

This commit is contained in:
Martin
2022-11-08 19:45:57 +01:00
parent 5b098af31d
commit 279218b4c3
45 changed files with 1157 additions and 302 deletions

View File

@@ -0,0 +1,21 @@
export class GameTimer {
private targetDelay: number;
private currentDelay = 0;
public constructor(targetDelay: number) {
this.targetDelay = targetDelay;
}
public gameTick(deltaTime: number): void {
this.currentDelay += deltaTime;
}
public tryFinishPeriod(): boolean {
if (this.targetDelay <= this.currentDelay) {
this.currentDelay = 0;
return true;
} else {
return false;
}
}
}