mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-26 03:38:58 +00:00
Added sounds
This commit is contained in:
parent
bccaf323e1
commit
090a89ae08
BIN
assets/Media/Audio/Sound/12_human_jump_3.wav
Normal file
BIN
assets/Media/Audio/Sound/12_human_jump_3.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/12_human_jump_3.wav.meta
Normal file
14
assets/Media/Audio/Sound/12_human_jump_3.wav.meta
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/15_human_dash_2.wav
Normal file
BIN
assets/Media/Audio/Sound/15_human_dash_2.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/15_human_dash_2.wav.meta
Normal file
14
assets/Media/Audio/Sound/15_human_dash_2.wav.meta
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/27_sword_miss_1.wav
Normal file
BIN
assets/Media/Audio/Sound/27_sword_miss_1.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/27_sword_miss_1.wav.meta
Normal file
14
assets/Media/Audio/Sound/27_sword_miss_1.wav.meta
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
@ -196,7 +196,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
"startTime": 0,
|
"startTime": 0,
|
||||||
"startXP": 0,
|
"startXP": 300,
|
||||||
"maxHpLevel": 0,
|
"maxHpLevel": 0,
|
||||||
"bonusDamageLevel": 0,
|
"bonusDamageLevel": 0,
|
||||||
"projectilePiercingLevel": 0,
|
"projectilePiercingLevel": 0,
|
||||||
@ -376,6 +376,18 @@
|
|||||||
"__uuid__": "4bf29238-2767-4178-a74a-3c2857685265",
|
"__uuid__": "4bf29238-2767-4178-a74a-3c2857685265",
|
||||||
"__expectedType__": "cc.AudioClip"
|
"__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"
|
"_id": "8fIp3RG7RDK6FMarL5A96h"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,8 @@ import { ItemManager, ItemType } from "../Items/ItemManager";
|
|||||||
import { Enemy } from "../Unit/Enemy/Enemy";
|
import { Enemy } from "../Unit/Enemy/Enemy";
|
||||||
import { EnemyManager } from "../Unit/Enemy/EnemyManager";
|
import { EnemyManager } from "../Unit/Enemy/EnemyManager";
|
||||||
import { Player } from "../Unit/Player/Player";
|
import { Player } from "../Unit/Player/Player";
|
||||||
|
import { HaloProjectileLauncher } from "../Unit/Player/ProjectileLauncher/HaloProjectileLauncher";
|
||||||
|
import { WaveProjectileLauncher } from "../Unit/Player/ProjectileLauncher/WaveProjectileLauncher";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass("GameAudioAdapter")
|
@ccclass("GameAudioAdapter")
|
||||||
@ -18,11 +20,21 @@ export class GameAudioAdapter extends Component {
|
|||||||
@property(AudioClip) private goldPickup: AudioClip;
|
@property(AudioClip) private goldPickup: AudioClip;
|
||||||
@property(AudioClip) private healthPotionPickup: AudioClip;
|
@property(AudioClip) private healthPotionPickup: AudioClip;
|
||||||
@property(AudioClip) private levelUp: 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 audioPlayer: AudioPlayer;
|
||||||
private player: Player;
|
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);
|
AppRoot.Instance.AudioPlayer.playMusic(this.music);
|
||||||
|
|
||||||
this.audioPlayer = AppRoot.Instance.AudioPlayer;
|
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.Level.LevelUpEvent.on(() => this.audioPlayer.playSound(this.levelUp), this);
|
||||||
player.Health.HealthPointsChangeEvent.on(this.tryPlayPlayerHitSound, this);
|
player.Health.HealthPointsChangeEvent.on(this.tryPlayPlayerHitSound, this);
|
||||||
|
|
||||||
itemManager.PickupEvent.on(this.playPickupItemSound, this);
|
|
||||||
|
|
||||||
enemyManager.EnemyAddedEvent.on(this.addEnemyListeners, this);
|
enemyManager.EnemyAddedEvent.on(this.addEnemyListeners, this);
|
||||||
enemyManager.EnemyRemovedEvent.on(this.removeEnemyListeners, 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 {
|
private addEnemyListeners(enemy: Enemy): void {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { IProjectileCollisionSignaler } from "../Projectile/IProjectileCollisionSignaler";
|
import { IProjectileLauncherSignaler } from "../Projectile/IProjectileLauncherSignaler";
|
||||||
import { ProjectileCollision } from "../Projectile/ProjectileCollision";
|
import { ProjectileCollision } from "../Projectile/ProjectileCollision";
|
||||||
import { Enemy } from "../Unit/Enemy/Enemy";
|
import { Enemy } from "../Unit/Enemy/Enemy";
|
||||||
|
|
||||||
export class PlayerProjectileCollisionSystem {
|
export class PlayerProjectileCollisionSystem {
|
||||||
public constructor(collisionSignalers: IProjectileCollisionSignaler[]) {
|
public constructor(collisionSignalers: IProjectileLauncherSignaler[]) {
|
||||||
for (const collisionSignaler of collisionSignalers) {
|
for (const collisionSignaler of collisionSignalers) {
|
||||||
collisionSignaler.ProjectileCollisionEvent.on(this.onProjectileCollision, this);
|
collisionSignaler.ProjectileCollisionEvent.on(this.onProjectileCollision, this);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,14 @@ export class Game extends Component {
|
|||||||
this.player.Level.addXp(testValues.startXP);
|
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();
|
this.gamePauser.resume();
|
||||||
|
|
||||||
while (!this.gameResult.hasExitManually && this.player.Health.IsAlive) await delay(100);
|
while (!this.gameResult.hasExitManually && this.player.Health.IsAlive) await delay(100);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { ISignal } from "../../Services/EventSystem/ISignal";
|
import { ISignal } from "../../Services/EventSystem/ISignal";
|
||||||
import { ProjectileCollision } from "./ProjectileCollision";
|
import { ProjectileCollision } from "./ProjectileCollision";
|
||||||
|
|
||||||
export interface IProjectileCollisionSignaler {
|
export interface IProjectileLauncherSignaler {
|
||||||
get ProjectileCollisionEvent(): ISignal<ProjectileCollision>;
|
get ProjectileCollisionEvent(): ISignal<ProjectileCollision>;
|
||||||
|
get ProjectileLaunchedEvent(): ISignal;
|
||||||
}
|
}
|
@ -3,12 +3,13 @@ import { ISignal } from "../../../../Services/EventSystem/ISignal";
|
|||||||
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 { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
|
||||||
import { IProjectileCollisionSignaler } from "../../../Projectile/IProjectileCollisionSignaler";
|
import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler";
|
||||||
import { ProjectileLauncher } from "./ProjectileLauncher";
|
import { ProjectileLauncher } from "./ProjectileLauncher";
|
||||||
import { ProjectileData } from "./ProjectileData";
|
import { ProjectileData } from "./ProjectileData";
|
||||||
import { GameTimer } from "../../../../Services/GameTimer";
|
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 currentUpgrade = 0;
|
||||||
private defaultCooldown = 0;
|
private defaultCooldown = 0;
|
||||||
private cooldownDivisorPerUpgrade = 0;
|
private cooldownDivisorPerUpgrade = 0;
|
||||||
@ -39,6 +40,10 @@ export class HaloProjectileLauncher implements IProjectileCollisionSignaler {
|
|||||||
return this.launcher.ProjectileCollisionEvent;
|
return this.launcher.ProjectileCollisionEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get ProjectileLaunchedEvent(): ISignal {
|
||||||
|
return this.launcher.ProjectileLaunchedEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public gameTick(deltaTime: number): void {
|
public gameTick(deltaTime: number): void {
|
||||||
if (this.currentUpgrade == 0) return;
|
if (this.currentUpgrade == 0) return;
|
||||||
|
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
import { _decorator, Component, Prefab, Vec2, Vec3 } from "cc";
|
import { _decorator, Component, Prefab, Vec2, Vec3 } from "cc";
|
||||||
|
import { Empty } from "../../../../Menu/ModalWindows/Upgrades/UpgradesModalWindow";
|
||||||
import { ISignal } from "../../../../Services/EventSystem/ISignal";
|
import { ISignal } from "../../../../Services/EventSystem/ISignal";
|
||||||
import { Signal } from "../../../../Services/EventSystem/Signal";
|
import { Signal } from "../../../../Services/EventSystem/Signal";
|
||||||
import { ObjectPool } from "../../../../Services/ObjectPool";
|
import { ObjectPool } from "../../../../Services/ObjectPool";
|
||||||
import { getDegreeAngleFromDirection } from "../../../../Services/Utils/MathUtils";
|
import { getDegreeAngleFromDirection } from "../../../../Services/Utils/MathUtils";
|
||||||
import { IProjectileCollisionSignaler } from "../../../Projectile/IProjectileCollisionSignaler";
|
import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler";
|
||||||
import { Projectile } from "../../../Projectile/Projectile";
|
import { Projectile } from "../../../Projectile/Projectile";
|
||||||
import { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
|
import { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass("ProjectileLauncher")
|
@ccclass("ProjectileLauncher")
|
||||||
export class ProjectileLauncher extends Component implements IProjectileCollisionSignaler {
|
export class ProjectileLauncher extends Component implements IProjectileLauncherSignaler {
|
||||||
@property(Prefab) private projectilePrefab: Prefab;
|
@property(Prefab) private projectilePrefab: Prefab;
|
||||||
private projectileCollisionEvent: Signal<ProjectileCollision> = new Signal<ProjectileCollision>();
|
private projectileCollisionEvent = new Signal<ProjectileCollision>();
|
||||||
|
private projectileLauncehdEvent = new Signal();
|
||||||
|
|
||||||
private projectileDamage: number;
|
private projectileDamage: number;
|
||||||
private projectilePierces: number;
|
private projectilePierces: number;
|
||||||
@ -29,6 +31,10 @@ export class ProjectileLauncher extends Component implements IProjectileCollisio
|
|||||||
return this.projectileCollisionEvent;
|
return this.projectileCollisionEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get ProjectileLaunchedEvent(): ISignal {
|
||||||
|
return this.projectileLauncehdEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public init(projectileLifetime: number, projectileSpeed: number, projectileDamage: number, projectilePierces: number): void {
|
public init(projectileLifetime: number, projectileSpeed: number, projectileDamage: number, projectilePierces: number): void {
|
||||||
this.projectileLifetime = projectileLifetime;
|
this.projectileLifetime = projectileLifetime;
|
||||||
this.projectileSpeed = projectileSpeed;
|
this.projectileSpeed = projectileSpeed;
|
||||||
@ -62,6 +68,8 @@ export class ProjectileLauncher extends Component implements IProjectileCollisio
|
|||||||
this.projectiles.push(projectile);
|
this.projectiles.push(projectile);
|
||||||
this.directions.push(direction);
|
this.directions.push(direction);
|
||||||
this.expireTimes.push(this.currentTime + this.projectileLifetime);
|
this.expireTimes.push(this.currentTime + this.projectileLifetime);
|
||||||
|
|
||||||
|
this.projectileLauncehdEvent.trigger({});
|
||||||
}
|
}
|
||||||
|
|
||||||
private tryRemoveExpiredProjectiles(): void {
|
private tryRemoveExpiredProjectiles(): void {
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import { Node, Vec2 } from "cc";
|
import { Node, Vec2 } from "cc";
|
||||||
|
import { Empty } from "../../../../Menu/ModalWindows/Upgrades/UpgradesModalWindow";
|
||||||
import { ISignal } from "../../../../Services/EventSystem/ISignal";
|
import { ISignal } from "../../../../Services/EventSystem/ISignal";
|
||||||
import { GameTimer } from "../../../../Services/GameTimer";
|
import { GameTimer } from "../../../../Services/GameTimer";
|
||||||
import { delay } from "../../../../Services/Utils/AsyncUtils";
|
import { delay } from "../../../../Services/Utils/AsyncUtils";
|
||||||
import { WaveLauncherSettings } from "../../../Data/GameSettings";
|
import { WaveLauncherSettings } from "../../../Data/GameSettings";
|
||||||
import { IProjectileCollisionSignaler } from "../../../Projectile/IProjectileCollisionSignaler";
|
import { IProjectileLauncherSignaler } from "../../../Projectile/IProjectileLauncherSignaler";
|
||||||
import { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
|
import { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
|
||||||
import { ProjectileLauncher } from "./ProjectileLauncher";
|
|
||||||
import { ProjectileData } from "./ProjectileData";
|
import { ProjectileData } from "./ProjectileData";
|
||||||
|
import { ProjectileLauncher } from "./ProjectileLauncher";
|
||||||
|
|
||||||
export class WaveProjectileLauncher implements IProjectileCollisionSignaler {
|
export class WaveProjectileLauncher implements IProjectileLauncherSignaler {
|
||||||
private currentUpgrade = 0;
|
private currentUpgrade = 0;
|
||||||
private wavesToShootPerUpgrade = 0;
|
private wavesToShootPerUpgrade = 0;
|
||||||
private fireTimer: GameTimer;
|
private fireTimer: GameTimer;
|
||||||
@ -35,6 +36,10 @@ export class WaveProjectileLauncher implements IProjectileCollisionSignaler {
|
|||||||
return this.launcher.ProjectileCollisionEvent;
|
return this.launcher.ProjectileCollisionEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get ProjectileLaunchedEvent(): ISignal {
|
||||||
|
return this.launcher.ProjectileLaunchedEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public gameTick(deltaTime: number): void {
|
public gameTick(deltaTime: number): void {
|
||||||
if (this.currentUpgrade == 0) return;
|
if (this.currentUpgrade == 0) return;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
export interface ISignal<T> {
|
export interface ISignal<T = void> {
|
||||||
on(handler: (data: T) => void, thisArg: any): void;
|
on(handler: (data?: T) => void, thisArg: any): void;
|
||||||
off(handler: (data: T) => void): void;
|
off(handler: (data?: T) => void): void;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import { ISignal } from "./ISignal";
|
import { ISignal } from "./ISignal";
|
||||||
|
|
||||||
export class Signal<T> implements ISignal<T> {
|
export class Signal<T = void> implements ISignal<T> {
|
||||||
private handlers: ((data: T) => void)[] = [];
|
private handlers: ((data: T) => void)[] = [];
|
||||||
private thisArgs: any[] = [];
|
private thisArgs: any[] = [];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user