mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-26 11:48:54 +00:00
Fixing halo sound
This commit is contained in:
parent
c9e2edb486
commit
f01ce95a6c
@ -54,7 +54,7 @@ export class GameAudioAdapter extends Component {
|
|||||||
|
|
||||||
horizontalLauncher.ProjectileLaunchedEvent.on(() => this.audioPlayer.playSound(this.horizontalProjectileLaunch), this);
|
horizontalLauncher.ProjectileLaunchedEvent.on(() => this.audioPlayer.playSound(this.horizontalProjectileLaunch), this);
|
||||||
diagonalLauncher.ProjectileLaunchedEvent.on(() => this.audioPlayer.playSound(this.diagonalProjectileLaunch), 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 {
|
private addEnemyListeners(enemy: Enemy): void {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { Vec2, Node } from "cc";
|
import { Node, Vec2 } from "cc";
|
||||||
import { ISignal } from "../../../../Services/EventSystem/ISignal";
|
import { ISignal } from "../../../../Services/EventSystem/ISignal";
|
||||||
|
import { Signal } from "../../../../Services/EventSystem/Signal";
|
||||||
|
import { GameTimer } from "../../../../Services/GameTimer";
|
||||||
import { roundToOneDecimal } from "../../../../Services/Utils/MathUtils";
|
import { roundToOneDecimal } from "../../../../Services/Utils/MathUtils";
|
||||||
import { HaloLauncherSettings } from "../../../Data/GameSettings";
|
import { HaloLauncherSettings } from "../../../Data/GameSettings";
|
||||||
import { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
|
|
||||||
import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler";
|
import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler";
|
||||||
import { ProjectileLauncher } from "./ProjectileLauncher";
|
import { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
|
||||||
import { ProjectileData } from "./ProjectileData";
|
import { ProjectileData } from "./ProjectileData";
|
||||||
import { GameTimer } from "../../../../Services/GameTimer";
|
import { ProjectileLauncher } from "./ProjectileLauncher";
|
||||||
import { Empty } from "../../../../Menu/ModalWindows/Upgrades/UpgradesModalWindow";
|
|
||||||
|
|
||||||
export class HaloProjectileLauncher implements IProjectileLauncherSignaler {
|
export class HaloProjectileLauncher implements IProjectileLauncherSignaler {
|
||||||
private currentUpgrade = 0;
|
private currentUpgrade = 0;
|
||||||
@ -16,6 +16,8 @@ export class HaloProjectileLauncher implements IProjectileLauncherSignaler {
|
|||||||
private directions: Vec2[] = [];
|
private directions: Vec2[] = [];
|
||||||
private fireTimer = new GameTimer(0);
|
private fireTimer = new GameTimer(0);
|
||||||
|
|
||||||
|
private projectilesLaunchedEvent = new Signal();
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private launcher: ProjectileLauncher,
|
private launcher: ProjectileLauncher,
|
||||||
private playerNode: Node,
|
private playerNode: Node,
|
||||||
@ -44,6 +46,10 @@ export class HaloProjectileLauncher implements IProjectileLauncherSignaler {
|
|||||||
return this.launcher.ProjectileLaunchedEvent;
|
return this.launcher.ProjectileLaunchedEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get ProjectilesLaunchedEvent(): ISignal {
|
||||||
|
return this.projectilesLaunchedEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public gameTick(deltaTime: number): void {
|
public gameTick(deltaTime: number): void {
|
||||||
if (this.currentUpgrade == 0) return;
|
if (this.currentUpgrade == 0) return;
|
||||||
|
|
||||||
@ -52,6 +58,7 @@ export class HaloProjectileLauncher implements IProjectileLauncherSignaler {
|
|||||||
|
|
||||||
if (this.fireTimer.tryFinishPeriod()) {
|
if (this.fireTimer.tryFinishPeriod()) {
|
||||||
this.launcher.fireProjectiles(this.playerNode.worldPosition, this.directions);
|
this.launcher.fireProjectiles(this.playerNode.worldPosition, this.directions);
|
||||||
|
this.projectilesLaunchedEvent.trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user