diff --git a/assets/Scripts/Game/Audio/GameAudioAdapter.ts b/assets/Scripts/Game/Audio/GameAudioAdapter.ts index 56a737f..673ee4e 100644 --- a/assets/Scripts/Game/Audio/GameAudioAdapter.ts +++ b/assets/Scripts/Game/Audio/GameAudioAdapter.ts @@ -54,7 +54,7 @@ export class GameAudioAdapter extends Component { horizontalLauncher.ProjectileLaunchedEvent.on(() => this.audioPlayer.playSound(this.horizontalProjectileLaunch), this); diagonalLauncher.ProjectileLaunchedEvent.on(() => this.audioPlayer.playSound(this.diagonalProjectileLaunch), this); - haloLauncher.ProjectileLaunchedEvent.on(() => this.audioPlayer.playSound(this.haloProjectileLaunch), this); + haloLauncher.ProjectilesLaunchedEvent.on(() => this.audioPlayer.playSound(this.haloProjectileLaunch), this); } private addEnemyListeners(enemy: Enemy): void { diff --git a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/HaloProjectileLauncher.ts b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/HaloProjectileLauncher.ts index 2c6c16a..0c8dab7 100644 --- a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/HaloProjectileLauncher.ts +++ b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/HaloProjectileLauncher.ts @@ -1,13 +1,13 @@ -import { Vec2, Node } from "cc"; +import { Node, Vec2 } from "cc"; import { ISignal } from "../../../../Services/EventSystem/ISignal"; +import { Signal } from "../../../../Services/EventSystem/Signal"; +import { GameTimer } from "../../../../Services/GameTimer"; import { roundToOneDecimal } from "../../../../Services/Utils/MathUtils"; import { HaloLauncherSettings } from "../../../Data/GameSettings"; -import { ProjectileCollision } from "../../../Projectile/ProjectileCollision"; import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler"; -import { ProjectileLauncher } from "./ProjectileLauncher"; +import { ProjectileCollision } from "../../../Projectile/ProjectileCollision"; import { ProjectileData } from "./ProjectileData"; -import { GameTimer } from "../../../../Services/GameTimer"; -import { Empty } from "../../../../Menu/ModalWindows/Upgrades/UpgradesModalWindow"; +import { ProjectileLauncher } from "./ProjectileLauncher"; export class HaloProjectileLauncher implements IProjectileLauncherSignaler { private currentUpgrade = 0; @@ -16,6 +16,8 @@ export class HaloProjectileLauncher implements IProjectileLauncherSignaler { private directions: Vec2[] = []; private fireTimer = new GameTimer(0); + private projectilesLaunchedEvent = new Signal(); + public constructor( private launcher: ProjectileLauncher, private playerNode: Node, @@ -44,6 +46,10 @@ export class HaloProjectileLauncher implements IProjectileLauncherSignaler { return this.launcher.ProjectileLaunchedEvent; } + public get ProjectilesLaunchedEvent(): ISignal { + return this.projectilesLaunchedEvent; + } + public gameTick(deltaTime: number): void { if (this.currentUpgrade == 0) return; @@ -52,6 +58,7 @@ export class HaloProjectileLauncher implements IProjectileLauncherSignaler { if (this.fireTimer.tryFinishPeriod()) { this.launcher.fireProjectiles(this.playerNode.worldPosition, this.directions); + this.projectilesLaunchedEvent.trigger(); } }