17 lines
521 B
TypeScript
17 lines
521 B
TypeScript
import { ScriptAction, type ScriptCoroutineContext } from "../../types";
|
|
|
|
export class WaitSecondsScriptAction extends ScriptAction {
|
|
|
|
private remaining: number;
|
|
|
|
constructor(coroutine: ScriptCoroutineContext, seconds: number) {
|
|
super(coroutine);
|
|
this.remaining = seconds;
|
|
}
|
|
|
|
public tick(deltaTime: number): boolean {
|
|
this.remaining -= deltaTime; // TODO should only consume as much time as needed and pass the remainder to next actions
|
|
return this.remaining <= 0;
|
|
}
|
|
}
|