Files
test1/game/enemies/TroubleMaker.ts

26 lines
910 B
TypeScript

import type Phaser from 'phaser'
import { EnemyBase, type PathPoint } from './EnemyBase'
import { GameManager } from '../GameManager'
import { getRandomQuote } from '../data/quotes'
export class TroubleMaker extends EnemyBase {
constructor(scene: Phaser.Scene, pathPoints: PathPoint[]) {
super(scene, pathPoints, 80, 80, 5, 20, 'enemy-trouble')
}
protected override onDeath(): void {
GameManager.getInstance().spendHC(20)
const txt = this.scene.add
.text(this.x, this.y - 20, '劳动仲裁! -20HC', {
fontFamily: 'VT323, monospace', fontSize: '16px',
color: '#FCA5A5', backgroundColor: '#7F1D1D', padding: { x: 4, y: 2 },
}).setOrigin(0.5, 1).setDepth(25)
this.scene.tweens.add({
targets: txt, y: this.y - 50, alpha: 0,
duration: 1500, onComplete: () => txt.destroy(),
})
}
getQuote(): string { return getRandomQuote('TroubleMaker') }
}