diff --git a/assets/Media/Audio/Sound/12_human_jump_3.wav b/assets/Media/Audio/Sound/12_human_jump_3.wav new file mode 100644 index 0000000..02d67f1 Binary files /dev/null and b/assets/Media/Audio/Sound/12_human_jump_3.wav differ diff --git a/assets/Media/Audio/Sound/12_human_jump_3.wav.meta b/assets/Media/Audio/Sound/12_human_jump_3.wav.meta new file mode 100644 index 0000000..62f6f1b --- /dev/null +++ b/assets/Media/Audio/Sound/12_human_jump_3.wav.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.0.0", + "importer": "audio-clip", + "imported": true, + "uuid": "36c577cb-8a85-40a7-9390-455863dfef8f", + "files": [ + ".json", + ".wav" + ], + "subMetas": {}, + "userData": { + "downloadMode": 0 + } +} diff --git a/assets/Media/Audio/Sound/15_human_dash_2.wav b/assets/Media/Audio/Sound/15_human_dash_2.wav new file mode 100644 index 0000000..256aa38 Binary files /dev/null and b/assets/Media/Audio/Sound/15_human_dash_2.wav differ diff --git a/assets/Media/Audio/Sound/15_human_dash_2.wav.meta b/assets/Media/Audio/Sound/15_human_dash_2.wav.meta new file mode 100644 index 0000000..76d5a6d --- /dev/null +++ b/assets/Media/Audio/Sound/15_human_dash_2.wav.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.0.0", + "importer": "audio-clip", + "imported": true, + "uuid": "a7b634e1-7842-402c-a2a9-4007435c9a4a", + "files": [ + ".json", + ".wav" + ], + "subMetas": {}, + "userData": { + "downloadMode": 0 + } +} diff --git a/assets/Media/Audio/Sound/27_sword_miss_1.wav b/assets/Media/Audio/Sound/27_sword_miss_1.wav new file mode 100644 index 0000000..ca0b742 Binary files /dev/null and b/assets/Media/Audio/Sound/27_sword_miss_1.wav differ diff --git a/assets/Media/Audio/Sound/27_sword_miss_1.wav.meta b/assets/Media/Audio/Sound/27_sword_miss_1.wav.meta new file mode 100644 index 0000000..5bc3f54 --- /dev/null +++ b/assets/Media/Audio/Sound/27_sword_miss_1.wav.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.0.0", + "importer": "audio-clip", + "imported": true, + "uuid": "adeff7ed-6f7e-471b-8790-d0eb14e048f9", + "files": [ + ".json", + ".wav" + ], + "subMetas": {}, + "userData": { + "downloadMode": 0 + } +} diff --git a/assets/Scenes/Game.scene b/assets/Scenes/Game.scene index 89292af..961095d 100644 --- a/assets/Scenes/Game.scene +++ b/assets/Scenes/Game.scene @@ -196,7 +196,7 @@ "_enabled": true, "__prefab": null, "startTime": 0, - "startXP": 0, + "startXP": 300, "maxHpLevel": 0, "bonusDamageLevel": 0, "projectilePiercingLevel": 0, @@ -376,6 +376,18 @@ "__uuid__": "4bf29238-2767-4178-a74a-3c2857685265", "__expectedType__": "cc.AudioClip" }, + "horizontalProjectileLaunch": { + "__uuid__": "36c577cb-8a85-40a7-9390-455863dfef8f", + "__expectedType__": "cc.AudioClip" + }, + "diagonalProjectileLaunch": { + "__uuid__": "adeff7ed-6f7e-471b-8790-d0eb14e048f9", + "__expectedType__": "cc.AudioClip" + }, + "haloProjectileLaunch": { + "__uuid__": "a7b634e1-7842-402c-a2a9-4007435c9a4a", + "__expectedType__": "cc.AudioClip" + }, "_id": "8fIp3RG7RDK6FMarL5A96h" }, { diff --git a/assets/Scripts/Game/Audio/GameAudioAdapter.ts b/assets/Scripts/Game/Audio/GameAudioAdapter.ts index 456ea65..96a4ced 100644 --- a/assets/Scripts/Game/Audio/GameAudioAdapter.ts +++ b/assets/Scripts/Game/Audio/GameAudioAdapter.ts @@ -5,6 +5,8 @@ import { ItemManager, ItemType } from "../Items/ItemManager"; import { Enemy } from "../Unit/Enemy/Enemy"; import { EnemyManager } from "../Unit/Enemy/EnemyManager"; import { Player } from "../Unit/Player/Player"; +import { HaloProjectileLauncher } from "../Unit/Player/ProjectileLauncher/HaloProjectileLauncher"; +import { WaveProjectileLauncher } from "../Unit/Player/ProjectileLauncher/WaveProjectileLauncher"; const { ccclass, property } = _decorator; @ccclass("GameAudioAdapter") @@ -18,11 +20,21 @@ export class GameAudioAdapter extends Component { @property(AudioClip) private goldPickup: AudioClip; @property(AudioClip) private healthPotionPickup: AudioClip; @property(AudioClip) private levelUp: AudioClip; + @property(AudioClip) private horizontalProjectileLaunch: AudioClip; + @property(AudioClip) private diagonalProjectileLaunch: AudioClip; + @property(AudioClip) private haloProjectileLaunch: AudioClip; private audioPlayer: AudioPlayer; private player: Player; - public init(player: Player, enemyManager: EnemyManager, itemManager: ItemManager): void { + public init( + player: Player, + enemyManager: EnemyManager, + itemManager: ItemManager, + horizontalLauncher: WaveProjectileLauncher, + diagonalLauncher: WaveProjectileLauncher, + haloLauncher: HaloProjectileLauncher + ): void { AppRoot.Instance.AudioPlayer.playMusic(this.music); this.audioPlayer = AppRoot.Instance.AudioPlayer; @@ -32,10 +44,14 @@ export class GameAudioAdapter extends Component { player.Level.LevelUpEvent.on(() => this.audioPlayer.playSound(this.levelUp), this); player.Health.HealthPointsChangeEvent.on(this.tryPlayPlayerHitSound, this); - itemManager.PickupEvent.on(this.playPickupItemSound, this); - enemyManager.EnemyAddedEvent.on(this.addEnemyListeners, this); enemyManager.EnemyRemovedEvent.on(this.removeEnemyListeners, this); + + itemManager.PickupEvent.on(this.playPickupItemSound, this); + + 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); } private addEnemyListeners(enemy: Enemy): void { diff --git a/assets/Scripts/Game/Collision/PlayerProjectileCollisionSystem.ts b/assets/Scripts/Game/Collision/PlayerProjectileCollisionSystem.ts index 7d20591..43cf5bf 100644 --- a/assets/Scripts/Game/Collision/PlayerProjectileCollisionSystem.ts +++ b/assets/Scripts/Game/Collision/PlayerProjectileCollisionSystem.ts @@ -1,9 +1,9 @@ -import { IProjectileCollisionSignaler } from "../Projectile/IProjectileCollisionSignaler"; +import { IProjectileLauncherSignaler } from "../Projectile/IProjectileLauncherSignaler"; import { ProjectileCollision } from "../Projectile/ProjectileCollision"; import { Enemy } from "../Unit/Enemy/Enemy"; export class PlayerProjectileCollisionSystem { - public constructor(collisionSignalers: IProjectileCollisionSignaler[]) { + public constructor(collisionSignalers: IProjectileLauncherSignaler[]) { for (const collisionSignaler of collisionSignalers) { collisionSignaler.ProjectileCollisionEvent.on(this.onProjectileCollision, this); } diff --git a/assets/Scripts/Game/Game.ts b/assets/Scripts/Game/Game.ts index 2e1fc41..e5ee012 100644 --- a/assets/Scripts/Game/Game.ts +++ b/assets/Scripts/Game/Game.ts @@ -144,7 +144,14 @@ export class Game extends Component { this.player.Level.addXp(testValues.startXP); } - this.gameAudioAdapter.init(this.player, this.enemyManager, this.itemManager); + this.gameAudioAdapter.init( + this.player, + this.enemyManager, + this.itemManager, + this.horizontalProjectileLauncher, + this.diagonalProjectileLauncher, + this.haloProjectileLauncher + ); this.gamePauser.resume(); while (!this.gameResult.hasExitManually && this.player.Health.IsAlive) await delay(100); diff --git a/assets/Scripts/Game/Projectile/IProjectileCollisionSignaler.ts b/assets/Scripts/Game/Projectile/IProjectileLauncherSignaler.ts similarity index 67% rename from assets/Scripts/Game/Projectile/IProjectileCollisionSignaler.ts rename to assets/Scripts/Game/Projectile/IProjectileLauncherSignaler.ts index 4e5f187..cc22683 100644 --- a/assets/Scripts/Game/Projectile/IProjectileCollisionSignaler.ts +++ b/assets/Scripts/Game/Projectile/IProjectileLauncherSignaler.ts @@ -1,6 +1,7 @@ import { ISignal } from "../../Services/EventSystem/ISignal"; import { ProjectileCollision } from "./ProjectileCollision"; -export interface IProjectileCollisionSignaler { +export interface IProjectileLauncherSignaler { get ProjectileCollisionEvent(): ISignal; + get ProjectileLaunchedEvent(): ISignal; } diff --git a/assets/Scripts/Game/Projectile/IProjectileCollisionSignaler.ts.meta b/assets/Scripts/Game/Projectile/IProjectileLauncherSignaler.ts.meta similarity index 100% rename from assets/Scripts/Game/Projectile/IProjectileCollisionSignaler.ts.meta rename to assets/Scripts/Game/Projectile/IProjectileLauncherSignaler.ts.meta diff --git a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/HaloProjectileLauncher.ts b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/HaloProjectileLauncher.ts index 0bc5c1a..2c6c16a 100644 --- a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/HaloProjectileLauncher.ts +++ b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/HaloProjectileLauncher.ts @@ -3,12 +3,13 @@ import { ISignal } from "../../../../Services/EventSystem/ISignal"; import { roundToOneDecimal } from "../../../../Services/Utils/MathUtils"; import { HaloLauncherSettings } from "../../../Data/GameSettings"; import { ProjectileCollision } from "../../../Projectile/ProjectileCollision"; -import { IProjectileCollisionSignaler } from "../../../Projectile/IProjectileCollisionSignaler"; +import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler"; import { ProjectileLauncher } from "./ProjectileLauncher"; import { ProjectileData } from "./ProjectileData"; import { GameTimer } from "../../../../Services/GameTimer"; +import { Empty } from "../../../../Menu/ModalWindows/Upgrades/UpgradesModalWindow"; -export class HaloProjectileLauncher implements IProjectileCollisionSignaler { +export class HaloProjectileLauncher implements IProjectileLauncherSignaler { private currentUpgrade = 0; private defaultCooldown = 0; private cooldownDivisorPerUpgrade = 0; @@ -39,6 +40,10 @@ export class HaloProjectileLauncher implements IProjectileCollisionSignaler { return this.launcher.ProjectileCollisionEvent; } + public get ProjectileLaunchedEvent(): ISignal { + return this.launcher.ProjectileLaunchedEvent; + } + public gameTick(deltaTime: number): void { if (this.currentUpgrade == 0) return; diff --git a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts index d6d6d2f..013b311 100644 --- a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts +++ b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts @@ -1,17 +1,19 @@ import { _decorator, Component, Prefab, Vec2, Vec3 } from "cc"; +import { Empty } from "../../../../Menu/ModalWindows/Upgrades/UpgradesModalWindow"; import { ISignal } from "../../../../Services/EventSystem/ISignal"; import { Signal } from "../../../../Services/EventSystem/Signal"; import { ObjectPool } from "../../../../Services/ObjectPool"; import { getDegreeAngleFromDirection } from "../../../../Services/Utils/MathUtils"; -import { IProjectileCollisionSignaler } from "../../../Projectile/IProjectileCollisionSignaler"; +import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler"; import { Projectile } from "../../../Projectile/Projectile"; import { ProjectileCollision } from "../../../Projectile/ProjectileCollision"; const { ccclass, property } = _decorator; @ccclass("ProjectileLauncher") -export class ProjectileLauncher extends Component implements IProjectileCollisionSignaler { +export class ProjectileLauncher extends Component implements IProjectileLauncherSignaler { @property(Prefab) private projectilePrefab: Prefab; - private projectileCollisionEvent: Signal = new Signal(); + private projectileCollisionEvent = new Signal(); + private projectileLauncehdEvent = new Signal(); private projectileDamage: number; private projectilePierces: number; @@ -29,6 +31,10 @@ export class ProjectileLauncher extends Component implements IProjectileCollisio return this.projectileCollisionEvent; } + public get ProjectileLaunchedEvent(): ISignal { + return this.projectileLauncehdEvent; + } + public init(projectileLifetime: number, projectileSpeed: number, projectileDamage: number, projectilePierces: number): void { this.projectileLifetime = projectileLifetime; this.projectileSpeed = projectileSpeed; @@ -62,6 +68,8 @@ export class ProjectileLauncher extends Component implements IProjectileCollisio this.projectiles.push(projectile); this.directions.push(direction); this.expireTimes.push(this.currentTime + this.projectileLifetime); + + this.projectileLauncehdEvent.trigger({}); } private tryRemoveExpiredProjectiles(): void { diff --git a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/WaveProjectileLauncher.ts b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/WaveProjectileLauncher.ts index 35a6e70..dd9199e 100644 --- a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/WaveProjectileLauncher.ts +++ b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/WaveProjectileLauncher.ts @@ -1,14 +1,15 @@ import { Node, Vec2 } from "cc"; +import { Empty } from "../../../../Menu/ModalWindows/Upgrades/UpgradesModalWindow"; import { ISignal } from "../../../../Services/EventSystem/ISignal"; import { GameTimer } from "../../../../Services/GameTimer"; import { delay } from "../../../../Services/Utils/AsyncUtils"; import { WaveLauncherSettings } from "../../../Data/GameSettings"; -import { IProjectileCollisionSignaler } from "../../../Projectile/IProjectileCollisionSignaler"; +import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler"; import { ProjectileCollision } from "../../../Projectile/ProjectileCollision"; -import { ProjectileLauncher } from "./ProjectileLauncher"; import { ProjectileData } from "./ProjectileData"; +import { ProjectileLauncher } from "./ProjectileLauncher"; -export class WaveProjectileLauncher implements IProjectileCollisionSignaler { +export class WaveProjectileLauncher implements IProjectileLauncherSignaler { private currentUpgrade = 0; private wavesToShootPerUpgrade = 0; private fireTimer: GameTimer; @@ -35,6 +36,10 @@ export class WaveProjectileLauncher implements IProjectileCollisionSignaler { return this.launcher.ProjectileCollisionEvent; } + public get ProjectileLaunchedEvent(): ISignal { + return this.launcher.ProjectileLaunchedEvent; + } + public gameTick(deltaTime: number): void { if (this.currentUpgrade == 0) return; diff --git a/assets/Scripts/Services/EventSystem/ISignal.ts b/assets/Scripts/Services/EventSystem/ISignal.ts index bbd0c63..b0571cf 100644 --- a/assets/Scripts/Services/EventSystem/ISignal.ts +++ b/assets/Scripts/Services/EventSystem/ISignal.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -export interface ISignal { - on(handler: (data: T) => void, thisArg: any): void; - off(handler: (data: T) => void): void; +export interface ISignal { + on(handler: (data?: T) => void, thisArg: any): void; + off(handler: (data?: T) => void): void; } diff --git a/assets/Scripts/Services/EventSystem/Signal.ts b/assets/Scripts/Services/EventSystem/Signal.ts index c520a83..f485514 100644 --- a/assets/Scripts/Services/EventSystem/Signal.ts +++ b/assets/Scripts/Services/EventSystem/Signal.ts @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { ISignal } from "./ISignal"; -export class Signal implements ISignal { +export class Signal implements ISignal { private handlers: ((data: T) => void)[] = []; private thisArgs: any[] = [];