mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-10 17:39:31 +02:00
* Standardize filenames to kebab-case Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com> * Move script outside of public folder * Move update_exp_sprites to scripts * Add ls-lint to lint file and directory names * Update lefthook.yml to skip merge / rebase on all pre-commit commands --------- Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>
25 lines
737 B
TypeScript
25 lines
737 B
TypeScript
import Phaser from "phaser";
|
|
|
|
const Clock = Phaser.Time.Clock;
|
|
|
|
export class MockClock extends Clock {
|
|
public overrideDelay: number | null = 1;
|
|
constructor(scene) {
|
|
super(scene);
|
|
setInterval(() => {
|
|
/*
|
|
To simulate frame update
|
|
eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this);
|
|
eventEmitter.on(SceneEvents.UPDATE, this.update, this);
|
|
*/
|
|
this.preUpdate(this.systems.game.loop.time, 1);
|
|
this.update(this.systems.game.loop.time, 1);
|
|
}, 1);
|
|
}
|
|
|
|
addEvent(config: Phaser.Time.TimerEvent | Phaser.Types.Time.TimerEventConfig): Phaser.Time.TimerEvent {
|
|
const cfg = { ...config, delay: this.overrideDelay ?? config.delay };
|
|
return super.addEvent(cfg);
|
|
}
|
|
}
|