actions reactored. multi-tick action support
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user