From afc94488267cb8755fd8a783933e914652e8065e Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 23 Dec 2022 09:52:26 +0100 Subject: [PATCH] Chest and magnet spawning --- assets/Data/GameSettings.json | 44 ++++-- .../Audio/Game/Sound/01_chest_open_1.wav | Bin 0 -> 118336 bytes .../Audio/Game/Sound/01_chest_open_1.wav.meta | 14 ++ .../Prefabs/Game/GameAudioAdapter.prefab | 8 ++ assets/Scenes/Game.scene | 133 ++++-------------- assets/Scripts/Game/Audio/GameAudioAdapter.ts | 8 ++ assets/Scripts/Game/Data/GameSettings.ts | 2 + assets/Scripts/Game/Items/ItemManager.ts | 23 +-- assets/Scripts/Game/Unit/Enemy/Enemy.ts | 12 ++ 9 files changed, 119 insertions(+), 125 deletions(-) create mode 100644 assets/Media/Audio/Game/Sound/01_chest_open_1.wav create mode 100644 assets/Media/Audio/Game/Sound/01_chest_open_1.wav.meta diff --git a/assets/Data/GameSettings.json b/assets/Data/GameSettings.json index 69d6ec3..681a648 100644 --- a/assets/Data/GameSettings.json +++ b/assets/Data/GameSettings.json @@ -155,7 +155,9 @@ "lifetime": -1, "xpReward": 1, "goldReward": 0, - "healthPotionRewardChance": 0.05 + "healthPotionRewardChance": 0.05, + "magnetRewardChance": 0.5, + "chestRewardChance": 0.5 }, { "id": "StandardEnemy", @@ -167,7 +169,9 @@ "lifetime": -1, "xpReward": 1, "goldReward": 0.1, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "FastEnemy", @@ -179,7 +183,9 @@ "lifetime": -1, "xpReward": 1, "goldReward": 0.1, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "CircleEnemy", @@ -191,7 +197,9 @@ "lifetime": 29, "xpReward": 1, "goldReward": 1, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "CircleEnemyStandard", @@ -203,7 +211,9 @@ "lifetime": 27, "xpReward": 1, "goldReward": 2, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "WaveEnemy", @@ -215,7 +225,9 @@ "lifetime": 20, "xpReward": 1, "goldReward": 0.2, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "WaveEnemyArmor", @@ -227,7 +239,9 @@ "lifetime": 30, "xpReward": 1, "goldReward": 1, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "WaveEnemyArmorFast", @@ -239,7 +253,9 @@ "lifetime": 30, "xpReward": 1, "goldReward": 1, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "BasicBoss", @@ -251,7 +267,9 @@ "lifetime": -1, "xpReward": 1, "goldReward": 3, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "StandardBoss", @@ -263,7 +281,9 @@ "lifetime": -1, "xpReward": 2, "goldReward": 5, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 }, { "id": "BasicCheetah", @@ -275,7 +295,9 @@ "lifetime": -1, "xpReward": 1, "goldReward": 1, - "healthPotionRewardChance": 0 + "healthPotionRewardChance": 0, + "magnetRewardChance": 0, + "chestRewardChance": 0 } ], "periodicFollowMovers": [ diff --git a/assets/Media/Audio/Game/Sound/01_chest_open_1.wav b/assets/Media/Audio/Game/Sound/01_chest_open_1.wav new file mode 100644 index 0000000000000000000000000000000000000000..eff087d62d91a1125b94655d4f800a405d0f5a0a GIT binary patch literal 118336 zcmeIb3D{0$+xLC0;T*1+D`SXEDG^dA70J*fX+TN{rHC{mDh+ojAwte6CF28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=|S2SObP zbs*G%PzORC2z4OTflvoR9SC(G)PYb3LLCToAk=|S2SObPbs*G%PzORC`2VL4{11eh B*|-1z literal 0 HcmV?d00001 diff --git a/assets/Media/Audio/Game/Sound/01_chest_open_1.wav.meta b/assets/Media/Audio/Game/Sound/01_chest_open_1.wav.meta new file mode 100644 index 0000000..f17c5d9 --- /dev/null +++ b/assets/Media/Audio/Game/Sound/01_chest_open_1.wav.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.0.0", + "importer": "audio-clip", + "imported": true, + "uuid": "a26cfab9-1d95-4f99-83bf-297696072f6c", + "files": [ + ".json", + ".wav" + ], + "subMetas": {}, + "userData": { + "downloadMode": 0 + } +} diff --git a/assets/Media/Prefabs/Game/GameAudioAdapter.prefab b/assets/Media/Prefabs/Game/GameAudioAdapter.prefab index ffb0e3d..4f1b892 100644 --- a/assets/Media/Prefabs/Game/GameAudioAdapter.prefab +++ b/assets/Media/Prefabs/Game/GameAudioAdapter.prefab @@ -98,6 +98,14 @@ "__uuid__": "b1564752-035d-4989-aed0-2c0684d8a0e9", "__expectedType__": "cc.AudioClip" }, + "magnetPickup": { + "__uuid__": "a26cfab9-1d95-4f99-83bf-297696072f6c", + "__expectedType__": "cc.AudioClip" + }, + "chestPickup": { + "__uuid__": "a26cfab9-1d95-4f99-83bf-297696072f6c", + "__expectedType__": "cc.AudioClip" + }, "levelUp": { "__uuid__": "4bf29238-2767-4178-a74a-3c2857685265", "__expectedType__": "cc.AudioClip" diff --git a/assets/Scenes/Game.scene b/assets/Scenes/Game.scene index d8b9932..1fa3e93 100644 --- a/assets/Scenes/Game.scene +++ b/assets/Scenes/Game.scene @@ -27,7 +27,7 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 116 + "__id__": 114 }, "autoReleaseAssets": false, "_globals": { @@ -3341,115 +3341,16 @@ "modalWindowManager": { "__id__": 96 }, - "gameAudioAdapter": { - "__id__": 114 - }, + "gameAudioAdapter": null, "_id": "3a9z1bqlFCGL4/WyDwU4L5" }, - { - "__type__": "eb842QdTMFOUJEdwMiA7AJN", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 115 - }, - "_enabled": true, - "__prefab": null, - "music": { - "__uuid__": "0faecdcf-e5d6-4cc1-b3cf-3b2873f8ee62", - "__expectedType__": "cc.AudioClip" - }, - "enemyHit": { - "__uuid__": "efed223f-7b17-47ad-b265-7a951ace6d85", - "__expectedType__": "cc.AudioClip" - }, - "playerHit": { - "__uuid__": "99fb12ce-b248-4560-85fd-c1a61689adf2", - "__expectedType__": "cc.AudioClip" - }, - "playerDeath": { - "__uuid__": "68ebed5f-544b-4337-a49c-d4ba32e8e6a2", - "__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" - }, - "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" - }, - { - "__type__": "cc.Node", - "_name": "GameAudioAdapter", - "_objFlags": 0, - "_parent": null, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 114 - } - ], - "_prefab": null, - "_lpos": { - "__type__": "cc.Vec3", - "x": -319.99999999999994, - "y": -479.99999999999994, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "62B+OqAzROoon1s4L/Ur4W" - }, { "__type__": "cc.PrefabInfo", "fileId": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f", "targetOverrides": [ + { + "__id__": 115 + }, { "__id__": 117 } @@ -3479,7 +3380,7 @@ "__id__": 32 }, "targetInfo": { - "__id__": 118 + "__id__": 116 } }, { @@ -3488,6 +3389,28 @@ "73GtzRGABId6PSqMhTW/3T" ] }, + { + "__type__": "cc.TargetOverrideInfo", + "source": { + "__id__": 113 + }, + "sourceInfo": null, + "propertyPath": [ + "gameAudioAdapter" + ], + "target": { + "__id__": 13 + }, + "targetInfo": { + "__id__": 118 + } + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "b2ILEwH8JJmYiJlSWbxV6z" + ] + }, { "__type__": "cc.SceneGlobals", "ambient": { diff --git a/assets/Scripts/Game/Audio/GameAudioAdapter.ts b/assets/Scripts/Game/Audio/GameAudioAdapter.ts index 8cca900..56a737f 100644 --- a/assets/Scripts/Game/Audio/GameAudioAdapter.ts +++ b/assets/Scripts/Game/Audio/GameAudioAdapter.ts @@ -20,6 +20,8 @@ export class GameAudioAdapter extends Component { @property(AudioClip) private xpPickup: AudioClip; @property(AudioClip) private goldPickup: AudioClip; @property(AudioClip) private healthPotionPickup: AudioClip; + @property(AudioClip) private magnetPickup: AudioClip; + @property(AudioClip) private chestPickup: AudioClip; @property(AudioClip) private levelUp: AudioClip; @property(AudioClip) private horizontalProjectileLaunch: AudioClip; @property(AudioClip) private diagonalProjectileLaunch: AudioClip; @@ -89,6 +91,12 @@ export class GameAudioAdapter extends Component { case ItemType.HealthPotion: clipToPlay = this.healthPotionPickup; break; + case ItemType.Magnet: + clipToPlay = this.magnetPickup; + break; + case ItemType.Chest: + clipToPlay = this.chestPickup; + break; default: break; } diff --git a/assets/Scripts/Game/Data/GameSettings.ts b/assets/Scripts/Game/Data/GameSettings.ts index 5f0bf57..a99077b 100644 --- a/assets/Scripts/Game/Data/GameSettings.ts +++ b/assets/Scripts/Game/Data/GameSettings.ts @@ -127,6 +127,8 @@ export class EnemySettings { public xpReward = 0; public goldReward = 0; public healthPotionRewardChance = 0; + public magnetRewardChance = 0; + public chestRewardChance = 0; } export class ItemSettings { diff --git a/assets/Scripts/Game/Items/ItemManager.ts b/assets/Scripts/Game/Items/ItemManager.ts index a28b9e5..2aa6480 100644 --- a/assets/Scripts/Game/Items/ItemManager.ts +++ b/assets/Scripts/Game/Items/ItemManager.ts @@ -49,6 +49,8 @@ export class ItemManager extends Component { this.itemTypeToAction.set(ItemType.XP, this.addXP.bind(this)); this.itemTypeToAction.set(ItemType.Gold, this.addGold.bind(this)); this.itemTypeToAction.set(ItemType.HealthPotion, this.useHealthPotion.bind(this)); + this.itemTypeToAction.set(ItemType.Magnet, this.activateMagnet.bind(this)); + this.itemTypeToAction.set(ItemType.Chest, this.giveRandomSkill.bind(this)); } public get PickupEvent(): ISignal { @@ -78,6 +80,10 @@ export class ItemManager extends Component { this.player.Health.heal(this.healthPerPotion); } + private activateMagnet(): void {} + + private giveRandomSkill(): void {} + private addEnemyListeners(enemy: Enemy): void { enemy.DeathEvent.on(this.trySpawnItems, this); } @@ -89,7 +95,9 @@ export class ItemManager extends Component { private trySpawnItems(enemy: Enemy): void { this.trySpawnXP(enemy); this.trySpawnGold(enemy); - this.trySpawnHealthPotion(enemy); + ItemManager.trySpawnOnce(enemy.HealthPotionRewardChance, this.healthPotionSpawner, this.getRandomPosition(enemy)); + ItemManager.trySpawnOnce(enemy.MagnetRewardChance, this.magnetSpawner, this.getRandomPosition(enemy)); + ItemManager.trySpawnOnce(enemy.ChestRewardChance, this.chestSpawner, this.getRandomPosition(enemy)); } private trySpawnXP(enemy: Enemy): void { @@ -112,19 +120,16 @@ export class ItemManager extends Component { } } - private trySpawnHealthPotion(enemy: Enemy): void { - if (enemy.HealthPotionRewardChance <= 0) return; - - console.log("random: " + random() + " chance " + enemy.HealthPotionRewardChance); - if (random() < enemy.HealthPotionRewardChance) { - this.healthPotionSpawner.spawn(enemy.node.worldPosition); + private static trySpawnOnce(chance: number, itemSpawner: ItemSpawner, worldPosition: Vec3): void { + if (random() < chance) { + itemSpawner.spawn(worldPosition); } } private getRandomPosition(enemy: Enemy): Vec3 { const position: Vec3 = enemy.node.worldPosition; - position.x += randomRange(-10, 10); - position.y += randomRange(-10, 10); + position.x += randomRange(-15, 15); + position.y += randomRange(-15, 15); return position; } diff --git a/assets/Scripts/Game/Unit/Enemy/Enemy.ts b/assets/Scripts/Game/Unit/Enemy/Enemy.ts index 24809b8..c69b38d 100644 --- a/assets/Scripts/Game/Unit/Enemy/Enemy.ts +++ b/assets/Scripts/Game/Unit/Enemy/Enemy.ts @@ -29,6 +29,8 @@ export class Enemy extends Component { private xpReward: number; private goldReward: number; private healthPotionRewardChance: number; + private magnetRewardChance: number; + private chestRewardChance: number; private endOfLifetimeTriggered = false; @@ -44,6 +46,8 @@ export class Enemy extends Component { this.xpReward = settings.xpReward; this.goldReward = settings.goldReward; this.healthPotionRewardChance = settings.healthPotionRewardChance; + this.magnetRewardChance = settings.magnetRewardChance; + this.chestRewardChance = settings.chestRewardChance; this.node.setWorldPosition(position); this.node.active = true; @@ -88,6 +92,14 @@ export class Enemy extends Component { return this.healthPotionRewardChance; } + public get MagnetRewardChance(): number { + return this.magnetRewardChance; + } + + public get ChestRewardChance(): number { + return this.chestRewardChance; + } + public get LifetimeEndedEvent(): ISignal { return this.lifetimeEndedEvent; }