feat(game): 添加全套音效系统(背景BGM+7种攻击音+波次/Boss/死亡/建塔音效),纯Web Audio API合成
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type Phaser from 'phaser'
|
||||
import { EnemyBase, type PathPoint } from './EnemyBase'
|
||||
import { getRandomQuote } from '../data/quotes'
|
||||
import { AudioEngine } from '../AudioEngine'
|
||||
|
||||
export class BossVP extends EnemyBase {
|
||||
private skillTimer: number = 20000
|
||||
@@ -20,6 +21,8 @@ export class BossVP extends EnemyBase {
|
||||
this.imageSprite.setDisplaySize(bossSize, bossSize)
|
||||
this.imageSprite.setDepth(12)
|
||||
scene.cameras.main.flash(800, 255, 0, 0, false)
|
||||
// Boss 登场音效
|
||||
AudioEngine.getInstance().playBossAppear()
|
||||
this.showBossAlert()
|
||||
this.bossLabel = scene.add.text(this.x, this.y + this.cellH * 0.5, '空降VP', {
|
||||
fontFamily: 'VT323, monospace', fontSize: '14px',
|
||||
@@ -55,6 +58,8 @@ export class BossVP extends EnemyBase {
|
||||
|
||||
private triggerOrgRestructure(): void {
|
||||
this.onDestroyTower?.()
|
||||
// Boss 技能音效
|
||||
AudioEngine.getInstance().playBossSkill()
|
||||
const txt = this.scene.add
|
||||
.text(this.x, this.y - 40, '组织架构调整!', {
|
||||
fontFamily: 'VT323, monospace', fontSize: '18px',
|
||||
|
||||
@@ -2,6 +2,7 @@ import type Phaser from 'phaser'
|
||||
import { GameManager } from '../GameManager'
|
||||
import { HUD_HEIGHT } from '../constants'
|
||||
import { getCellSize } from '../mapRenderer'
|
||||
import { AudioEngine } from '../AudioEngine'
|
||||
import { ALL_MAPS } from '../data/mapConfigs'
|
||||
|
||||
export interface PathPoint { x: number; y: number }
|
||||
@@ -228,6 +229,8 @@ export abstract class EnemyBase {
|
||||
this.isDead = true
|
||||
const reward = this.hcRewardBonus ? this.hcReward * 2 : this.hcReward
|
||||
GameManager.getInstance().addHC(reward)
|
||||
// 怪物死亡音效(碎纸机)
|
||||
AudioEngine.getInstance().playEnemyDeath()
|
||||
this.onDeath()
|
||||
this.destroy()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user