diff --git a/assets/Media/Audio.meta b/assets/Media/Audio.meta new file mode 100644 index 0000000..8fc798a --- /dev/null +++ b/assets/Media/Audio.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "ce9925d5-4409-4530-84ab-7e0cec7a7747", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Media/Audio/Sound.meta b/assets/Media/Audio/Sound.meta new file mode 100644 index 0000000..f82d62a --- /dev/null +++ b/assets/Media/Audio/Sound.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "c6c86a60-ac9b-449a-ba87-c7066c0a9f98", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Media/Prefabs/AppRoot.prefab b/assets/Media/Prefabs/AppRoot.prefab index 05f46fa..543fa97 100644 --- a/assets/Media/Prefabs/AppRoot.prefab +++ b/assets/Media/Prefabs/AppRoot.prefab @@ -17,15 +17,19 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": null, - "_children": [], - "_active": true, - "_components": [ + "_children": [ { "__id__": 2 } ], + "_active": true, + "_components": [ + { + "__id__": 14 + } + ], "_prefab": { - "__id__": 4 + "__id__": 16 }, "_lpos": { "__type__": "cc.Vec3", @@ -55,6 +59,243 @@ }, "_id": "" }, + { + "__type__": "cc.Node", + "_name": "AudioPlayer", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 7 + } + ], + "_active": true, + "_components": [ + { + "__id__": 11 + } + ], + "_prefab": { + "__id__": 13 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "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": "" + }, + { + "__type__": "cc.Node", + "_name": "SoundSource", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 4 + } + ], + "_prefab": { + "__id__": 6 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "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": "" + }, + { + "__type__": "cc.AudioSource", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": { + "__id__": 5 + }, + "_clip": null, + "_loop": false, + "_playOnAwake": false, + "_volume": 1, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "77UXuJEIdANaHvlgcFuOrx" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "1aDYMPapRFMLNmIBbTyeB7" + }, + { + "__type__": "cc.Node", + "_name": "MusicSource", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 8 + } + ], + "_prefab": { + "__id__": 10 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "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": "" + }, + { + "__type__": "cc.AudioSource", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 7 + }, + "_enabled": true, + "__prefab": { + "__id__": 9 + }, + "_clip": null, + "_loop": true, + "_playOnAwake": false, + "_volume": 1, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "833YOi7/5NN4grS+PV/a6t" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "cafhYAziVHcLDM7ubrqoeN" + }, + { + "__type__": "958e24+jRZMdr5ue2HNRuRM", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 12 + }, + "soundSource": { + "__id__": 4 + }, + "musicSource": { + "__id__": 8 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "16TD0T+m1B6qqSPgiaqN/U" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "5eL70HILtD6oNB7UetCf7j" + }, { "__type__": "4943dSvt9FBvLizJ1HhFOzg", "_name": "", @@ -64,7 +305,10 @@ }, "_enabled": true, "__prefab": { - "__id__": 3 + "__id__": 15 + }, + "audio": { + "__id__": 11 }, "settingsAsset": { "__uuid__": "4a156ee8-535e-4443-8bf5-8b979a08d232", diff --git a/assets/Scenes/Game.scene b/assets/Scenes/Game.scene index 813416b..f4dc874 100644 --- a/assets/Scenes/Game.scene +++ b/assets/Scenes/Game.scene @@ -27,11 +27,11 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 96 + "__id__": 98 }, "autoReleaseAssets": false, "_globals": { - "__id__": 99 + "__id__": 101 }, "_id": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f" }, @@ -217,7 +217,7 @@ "__id__": 13 }, { - "__id__": 16 + "__id__": 15 }, { "__id__": 18 @@ -229,25 +229,28 @@ "__id__": 22 }, { - "__id__": 30 + "__id__": 24 }, { - "__id__": 38 + "__id__": 32 + }, + { + "__id__": 40 } ], "_active": true, "_components": [ - { - "__id__": 92 - }, - { - "__id__": 93 - }, { "__id__": 94 }, { "__id__": 95 + }, + { + "__id__": 96 + }, + { + "__id__": 97 } ], "_prefab": null, @@ -281,7 +284,7 @@ }, { "__type__": "cc.Node", - "_name": "Background", + "_name": "GameAudioAdapter", "_objFlags": 0, "_parent": { "__id__": 12 @@ -291,9 +294,67 @@ "_components": [ { "__id__": 14 + } + ], + "_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__": "eb842QdTMFOUJEdwMiA7AJN", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "__prefab": null, + "enemyHit": { + "__uuid__": "c2afb64d-ffcf-4ad4-95b7-1ce1035a2166", + "__expectedType__": "cc.AudioClip" + }, + "_id": "8fIp3RG7RDK6FMarL5A96h" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 12 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 16 }, { - "__id__": 15 + "__id__": 17 } ], "_prefab": null, @@ -330,7 +391,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 13 + "__id__": 15 }, "_enabled": true, "__prefab": null, @@ -351,7 +412,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 13 + "__id__": 15 }, "_enabled": true, "__prefab": null, @@ -390,7 +451,7 @@ "_active": true, "_components": [ { - "__id__": 17 + "__id__": 19 } ], "_prefab": null, @@ -427,7 +488,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 16 + "__id__": 18 }, "_enabled": true, "__prefab": null, @@ -446,64 +507,6 @@ }, "_children": [], "_active": true, - "_components": [ - { - "__id__": 19 - } - ], - "_prefab": null, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "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": 33554432, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "40PiM1C6FJmJW3TkMjCjJU" - }, - { - "__type__": "e3d066A8exFBaWWn2gx4c4j", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 18 - }, - "_enabled": true, - "__prefab": null, - "projectilePrefab": { - "__uuid__": "c6801147-82a9-4992-828b-4d81a3a19531", - "__expectedType__": "cc.Prefab" - }, - "_id": "baKVJ/0StLq68KXHTAnJfR" - }, - { - "__type__": "cc.Node", - "_name": "DiagonalProjectileLauncher", - "_objFlags": 0, - "_parent": { - "__id__": 12 - }, - "_children": [], - "_active": true, "_components": [ { "__id__": 21 @@ -536,7 +539,7 @@ "y": 0, "z": 0 }, - "_id": "8fYTRtNLhAoZ0sqimC3wAp" + "_id": "40PiM1C6FJmJW3TkMjCjJU" }, { "__type__": "e3d066A8exFBaWWn2gx4c4j", @@ -547,6 +550,64 @@ }, "_enabled": true, "__prefab": null, + "projectilePrefab": { + "__uuid__": "c6801147-82a9-4992-828b-4d81a3a19531", + "__expectedType__": "cc.Prefab" + }, + "_id": "baKVJ/0StLq68KXHTAnJfR" + }, + { + "__type__": "cc.Node", + "_name": "DiagonalProjectileLauncher", + "_objFlags": 0, + "_parent": { + "__id__": 12 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 23 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "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": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "8fYTRtNLhAoZ0sqimC3wAp" + }, + { + "__type__": "e3d066A8exFBaWWn2gx4c4j", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "__prefab": null, "projectilePrefab": { "__uuid__": "c9ee6486-ee4f-48cf-b643-e74508c30b05", "__expectedType__": "cc.Prefab" @@ -560,14 +621,14 @@ "__id__": 12 }, "_prefab": { - "__id__": 23 + "__id__": 25 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 22 + "__id__": 24 }, "asset": { "__uuid__": "27c97ec7-9bb8-4e4e-a264-ce49f2ae9843", @@ -575,7 +636,7 @@ }, "fileId": "fbcM/H31RNxK0HvQrwpElL", "instance": { - "__id__": 24 + "__id__": 26 } }, { @@ -584,17 +645,17 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 25 - }, { "__id__": 27 }, { - "__id__": 28 + "__id__": 29 }, { - "__id__": 29 + "__id__": 30 + }, + { + "__id__": 31 } ], "removedComponents": [] @@ -602,7 +663,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 26 + "__id__": 28 }, "propertyPath": [ "_name" @@ -618,7 +679,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 26 + "__id__": 28 }, "propertyPath": [ "_lpos" @@ -633,7 +694,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 26 + "__id__": 28 }, "propertyPath": [ "_lrot" @@ -649,7 +710,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 26 + "__id__": 28 }, "propertyPath": [ "_euler" @@ -669,20 +730,20 @@ "__id__": 12 }, "_children": [ - { - "__id__": 31 - }, { "__id__": 33 }, { "__id__": 35 + }, + { + "__id__": 37 } ], "_active": true, "_components": [ { - "__id__": 37 + "__id__": 39 } ], "_prefab": null, @@ -719,13 +780,13 @@ "_name": "XPSpawner", "_objFlags": 0, "_parent": { - "__id__": 30 + "__id__": 32 }, "_children": [], "_active": true, "_components": [ { - "__id__": 32 + "__id__": 34 } ], "_prefab": null, @@ -762,7 +823,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 31 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -777,13 +838,13 @@ "_name": "GoldSpawner", "_objFlags": 0, "_parent": { - "__id__": 30 + "__id__": 32 }, "_children": [], "_active": true, "_components": [ { - "__id__": 34 + "__id__": 36 } ], "_prefab": null, @@ -820,7 +881,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 33 + "__id__": 35 }, "_enabled": true, "__prefab": null, @@ -835,13 +896,13 @@ "_name": "EnemySpawner", "_objFlags": 0, "_parent": { - "__id__": 30 + "__id__": 32 }, "_children": [], "_active": true, "_components": [ { - "__id__": 36 + "__id__": 38 } ], "_prefab": null, @@ -878,7 +939,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 37 }, "_enabled": true, "__prefab": null, @@ -903,18 +964,18 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 30 + "__id__": 32 }, "_enabled": true, "__prefab": null, "enemySpawner": { - "__id__": 36 + "__id__": 38 }, "xpSpawner": { - "__id__": 32 + "__id__": 34 }, "goldSpawner": { - "__id__": 34 + "__id__": 36 }, "_id": "1ffjazmm5IkZwKInsSIULY" }, @@ -927,28 +988,28 @@ }, "_children": [ { - "__id__": 39 + "__id__": 41 }, { - "__id__": 65 + "__id__": 67 }, { - "__id__": 79 + "__id__": 81 }, { - "__id__": 82 + "__id__": 84 }, { - "__id__": 85 + "__id__": 87 }, { - "__id__": 88 + "__id__": 90 } ], "_active": true, "_components": [ { - "__id__": 91 + "__id__": 93 } ], "_prefab": null, @@ -985,20 +1046,20 @@ "_name": "GameUI", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 40 }, "_children": [ { - "__id__": 40 + "__id__": 42 }, { - "__id__": 55 + "__id__": 57 } ], "_active": true, "_components": [ { - "__id__": 64 + "__id__": 66 } ], "_prefab": null, @@ -1035,23 +1096,23 @@ "_name": "TopUI", "_objFlags": 0, "_parent": { - "__id__": 39 + "__id__": 41 }, "_children": [ { - "__id__": 41 + "__id__": 43 }, { - "__id__": 50 + "__id__": 52 } ], "_active": true, "_components": [ { - "__id__": 53 + "__id__": 55 }, { - "__id__": 54 + "__id__": 56 } ], "_prefab": null, @@ -1088,23 +1149,23 @@ "_name": "XpBar", "_objFlags": 0, "_parent": { - "__id__": 40 + "__id__": 42 }, "_children": [ { - "__id__": 42 + "__id__": 44 }, { - "__id__": 45 + "__id__": 47 } ], "_active": true, "_components": [ { - "__id__": 48 + "__id__": 50 }, { - "__id__": 49 + "__id__": 51 } ], "_prefab": null, @@ -1141,16 +1202,16 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 41 + "__id__": 43 }, "_children": [], "_active": true, "_components": [ { - "__id__": 43 + "__id__": 45 }, { - "__id__": 44 + "__id__": 46 } ], "_prefab": null, @@ -1187,7 +1248,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 42 + "__id__": 44 }, "_enabled": true, "__prefab": null, @@ -1208,7 +1269,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 42 + "__id__": 44 }, "_enabled": true, "__prefab": null, @@ -1246,16 +1307,16 @@ "_name": "MovableBar", "_objFlags": 0, "_parent": { - "__id__": 41 + "__id__": 43 }, "_children": [], "_active": true, "_components": [ { - "__id__": 46 + "__id__": 48 }, { - "__id__": 47 + "__id__": 49 } ], "_prefab": null, @@ -1292,7 +1353,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 45 + "__id__": 47 }, "_enabled": true, "__prefab": null, @@ -1313,7 +1374,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 45 + "__id__": 47 }, "_enabled": true, "__prefab": null, @@ -1351,7 +1412,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 41 + "__id__": 43 }, "_enabled": true, "__prefab": null, @@ -1372,12 +1433,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 41 + "__id__": 43 }, "_enabled": true, "__prefab": null, "_barSprite": { - "__id__": 47 + "__id__": 49 }, "_mode": 0, "_totalLength": 600, @@ -1390,16 +1451,16 @@ "_name": "TimeAliveText", "_objFlags": 0, "_parent": { - "__id__": 40 + "__id__": 42 }, "_children": [], "_active": true, "_components": [ { - "__id__": 51 + "__id__": 53 }, { - "__id__": 52 + "__id__": 54 } ], "_prefab": null, @@ -1436,7 +1497,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 50 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1457,7 +1518,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 50 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1498,7 +1559,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 40 + "__id__": 42 }, "_enabled": true, "__prefab": null, @@ -1519,7 +1580,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 40 + "__id__": 42 }, "_enabled": true, "__prefab": null, @@ -1548,17 +1609,17 @@ "_name": "UI", "_objFlags": 0, "_parent": { - "__id__": 39 + "__id__": 41 }, "_children": [ { - "__id__": 56 + "__id__": 58 } ], "_active": true, "_components": [ { - "__id__": 63 + "__id__": 65 } ], "_prefab": null, @@ -1595,23 +1656,23 @@ "_name": "VirtualJoystic", "_objFlags": 0, "_parent": { - "__id__": 55 + "__id__": 57 }, "_children": [ { - "__id__": 57 + "__id__": 59 } ], "_active": true, "_components": [ - { - "__id__": 60 - }, - { - "__id__": 61 - }, { "__id__": 62 + }, + { + "__id__": 63 + }, + { + "__id__": 64 } ], "_prefab": null, @@ -1648,16 +1709,16 @@ "_name": "Knob", "_objFlags": 0, "_parent": { - "__id__": 56 + "__id__": 58 }, "_children": [], "_active": true, "_components": [ { - "__id__": 58 + "__id__": 60 }, { - "__id__": 59 + "__id__": 61 } ], "_prefab": null, @@ -1694,7 +1755,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 57 + "__id__": 59 }, "_enabled": true, "__prefab": null, @@ -1715,7 +1776,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 57 + "__id__": 59 }, "_enabled": true, "__prefab": null, @@ -1753,7 +1814,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 56 + "__id__": 58 }, "_enabled": true, "__prefab": null, @@ -1774,7 +1835,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 56 + "__id__": 58 }, "_enabled": true, "__prefab": null, @@ -1812,13 +1873,13 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 56 + "__id__": 58 }, "_enabled": true, "__prefab": null, "maxDistance": 50, "knob": { - "__id__": 57 + "__id__": 59 }, "_id": "50ceZG62tGlYXvZWEvSDKl" }, @@ -1827,7 +1888,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 55 + "__id__": 57 }, "_enabled": true, "__prefab": null, @@ -1848,15 +1909,15 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 39 + "__id__": 41 }, "_enabled": true, "__prefab": null, "xpBar": { - "__id__": 49 + "__id__": 51 }, "timeAliveText": { - "__id__": 52 + "__id__": 54 }, "_id": "bau/7eItRFrKKoAZZb/uYL" }, @@ -1865,20 +1926,20 @@ "_name": "ModalWindowManager", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 40 }, "_children": [ { - "__id__": 66 + "__id__": 68 } ], "_active": true, "_components": [ { - "__id__": 77 + "__id__": 79 }, { - "__id__": 78 + "__id__": 80 } ], "_prefab": null, @@ -1914,17 +1975,17 @@ "__type__": "cc.Node", "_objFlags": 0, "_parent": { - "__id__": 65 + "__id__": 67 }, "_prefab": { - "__id__": 67 + "__id__": 69 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 66 + "__id__": 68 }, "asset": { "__uuid__": "663674aa-da1c-44b0-8049-49db9b020973", @@ -1932,11 +1993,11 @@ }, "fileId": "32U/bJCUBDlaQxxGFNXZTu", "instance": { - "__id__": 68 + "__id__": 70 }, "targetOverrides": [ { - "__id__": 75 + "__id__": 77 } ] }, @@ -1946,20 +2007,20 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 69 - }, { "__id__": 71 }, - { - "__id__": 72 - }, { "__id__": 73 }, { "__id__": 74 + }, + { + "__id__": 75 + }, + { + "__id__": 76 } ], "removedComponents": [] @@ -1967,7 +2028,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 70 + "__id__": 72 }, "propertyPath": [ "_name" @@ -1983,7 +2044,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 70 + "__id__": 72 }, "propertyPath": [ "_lpos" @@ -1998,7 +2059,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 70 + "__id__": 72 }, "propertyPath": [ "_lrot" @@ -2014,7 +2075,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 70 + "__id__": 72 }, "propertyPath": [ "_euler" @@ -2029,7 +2090,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 70 + "__id__": 72 }, "propertyPath": [ "_active" @@ -2046,7 +2107,7 @@ ], "target": null, "targetInfo": { - "__id__": 76 + "__id__": 78 } }, { @@ -2060,7 +2121,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 65 + "__id__": 67 }, "_enabled": true, "__prefab": null, @@ -2081,7 +2142,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 65 + "__id__": 67 }, "_enabled": true, "__prefab": null, @@ -2098,16 +2159,16 @@ "_name": "Sprite", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 40 }, "_children": [], "_active": true, "_components": [ { - "__id__": 80 + "__id__": 82 }, { - "__id__": 81 + "__id__": 83 } ], "_prefab": null, @@ -2144,7 +2205,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 79 + "__id__": 81 }, "_enabled": true, "__prefab": null, @@ -2165,7 +2226,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 79 + "__id__": 81 }, "_enabled": true, "__prefab": null, @@ -2203,16 +2264,16 @@ "_name": "Sprite-001", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 40 }, "_children": [], "_active": true, "_components": [ { - "__id__": 83 + "__id__": 85 }, { - "__id__": 84 + "__id__": 86 } ], "_prefab": null, @@ -2249,7 +2310,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 82 + "__id__": 84 }, "_enabled": true, "__prefab": null, @@ -2270,7 +2331,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 82 + "__id__": 84 }, "_enabled": true, "__prefab": null, @@ -2308,16 +2369,16 @@ "_name": "Sprite-002", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 40 }, "_children": [], "_active": true, "_components": [ { - "__id__": 86 + "__id__": 88 }, { - "__id__": 87 + "__id__": 89 } ], "_prefab": null, @@ -2354,7 +2415,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 85 + "__id__": 87 }, "_enabled": true, "__prefab": null, @@ -2375,7 +2436,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 85 + "__id__": 87 }, "_enabled": true, "__prefab": null, @@ -2413,16 +2474,16 @@ "_name": "Sprite-003", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 40 }, "_children": [], "_active": true, "_components": [ { - "__id__": 89 + "__id__": 91 }, { - "__id__": 90 + "__id__": 92 } ], "_prefab": null, @@ -2459,7 +2520,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 88 + "__id__": 90 }, "_enabled": true, "__prefab": null, @@ -2480,7 +2541,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 88 + "__id__": 90 }, "_enabled": true, "__prefab": null, @@ -2518,7 +2579,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 38 + "__id__": 40 }, "_enabled": true, "__prefab": null, @@ -2587,7 +2648,7 @@ "_enabled": true, "__prefab": null, "_cameraComponent": { - "__id__": 91 + "__id__": 93 }, "_alignCanvasWithScreen": true, "_id": "12O/ljcVlEqLmVm3U2gEOQ" @@ -2631,32 +2692,35 @@ "_enabled": true, "__prefab": null, "virtualJoystic": { - "__id__": 62 + "__id__": 64 }, "player": null, "haloProjectileLauncherComponent": { - "__id__": 17 - }, - "horizontalProjectileLauncherComponent": { "__id__": 19 }, - "diagonalProjectileLauncherComponent": { + "horizontalProjectileLauncherComponent": { "__id__": 21 }, + "diagonalProjectileLauncherComponent": { + "__id__": 23 + }, "enemyManager": { - "__id__": 37 + "__id__": 39 }, "camera": { - "__id__": 91 + "__id__": 93 }, "gameUI": { - "__id__": 64 + "__id__": 66 }, "background": { - "__id__": 15 + "__id__": 17 }, "modalWindowManager": { - "__id__": 78 + "__id__": 80 + }, + "gameAudioAdapter": { + "__id__": 14 }, "_id": "3a9z1bqlFCGL4/WyDwU4L5" }, @@ -2665,7 +2729,7 @@ "fileId": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f", "targetOverrides": [ { - "__id__": 97 + "__id__": 99 } ], "nestedPrefabInstanceRoots": [ @@ -2673,27 +2737,27 @@ "__id__": 2 }, { - "__id__": 22 + "__id__": 24 }, { - "__id__": 66 + "__id__": 68 } ] }, { "__type__": "cc.TargetOverrideInfo", "source": { - "__id__": 95 + "__id__": 97 }, "sourceInfo": null, "propertyPath": [ "player" ], "target": { - "__id__": 22 + "__id__": 24 }, "targetInfo": { - "__id__": 98 + "__id__": 100 } }, { @@ -2705,19 +2769,19 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 100 - }, - "shadows": { - "__id__": 101 - }, - "_skybox": { "__id__": 102 }, - "fog": { + "shadows": { "__id__": 103 }, - "octree": { + "_skybox": { "__id__": 104 + }, + "fog": { + "__id__": 105 + }, + "octree": { + "__id__": 106 } }, { diff --git a/assets/Scripts/AppRoot/AppRoot.ts b/assets/Scripts/AppRoot/AppRoot.ts index 236922d..763f37e 100644 --- a/assets/Scripts/AppRoot/AppRoot.ts +++ b/assets/Scripts/AppRoot/AppRoot.ts @@ -1,13 +1,13 @@ -import { _decorator, Component, Node, director, AudioSource, JsonAsset } from "cc"; +import { Component, director, JsonAsset, _decorator } from "cc"; import { GameSettings } from "../Game/Data/GameSettings"; import { TranslationData } from "../Game/Data/TranslationData"; +import { AudioPlayer } from "../Services/AudioPlayer/AudioPlayer"; import { SaveSystem } from "./SaveSystem"; const { ccclass, property } = _decorator; @ccclass("AppRoot") export class AppRoot extends Component { - @property(AudioSource) private soundSource: AudioSource; - @property(AudioSource) private musicSource: AudioSource; + @property(AudioPlayer) private audio: AudioPlayer; @property(JsonAsset) private settingsAsset: JsonAsset; @property(JsonAsset) private engTranslationAsset: JsonAsset; @@ -18,6 +18,10 @@ export class AppRoot extends Component { return this.instance; } + public get AudioPlayer(): AudioPlayer { + return this.audio; + } + public get SaveSystem(): SaveSystem { return this.saveSystem; } @@ -42,5 +46,6 @@ export class AppRoot extends Component { private init(): void { this.saveSystem = new SaveSystem(); + this.audio.init(1, 1); } } diff --git a/assets/Scripts/Game/Audio.meta b/assets/Scripts/Game/Audio.meta new file mode 100644 index 0000000..05561ea --- /dev/null +++ b/assets/Scripts/Game/Audio.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "263ab535-5757-4b2b-adc1-04823e77e433", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Scripts/Game/Audio/GameAudioAdapter.ts b/assets/Scripts/Game/Audio/GameAudioAdapter.ts new file mode 100644 index 0000000..ad4874c --- /dev/null +++ b/assets/Scripts/Game/Audio/GameAudioAdapter.ts @@ -0,0 +1,32 @@ +import { _decorator, Component, Node, AudioClip } from "cc"; +import { AppRoot } from "../../AppRoot/AppRoot"; +import { AudioPlayer } from "../../Services/AudioPlayer/AudioPlayer"; +import { Enemy } from "../Unit/Enemy/Enemy"; +import { EnemyManager } from "../Unit/Enemy/EnemyManager"; +const { ccclass, property } = _decorator; + +@ccclass("GameAudioAdapter") +export class GameAudioAdapter extends Component { + @property(AudioClip) private enemyHit: AudioClip; + + private audioPlayer: AudioPlayer; + + public init(enemyManager: EnemyManager): void { + this.audioPlayer = AppRoot.Instance.AudioPlayer; + + enemyManager.EnemyAddedEvent.on(this.addEnemyListeners, this); + enemyManager.EnemyRemovedEvent.on(this.removeEnemyListeners, this); + } + + private addEnemyListeners(enemy: Enemy): void { + enemy.Health.HealthPointsChangeEvent.on(this.playEnemyHitSound, this); + } + + private removeEnemyListeners(enemy: Enemy): void { + enemy.Health.HealthPointsChangeEvent.off(this.playEnemyHitSound); + } + + private playEnemyHitSound(): void { + this.audioPlayer.playSound(this.enemyHit); + } +} diff --git a/assets/Scripts/Game/Audio/GameAudioAdapter.ts.meta b/assets/Scripts/Game/Audio/GameAudioAdapter.ts.meta new file mode 100644 index 0000000..7c9ff01 --- /dev/null +++ b/assets/Scripts/Game/Audio/GameAudioAdapter.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "eb84241d-4cc1-4e50-911d-c0c880ec024d", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/Game/Game.ts b/assets/Scripts/Game/Game.ts index bb90684..85857e0 100644 --- a/assets/Scripts/Game/Game.ts +++ b/assets/Scripts/Game/Game.ts @@ -2,6 +2,7 @@ import { Camera, Component, JsonAsset, KeyCode, Vec2, _decorator } from "cc"; import { runInThisContext } from "vm"; import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager"; import { delay } from "../Services/Utils/AsyncUtils"; +import { GameAudioAdapter } from "./Audio/GameAudioAdapter"; import { Background } from "./Background/Background"; import { PlayerCollisionSystem } from "./Collision/PlayerCollisionSystem"; import { PlayerProjectileCollisionSystem } from "./Collision/PlayerProjectileCollisionSystem"; @@ -39,6 +40,7 @@ export class Game extends Component { @property(GameUI) private gameUI: GameUI; @property(Background) private background: Background; @property(ModalWindowManager) private modalWindowManager: ModalWindowManager; + @property(GameAudioAdapter) private gameAudioAdapter: GameAudioAdapter; private playerCollisionSystem: PlayerCollisionSystem; private haloProjectileLauncher: HaloProjectileLauncher; @@ -127,6 +129,7 @@ export class Game extends Component { this.player.Level.addXp(testValues.startXP); } + this.gameAudioAdapter.init(this.enemyManager); this.gamePauser.resume(); while (this.player.Health.IsAlive) await delay(100); diff --git a/assets/Scripts/Game/Unit/Enemy/EnemyManager.ts b/assets/Scripts/Game/Unit/Enemy/EnemyManager.ts index e394ae5..8079bd4 100644 --- a/assets/Scripts/Game/Unit/Enemy/EnemyManager.ts +++ b/assets/Scripts/Game/Unit/Enemy/EnemyManager.ts @@ -1,5 +1,5 @@ import { Component, Node, random, randomRange, Vec3, _decorator } from "cc"; - +import { ISignal } from "../../../Services/EventSystem/ISignal"; import { EnemyManagerSettings } from "../../Data/GameSettings"; import { GoldSpawner } from "../../Gold/GoldSpawner"; import { XPSpawner } from "../../XP/XPSpawner"; @@ -30,7 +30,7 @@ export class EnemyManager extends Component { public init(targetNode: Node, settings: EnemyManagerSettings): void { this.enemySpawner.init(targetNode, settings.enemies); this.enemySpawner.EnemyAddedEvent.on(this.onEnemyAdded, this); - this.enemySpawner.enemyRemovedEvent.on(this.onRemoveEnemy, this); + this.enemySpawner.EnemyRemovedEvent.on(this.onEnemyRemoved, this); for (const individualSpawnerSettings of settings.individualEnemySpawners) { const individualSpawner = new IndividualEnemySpawner(this.enemySpawner, individualSpawnerSettings); @@ -65,10 +65,25 @@ export class EnemyManager extends Component { } } - private onEnemyDied(enemy: Enemy): void { - enemy.DeathEvent.off(this.onEnemyDied); - enemy.LifetimeEndedEvent.off(this.onEnemyLifetimeEnded); + public get EnemyAddedEvent(): ISignal { + return this.enemySpawner.EnemyAddedEvent; + } + public get EnemyRemovedEvent(): ISignal { + return this.enemySpawner.EnemyRemovedEvent; + } + + private onEnemyAdded(enemy: Enemy): void { + enemy.DeathEvent.on(this.onEnemyDied, this); + this.getEnemyMover(enemy).addEnemy(enemy); + } + + private onEnemyRemoved(enemy: Enemy): void { + enemy.DeathEvent.off(this.onEnemyDied); + this.getEnemyMover(enemy).removeEnemy(enemy); + } + + private onEnemyDied(enemy: Enemy): void { for (let index = 0; index < enemy.XPReward; index++) { const position: Vec3 = enemy.node.worldPosition; position.x += randomRange(-10, 10); @@ -92,22 +107,6 @@ export class EnemyManager extends Component { } } - private onEnemyLifetimeEnded(enemy: Enemy): void { - enemy.DeathEvent.off(this.onEnemyDied); - enemy.LifetimeEndedEvent.off(this.onEnemyLifetimeEnded); - } - - private onEnemyAdded(enemy: Enemy): void { - enemy.DeathEvent.on(this.onEnemyDied, this); - enemy.LifetimeEndedEvent.on(this.onEnemyLifetimeEnded, this); - - this.getEnemyMover(enemy).addEnemy(enemy); - } - - private onRemoveEnemy(enemy: Enemy): void { - this.getEnemyMover(enemy).removeEnemy(enemy); - } - private getEnemyMover(enemy: Enemy): EnemyMover { if (this.movementTypeToMover.has(enemy.MovementType)) { return this.movementTypeToMover.get(enemy.MovementType); diff --git a/assets/Scripts/Game/Unit/Enemy/EnemySpawner/EnemySpawner.ts b/assets/Scripts/Game/Unit/Enemy/EnemySpawner/EnemySpawner.ts index 05e8959..34752e3 100644 --- a/assets/Scripts/Game/Unit/Enemy/EnemySpawner/EnemySpawner.ts +++ b/assets/Scripts/Game/Unit/Enemy/EnemySpawner/EnemySpawner.ts @@ -12,8 +12,8 @@ const { ccclass, property } = _decorator; export class EnemySpawner extends Component { @property(Prefab) private enemies: Prefab[] = []; - public enemyAddedEvent: Signal = new Signal(); - public enemyRemovedEvent: Signal = new Signal(); + private enemyAddedEvent: Signal = new Signal(); + private enemyRemovedEvent: Signal = new Signal(); private enemyGraphicsTypeToPool = new Map>(); private targetNode: Node; diff --git a/assets/Scripts/Services/AudioPlayer.meta b/assets/Scripts/Services/AudioPlayer.meta new file mode 100644 index 0000000..803a86f --- /dev/null +++ b/assets/Scripts/Services/AudioPlayer.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "d887156b-67db-40b0-ab80-680c7400ba2a", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Scripts/Services/AudioPlayer/AudioPlayer.ts b/assets/Scripts/Services/AudioPlayer/AudioPlayer.ts new file mode 100644 index 0000000..8084121 --- /dev/null +++ b/assets/Scripts/Services/AudioPlayer/AudioPlayer.ts @@ -0,0 +1,30 @@ +import { AudioClip, AudioSource, Component, _decorator } from "cc"; +const { ccclass, property } = _decorator; + +@ccclass("AudioPlayer") +export class AudioPlayer extends Component { + @property(AudioSource) private soundSource: AudioSource; + @property(AudioSource) private musicSource: AudioSource; + + public init(soundVolume: number, musicVolume: number): void { + this.setSoundVolume(soundVolume); + this.setMusicVolume(musicVolume); + } + + public setSoundVolume(volume: number): void { + this.soundSource.volume = volume; + } + + public setMusicVolume(volume: number): void { + this.musicSource.volume = volume; + } + + public playSound(clip: AudioClip): void { + this.soundSource.playOneShot(clip); + } + + public playMusic(clip: AudioClip): void { + this.musicSource.clip = clip; + this.musicSource.play(); + } +} diff --git a/assets/Scripts/Services/AudioPlayer/AudioPlayer.ts.meta b/assets/Scripts/Services/AudioPlayer/AudioPlayer.ts.meta new file mode 100644 index 0000000..1d7e6df --- /dev/null +++ b/assets/Scripts/Services/AudioPlayer/AudioPlayer.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "958e2e3e-8d16-4c76-be6e-7b61cd46e44c", + "files": [], + "subMetas": {}, + "userData": {} +}