39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import type Phaser from 'phaser'
|
|
import { EnemyBase, type PathPoint } from './EnemyBase'
|
|
import { getRandomQuote } from '../data/quotes'
|
|
|
|
export class OldEmployee extends EnemyBase {
|
|
constructor(scene: Phaser.Scene, pathPoints: PathPoint[]) {
|
|
super(scene, pathPoints, 150, 50, 8, 30)
|
|
this.shieldCount = 3
|
|
this.drawSprite()
|
|
}
|
|
|
|
drawSprite(): void {
|
|
if (!this.sprite) return
|
|
this.sprite.clear()
|
|
// 大蓝方块
|
|
this.sprite.fillStyle(0x93c5fd, 1)
|
|
this.sprite.fillRect(-10, -10, 20, 20)
|
|
// 护盾外框(金色)
|
|
this.sprite.lineStyle(2, 0xfbbf24, 0.8)
|
|
this.sprite.strokeRect(-12, -12, 24, 24)
|
|
this.sprite.setDepth(10)
|
|
this.sprite.setPosition(this.x, this.y)
|
|
}
|
|
|
|
override drawHealthBar(): void {
|
|
super.drawHealthBar()
|
|
// 绘制护盾数量标记
|
|
if (!this.healthBar) return
|
|
for (let i = 0; i < this.shieldCount; i++) {
|
|
this.healthBar.fillStyle(0xfbbf24, 1)
|
|
this.healthBar.fillRect(this.x - 15 + i * 11, this.y - 28, 8, 4)
|
|
}
|
|
}
|
|
|
|
getQuote(): string {
|
|
return getRandomQuote('OldEmployee')
|
|
}
|
|
}
|