mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-31 15:09:26 +08:00
fix: boss战中读档
This commit is contained in:
parent
16b6337f2a
commit
dbbc0f0d76
@ -2,9 +2,15 @@ import { MotaOffscreenCanvas2D } from '@/core/fx/canvas2d';
|
||||
import { RenderItem, RenderItemPosition } from '@/core/render/item';
|
||||
import { Transform } from '@/core/render/transform';
|
||||
import { IStateDamageable } from '@/game/state/interface';
|
||||
import EventEmitter from 'eventemitter3';
|
||||
import { Ticker } from 'mutate-animate';
|
||||
|
||||
export abstract class BarrageBoss {
|
||||
interface BarrageBossEvent {
|
||||
end: [];
|
||||
start: [];
|
||||
}
|
||||
|
||||
export abstract class BarrageBoss extends EventEmitter<BarrageBossEvent> {
|
||||
ticker: Ticker = new Ticker();
|
||||
/** 这个boss的所有弹幕 */
|
||||
projectiles: Set<Projectile> = new Set();
|
||||
|
@ -1,13 +1,22 @@
|
||||
import { BarrageBoss } from './barrage';
|
||||
import { TowerBoss } from './towerBoss';
|
||||
|
||||
let boss: BarrageBoss;
|
||||
let boss: BarrageBoss | null;
|
||||
|
||||
export function startTowerBoss() {
|
||||
boss = new TowerBoss();
|
||||
boss.start();
|
||||
boss.once('end', () => {
|
||||
boss = null;
|
||||
});
|
||||
}
|
||||
|
||||
export function getBoss<T extends BarrageBoss>(): T {
|
||||
export function getBoss<T extends BarrageBoss>(): T | null {
|
||||
return boss as T;
|
||||
}
|
||||
|
||||
Mota.require('var', 'hook').on('reset', () => {
|
||||
if (boss) {
|
||||
boss.end();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user