feat(game): 添加全套音效系统(背景BGM+7种攻击音+波次/Boss/死亡/建塔音效),纯Web Audio API合成

This commit is contained in:
Cloud Bot
2026-03-24 08:01:27 +00:00
parent c8b8c7109f
commit 08a3612ba1
12 changed files with 351 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import type Phaser from 'phaser'
import { GameManager } from '../GameManager'
import { getCellSize } from '../mapRenderer'
import { COFFEE_COST } from '../constants'
import { AudioEngine } from '../AudioEngine'
import type { EnemyBase } from '../enemies/EnemyBase'
import { TowerBase } from './TowerBase'
import { InternTower } from './InternTower'
@@ -60,6 +61,8 @@ export class TowerManager {
const tower = this.createTower(type, gridX, gridY)
this.towers.push(tower)
this.occupiedCells.add(`${gridX},${gridY}`)
// 建塔音效(钉钉消息音)
AudioEngine.getInstance().playNotify()
// 监听实习生自毁事件
if (tower instanceof InternTower) {
@@ -226,6 +229,8 @@ export class TowerManager {
this.showDestroyEffect(tower)
tower.destroy()
this.removeTower(tower)
// 塔被摧毁音效
AudioEngine.getInstance().playTowerDestroyed()
}
private showDestroyEffect(tower: TowerBase): void {