mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-26 11:48:54 +00:00
Basic sounds
This commit is contained in:
parent
f3eb520300
commit
2c01e293e4
12
assets/Media/Audio/Music.meta
Normal file
12
assets/Media/Audio/Music.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.1.0",
|
||||||
|
"importer": "directory",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "beb2e2db-0402-4a36-957d-2f5333ed6557",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"compressionType": {},
|
||||||
|
"isRemoteBundle": {}
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Music/Goblins_Dance_(Battle).wav
Normal file
BIN
assets/Media/Audio/Music/Goblins_Dance_(Battle).wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Music/Goblins_Dance_(Battle).wav.meta
Normal file
14
assets/Media/Audio/Music/Goblins_Dance_(Battle).wav.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "0faecdcf-e5d6-4cc1-b3cf-3b2873f8ee62",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".wav"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/07_human_atk_sword_1.wav
Normal file
BIN
assets/Media/Audio/Sound/07_human_atk_sword_1.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/07_human_atk_sword_1.wav.meta
Normal file
14
assets/Media/Audio/Sound/07_human_atk_sword_1.wav.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "5ad08e27-4461-464a-ad19-8c933abf5a5d",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".wav"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/GP_Damage_8.wav
Normal file
BIN
assets/Media/Audio/Sound/GP_Damage_8.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/GP_Damage_8.wav.meta
Normal file
14
assets/Media/Audio/Sound/GP_Damage_8.wav.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "efed223f-7b17-47ad-b265-7a951ace6d85",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".wav"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/GP_Damage_9.wav
Normal file
BIN
assets/Media/Audio/Sound/GP_Damage_9.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/GP_Damage_9.wav.meta
Normal file
14
assets/Media/Audio/Sound/GP_Damage_9.wav.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "99fb12ce-b248-4560-85fd-c1a61689adf2",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".wav"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/GP_Heal_1.wav
Normal file
BIN
assets/Media/Audio/Sound/GP_Heal_1.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/GP_Heal_1.wav.meta
Normal file
14
assets/Media/Audio/Sound/GP_Heal_1.wav.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "4bf29238-2767-4178-a74a-3c2857685265",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".wav"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/GP_Turbo_Discard_2.wav
Normal file
BIN
assets/Media/Audio/Sound/GP_Turbo_Discard_2.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/GP_Turbo_Discard_2.wav.meta
Normal file
14
assets/Media/Audio/Sound/GP_Turbo_Discard_2.wav.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "6af287fc-820f-4e12-8b8f-858a5dd41d2c",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".wav"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/Special_Powerup_10.WAV
Normal file
BIN
assets/Media/Audio/Sound/Special_Powerup_10.WAV
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/Special_Powerup_10.WAV.meta
Normal file
14
assets/Media/Audio/Sound/Special_Powerup_10.WAV.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "b1564752-035d-4989-aed0-2c0684d8a0e9",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".wav"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/UI_Select_2.wav
Normal file
BIN
assets/Media/Audio/Sound/UI_Select_2.wav
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/UI_Select_2.wav.meta
Normal file
14
assets/Media/Audio/Sound/UI_Select_2.wav.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "c36e792e-caa2-42f7-b314-eb3f8ad3b280",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".wav"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/Media/Audio/Sound/coin.1.ogg
Normal file
BIN
assets/Media/Audio/Sound/coin.1.ogg
Normal file
Binary file not shown.
14
assets/Media/Audio/Sound/coin.1.ogg.meta
Normal file
14
assets/Media/Audio/Sound/coin.1.ogg.meta
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.0",
|
||||||
|
"importer": "audio-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "580b2ceb-3daa-409b-b6c4-7d81c7182650",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".ogg"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"downloadMode": 0
|
||||||
|
}
|
||||||
|
}
|
@ -243,9 +243,12 @@
|
|||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 9
|
"__id__": 9
|
||||||
},
|
},
|
||||||
"_clip": null,
|
"_clip": {
|
||||||
|
"__uuid__": "0faecdcf-e5d6-4cc1-b3cf-3b2873f8ee62",
|
||||||
|
"__expectedType__": "cc.AudioClip"
|
||||||
|
},
|
||||||
"_loop": true,
|
"_loop": true,
|
||||||
"_playOnAwake": false,
|
"_playOnAwake": true,
|
||||||
"_volume": 1,
|
"_volume": 1,
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
|
@ -340,8 +340,32 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
|
"music": {
|
||||||
|
"__uuid__": "0faecdcf-e5d6-4cc1-b3cf-3b2873f8ee62",
|
||||||
|
"__expectedType__": "cc.AudioClip"
|
||||||
|
},
|
||||||
"enemyHit": {
|
"enemyHit": {
|
||||||
"__uuid__": "c2afb64d-ffcf-4ad4-95b7-1ce1035a2166",
|
"__uuid__": "efed223f-7b17-47ad-b265-7a951ace6d85",
|
||||||
|
"__expectedType__": "cc.AudioClip"
|
||||||
|
},
|
||||||
|
"weaponSwing": {
|
||||||
|
"__uuid__": "5ad08e27-4461-464a-ad19-8c933abf5a5d",
|
||||||
|
"__expectedType__": "cc.AudioClip"
|
||||||
|
},
|
||||||
|
"xpPickup": {
|
||||||
|
"__uuid__": "6af287fc-820f-4e12-8b8f-858a5dd41d2c",
|
||||||
|
"__expectedType__": "cc.AudioClip"
|
||||||
|
},
|
||||||
|
"goldPickup": {
|
||||||
|
"__uuid__": "580b2ceb-3daa-409b-b6c4-7d81c7182650",
|
||||||
|
"__expectedType__": "cc.AudioClip"
|
||||||
|
},
|
||||||
|
"healthPotionPickup": {
|
||||||
|
"__uuid__": "b1564752-035d-4989-aed0-2c0684d8a0e9",
|
||||||
|
"__expectedType__": "cc.AudioClip"
|
||||||
|
},
|
||||||
|
"levelUp": {
|
||||||
|
"__uuid__": "4bf29238-2767-4178-a74a-3c2857685265",
|
||||||
"__expectedType__": "cc.AudioClip"
|
"__expectedType__": "cc.AudioClip"
|
||||||
},
|
},
|
||||||
"_id": "8fIp3RG7RDK6FMarL5A96h"
|
"_id": "8fIp3RG7RDK6FMarL5A96h"
|
||||||
@ -1373,7 +1397,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": -320,
|
"x": -320,
|
||||||
"y": 479.9999999999999,
|
"y": 480,
|
||||||
"z": -1000
|
"z": -1000
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@ -3000,7 +3024,7 @@
|
|||||||
"_priority": 1073741824,
|
"_priority": 1073741824,
|
||||||
"_fov": 45,
|
"_fov": 45,
|
||||||
"_fovAxis": 0,
|
"_fovAxis": 0,
|
||||||
"_orthoHeight": 479.99999999999994,
|
"_orthoHeight": 480,
|
||||||
"_near": 0,
|
"_near": 0,
|
||||||
"_far": 2000,
|
"_far": 2000,
|
||||||
"_color": {
|
"_color": {
|
||||||
|
@ -1,19 +1,34 @@
|
|||||||
import { _decorator, Component, Node, AudioClip } from "cc";
|
import { _decorator, Component, Node, AudioClip } from "cc";
|
||||||
import { AppRoot } from "../../AppRoot/AppRoot";
|
import { AppRoot } from "../../AppRoot/AppRoot";
|
||||||
import { AudioPlayer } from "../../Services/AudioPlayer/AudioPlayer";
|
import { AudioPlayer } from "../../Services/AudioPlayer/AudioPlayer";
|
||||||
|
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";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass("GameAudioAdapter")
|
@ccclass("GameAudioAdapter")
|
||||||
export class GameAudioAdapter extends Component {
|
export class GameAudioAdapter extends Component {
|
||||||
|
@property(AudioClip) private music: AudioClip;
|
||||||
@property(AudioClip) private enemyHit: AudioClip;
|
@property(AudioClip) private enemyHit: AudioClip;
|
||||||
|
@property(AudioClip) private weaponSwing: AudioClip;
|
||||||
|
@property(AudioClip) private xpPickup: AudioClip;
|
||||||
|
@property(AudioClip) private goldPickup: AudioClip;
|
||||||
|
@property(AudioClip) private healthPotionPickup: AudioClip;
|
||||||
|
@property(AudioClip) private levelUp: AudioClip;
|
||||||
|
|
||||||
private audioPlayer: AudioPlayer;
|
private audioPlayer: AudioPlayer;
|
||||||
|
|
||||||
public init(enemyManager: EnemyManager): void {
|
public init(player: Player, enemyManager: EnemyManager, itemManager: ItemManager): void {
|
||||||
|
AppRoot.Instance.AudioPlayer.playMusic(this.music);
|
||||||
|
|
||||||
this.audioPlayer = AppRoot.Instance.AudioPlayer;
|
this.audioPlayer = AppRoot.Instance.AudioPlayer;
|
||||||
|
|
||||||
|
player.Weapon.WeaponStrikeEvent.on(() => this.audioPlayer.playSound(this.weaponSwing), this);
|
||||||
|
player.Level.LevelUpEvent.on(() => this.audioPlayer.playSound(this.levelUp), 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);
|
||||||
}
|
}
|
||||||
@ -29,4 +44,23 @@ export class GameAudioAdapter extends Component {
|
|||||||
private playEnemyHitSound(): void {
|
private playEnemyHitSound(): void {
|
||||||
this.audioPlayer.playSound(this.enemyHit);
|
this.audioPlayer.playSound(this.enemyHit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private playPickupItemSound(itemType: ItemType): void {
|
||||||
|
let clipToPlay: AudioClip;
|
||||||
|
switch (itemType) {
|
||||||
|
case ItemType.XP:
|
||||||
|
clipToPlay = this.xpPickup;
|
||||||
|
break;
|
||||||
|
case ItemType.Gold:
|
||||||
|
clipToPlay = this.goldPickup;
|
||||||
|
break;
|
||||||
|
case ItemType.HealthPotion:
|
||||||
|
clipToPlay = this.healthPotionPickup;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.audioPlayer.playSound(clipToPlay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,15 @@ import { Pauser } from "./Pauser";
|
|||||||
import { TestValues } from "./TestGameRunner";
|
import { TestValues } from "./TestGameRunner";
|
||||||
import { GameUI } from "./UI/GameUI";
|
import { GameUI } from "./UI/GameUI";
|
||||||
import { EnemyManager } from "./Unit/Enemy/EnemyManager";
|
import { EnemyManager } from "./Unit/Enemy/EnemyManager";
|
||||||
|
import { EnemyProjectileLauncher } from "./Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher";
|
||||||
import { MetaUpgrades } from "./Unit/MetaUpgrades/MetaUpgrades";
|
import { MetaUpgrades } from "./Unit/MetaUpgrades/MetaUpgrades";
|
||||||
import { Player, PlayerData } from "./Unit/Player/Player";
|
import { Player, PlayerData } from "./Unit/Player/Player";
|
||||||
import { HaloProjectileLauncher } from "./Unit/Player/ProjectileLauncher/HaloProjectileLauncher";
|
import { HaloProjectileLauncher } from "./Unit/Player/ProjectileLauncher/HaloProjectileLauncher";
|
||||||
import { ProjectileLauncher } from "./Unit/Player/ProjectileLauncher/ProjectileLauncher";
|
|
||||||
import { ProjectileData } from "./Unit/Player/ProjectileLauncher/ProjectileData";
|
import { ProjectileData } from "./Unit/Player/ProjectileLauncher/ProjectileData";
|
||||||
|
import { ProjectileLauncher } from "./Unit/Player/ProjectileLauncher/ProjectileLauncher";
|
||||||
import { WaveProjectileLauncher } from "./Unit/Player/ProjectileLauncher/WaveProjectileLauncher";
|
import { WaveProjectileLauncher } from "./Unit/Player/ProjectileLauncher/WaveProjectileLauncher";
|
||||||
import { Upgrader } from "./Upgrades/Upgrader";
|
import { Upgrader } from "./Upgrades/Upgrader";
|
||||||
import { MetaUpgradeType } from "./Upgrades/UpgradeType";
|
import { MetaUpgradeType } from "./Upgrades/UpgradeType";
|
||||||
import { EnemyProjectileLauncher } from "./Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher";
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ export class Game extends Component {
|
|||||||
this.player.Level.addXp(testValues.startXP);
|
this.player.Level.addXp(testValues.startXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gameAudioAdapter.init(this.enemyManager);
|
this.gameAudioAdapter.init(this.player, this.enemyManager, this.itemManager);
|
||||||
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,4 +1,6 @@
|
|||||||
import { Component, random, randomRange, Vec3, _decorator } from "cc";
|
import { Component, random, randomRange, Vec3, _decorator } from "cc";
|
||||||
|
import { ISignal } from "../../Services/EventSystem/ISignal";
|
||||||
|
import { Signal } from "../../Services/EventSystem/Signal";
|
||||||
import { ItemSettings } from "../Data/GameSettings";
|
import { ItemSettings } from "../Data/GameSettings";
|
||||||
import { GameResult } from "../Game";
|
import { GameResult } from "../Game";
|
||||||
import { Enemy } from "../Unit/Enemy/Enemy";
|
import { Enemy } from "../Unit/Enemy/Enemy";
|
||||||
@ -24,6 +26,8 @@ export class ItemManager extends Component {
|
|||||||
private gameResult: GameResult;
|
private gameResult: GameResult;
|
||||||
private healthPerPotion: number;
|
private healthPerPotion: number;
|
||||||
|
|
||||||
|
private pickupEvent = new Signal<ItemType>();
|
||||||
|
|
||||||
public init(enemyManager: EnemyManager, player: Player, gameResult: GameResult, settings: ItemSettings): void {
|
public init(enemyManager: EnemyManager, player: Player, gameResult: GameResult, settings: ItemSettings): void {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.gameResult = gameResult;
|
this.gameResult = gameResult;
|
||||||
@ -38,8 +42,13 @@ export class ItemManager extends Component {
|
|||||||
this.pickupEffectManager.init();
|
this.pickupEffectManager.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get PickupEvent(): ISignal<ItemType> {
|
||||||
|
return this.pickupEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public pickupXP(xp: XP): void {
|
public pickupXP(xp: XP): void {
|
||||||
this.pickupEffectManager.showEffect(xp.node.worldPosition);
|
this.pickupEffectManager.showEffect(xp.node.worldPosition);
|
||||||
|
this.pickupEvent.trigger(ItemType.XP);
|
||||||
|
|
||||||
this.player.Level.addXp(xp.Value);
|
this.player.Level.addXp(xp.Value);
|
||||||
xp.pickup();
|
xp.pickup();
|
||||||
@ -47,6 +56,7 @@ export class ItemManager extends Component {
|
|||||||
|
|
||||||
public pickupGold(gold: Gold): void {
|
public pickupGold(gold: Gold): void {
|
||||||
this.pickupEffectManager.showEffect(gold.node.worldPosition);
|
this.pickupEffectManager.showEffect(gold.node.worldPosition);
|
||||||
|
this.pickupEvent.trigger(ItemType.Gold);
|
||||||
|
|
||||||
gold.pickup();
|
gold.pickup();
|
||||||
this.gameResult.goldCoins++;
|
this.gameResult.goldCoins++;
|
||||||
@ -54,6 +64,7 @@ export class ItemManager extends Component {
|
|||||||
|
|
||||||
public pickupHealthPotion(healthPotion: HealthPotion): void {
|
public pickupHealthPotion(healthPotion: HealthPotion): void {
|
||||||
this.pickupEffectManager.showEffect(healthPotion.node.worldPosition);
|
this.pickupEffectManager.showEffect(healthPotion.node.worldPosition);
|
||||||
|
this.pickupEvent.trigger(ItemType.HealthPotion);
|
||||||
|
|
||||||
healthPotion.pickup();
|
healthPotion.pickup();
|
||||||
this.player.Health.heal(this.healthPerPotion);
|
this.player.Health.heal(this.healthPerPotion);
|
||||||
@ -110,3 +121,9 @@ export class ItemManager extends Component {
|
|||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ItemType {
|
||||||
|
XP,
|
||||||
|
Gold,
|
||||||
|
HealthPotion
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Animation, AnimationState, Component, _decorator } from "cc";
|
import { Animation, AnimationState, Component, _decorator } from "cc";
|
||||||
|
import { ISignal } from "../../../../Services/EventSystem/ISignal";
|
||||||
|
import { Signal } from "../../../../Services/EventSystem/Signal";
|
||||||
import { GameTimer } from "../../../../Services/GameTimer";
|
import { GameTimer } from "../../../../Services/GameTimer";
|
||||||
import { WeaponSettings } from "../../../Data/GameSettings";
|
|
||||||
|
|
||||||
import { UpgradableCollider } from "./UpgradableCollider";
|
import { UpgradableCollider } from "./UpgradableCollider";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
@ -10,6 +11,8 @@ export class Weapon extends Component {
|
|||||||
@property(Animation) private weaponAnimation: Animation;
|
@property(Animation) private weaponAnimation: Animation;
|
||||||
@property(UpgradableCollider) private upgradableCollider: UpgradableCollider;
|
@property(UpgradableCollider) private upgradableCollider: UpgradableCollider;
|
||||||
|
|
||||||
|
private weaponStrikeEvent = new Signal<Weapon>();
|
||||||
|
|
||||||
private strikeTimer: GameTimer;
|
private strikeTimer: GameTimer;
|
||||||
private strikeState: AnimationState;
|
private strikeState: AnimationState;
|
||||||
private damage: number;
|
private damage: number;
|
||||||
@ -33,6 +36,10 @@ export class Weapon extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get WeaponStrikeEvent(): ISignal<Weapon> {
|
||||||
|
return this.weaponStrikeEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public get Collider(): UpgradableCollider {
|
public get Collider(): UpgradableCollider {
|
||||||
return this.upgradableCollider;
|
return this.upgradableCollider;
|
||||||
}
|
}
|
||||||
@ -51,6 +58,7 @@ export class Weapon extends Component {
|
|||||||
private strike(): void {
|
private strike(): void {
|
||||||
this.node.active = true;
|
this.node.active = true;
|
||||||
this.weaponAnimation.play(this.strikeState.name);
|
this.weaponAnimation.play(this.strikeState.name);
|
||||||
|
this.weaponStrikeEvent.trigger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private endStrike(): void {
|
private endStrike(): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user