feat(enemies): 实现怪物基类与4种怪物及波次管理器

This commit is contained in:
Cloud Bot
2026-03-21 08:04:11 +00:00
parent 84816cf39e
commit 6a21ece3ee
6 changed files with 661 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import type Phaser from 'phaser'
import { EnemyBase, type PathPoint } from './EnemyBase'
const QUOTES = ['我为公司立过功!', '我有10年经验', '年龄不是问题!']
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 QUOTES[Math.floor(Math.random() * QUOTES.length)]
}
}