diff --git a/assets/Data/GameSettings.json b/assets/Data/GameSettings.json index 558dbc2..b379972 100644 --- a/assets/Data/GameSettings.json +++ b/assets/Data/GameSettings.json @@ -20,10 +20,14 @@ "damage": 1 }, "haloLauncher": { - "projectileLifetime": 2, - "projectileSpeed": 150, "projectilesToSpawn": 24, - "cooldown": 10 + "launcher": { + "projectileLifetime": 5, + "projectileSpeed": 150, + "wavesToShoot": 1, + "wavesDelayMs": 0, + "cooldown": 10 + } } }, "upgrades": { diff --git a/assets/Scenes/scene.scene b/assets/Scenes/scene.scene index cec10e3..18b0883 100644 --- a/assets/Scenes/scene.scene +++ b/assets/Scenes/scene.scene @@ -21,11 +21,11 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 116 + "__id__": 118 }, "autoReleaseAssets": false, "_globals": { - "__id__": 117 + "__id__": 119 }, "_id": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f" }, @@ -44,25 +44,28 @@ "__id__": 5 }, { - "__id__": 55 + "__id__": 7 }, { - "__id__": 61 + "__id__": 57 + }, + { + "__id__": 63 } ], "_active": true, "_components": [ - { - "__id__": 112 - }, - { - "__id__": 113 - }, { "__id__": 114 }, { "__id__": 115 + }, + { + "__id__": 116 + }, + { + "__id__": 117 } ], "_prefab": null, @@ -152,6 +155,64 @@ }, "_id": "02VMV6hX5L5pm3W9sOTjZt" }, + { + "__type__": "cc.Node", + "_name": "VerticalProjectileLauncher", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 6 + } + ], + "_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__": 5 + }, + "_enabled": true, + "__prefab": null, + "projectilePrefab": { + "__uuid__": "ff0be112-7028-424c-87b8-fc54a106015a", + "__expectedType__": "cc.Prefab" + }, + "_id": "baKVJ/0StLq68KXHTAnJfR" + }, { "__type__": "cc.Node", "_name": "Player", @@ -161,25 +222,25 @@ }, "_children": [ { - "__id__": 6 + "__id__": 8 }, { - "__id__": 21 + "__id__": 23 } ], "_active": true, "_components": [ - { - "__id__": 51 - }, - { - "__id__": 52 - }, { "__id__": 53 }, { "__id__": 54 + }, + { + "__id__": 55 + }, + { + "__id__": 56 } ], "_prefab": null, @@ -216,20 +277,20 @@ "_name": "PlayerUI", "_objFlags": 0, "_parent": { - "__id__": 5 + "__id__": 7 }, "_children": [ { - "__id__": 7 + "__id__": 9 } ], "_active": true, "_components": [ { - "__id__": 19 + "__id__": 21 }, { - "__id__": 20 + "__id__": 22 } ], "_prefab": null, @@ -266,23 +327,23 @@ "_name": "PlayerHealthUI", "_objFlags": 0, "_parent": { - "__id__": 6 + "__id__": 8 }, "_children": [ { - "__id__": 8 + "__id__": 10 }, { - "__id__": 11 + "__id__": 13 } ], "_active": true, "_components": [ { - "__id__": 17 + "__id__": 19 }, { - "__id__": 18 + "__id__": 20 } ], "_prefab": null, @@ -319,16 +380,16 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 7 + "__id__": 9 }, "_children": [], "_active": true, "_components": [ { - "__id__": 9 + "__id__": 11 }, { - "__id__": 10 + "__id__": 12 } ], "_prefab": null, @@ -365,7 +426,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 8 + "__id__": 10 }, "_enabled": true, "__prefab": null, @@ -386,7 +447,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 8 + "__id__": 10 }, "_enabled": true, "__prefab": null, @@ -424,20 +485,20 @@ "_name": "HpBar", "_objFlags": 0, "_parent": { - "__id__": 7 + "__id__": 9 }, "_children": [ { - "__id__": 12 + "__id__": 14 } ], "_active": true, "_components": [ { - "__id__": 15 + "__id__": 17 }, { - "__id__": 16 + "__id__": 18 } ], "_prefab": null, @@ -474,16 +535,16 @@ "_name": "MovableBar", "_objFlags": 0, "_parent": { - "__id__": 11 + "__id__": 13 }, "_children": [], "_active": true, "_components": [ { - "__id__": 13 + "__id__": 15 }, { - "__id__": 14 + "__id__": 16 } ], "_prefab": null, @@ -520,7 +581,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 14 }, "_enabled": true, "__prefab": null, @@ -541,7 +602,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 14 }, "_enabled": true, "__prefab": null, @@ -579,7 +640,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 11 + "__id__": 13 }, "_enabled": true, "__prefab": null, @@ -600,12 +661,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 11 + "__id__": 13 }, "_enabled": true, "__prefab": null, "_barSprite": { - "__id__": 14 + "__id__": 16 }, "_mode": 0, "_totalLength": 80, @@ -618,7 +679,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 7 + "__id__": 9 }, "_enabled": true, "__prefab": null, @@ -639,12 +700,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 7 + "__id__": 9 }, "_enabled": true, "__prefab": null, "healthBar": { - "__id__": 16 + "__id__": 18 }, "_id": "8doWxm45ZCKLqr0rVRHJa2" }, @@ -653,7 +714,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 6 + "__id__": 8 }, "_enabled": true, "__prefab": null, @@ -674,12 +735,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 6 + "__id__": 8 }, "_enabled": true, "__prefab": null, "healthUI": { - "__id__": 18 + "__id__": 20 }, "_id": "49hVDAypRMuoVp+F+IPkXM" }, @@ -688,17 +749,17 @@ "_name": "Weapon", "_objFlags": 0, "_parent": { - "__id__": 5 + "__id__": 7 }, "_children": [ { - "__id__": 22 + "__id__": 24 } ], "_active": true, "_components": [ { - "__id__": 50 + "__id__": 52 } ], "_prefab": null, @@ -735,38 +796,38 @@ "_name": "AnimatedWeapon", "_objFlags": 0, "_parent": { - "__id__": 21 + "__id__": 23 }, "_children": [ { - "__id__": 23 + "__id__": 25 }, { - "__id__": 27 + "__id__": 29 }, { - "__id__": 31 + "__id__": 33 }, { - "__id__": 35 + "__id__": 37 }, { - "__id__": 39 + "__id__": 41 }, { - "__id__": 43 + "__id__": 45 } ], "_active": true, "_components": [ - { - "__id__": 47 - }, - { - "__id__": 48 - }, { "__id__": 49 + }, + { + "__id__": 50 + }, + { + "__id__": 51 } ], "_prefab": null, @@ -803,19 +864,19 @@ "_name": "WeaponCollider", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 24 - }, - { - "__id__": 25 - }, { "__id__": 26 + }, + { + "__id__": 27 + }, + { + "__id__": 28 } ], "_prefab": null, @@ -852,7 +913,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 23 + "__id__": 25 }, "_enabled": true, "__prefab": null, @@ -873,7 +934,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 23 + "__id__": 25 }, "_enabled": true, "__prefab": null, @@ -911,7 +972,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 23 + "__id__": 25 }, "_enabled": true, "__prefab": null, @@ -938,19 +999,19 @@ "_name": "WeaponCollider-001", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 28 - }, - { - "__id__": 29 - }, { "__id__": 30 + }, + { + "__id__": 31 + }, + { + "__id__": 32 } ], "_prefab": null, @@ -987,7 +1048,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 27 + "__id__": 29 }, "_enabled": true, "__prefab": null, @@ -1008,7 +1069,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 27 + "__id__": 29 }, "_enabled": true, "__prefab": null, @@ -1046,7 +1107,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 27 + "__id__": 29 }, "_enabled": true, "__prefab": null, @@ -1073,19 +1134,19 @@ "_name": "WeaponCollider-002", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 32 - }, - { - "__id__": 33 - }, { "__id__": 34 + }, + { + "__id__": 35 + }, + { + "__id__": 36 } ], "_prefab": null, @@ -1122,7 +1183,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 31 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -1143,7 +1204,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 31 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -1181,7 +1242,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 31 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -1208,19 +1269,19 @@ "_name": "WeaponCollider-003", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 36 - }, - { - "__id__": 37 - }, { "__id__": 38 + }, + { + "__id__": 39 + }, + { + "__id__": 40 } ], "_prefab": null, @@ -1257,7 +1318,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 37 }, "_enabled": true, "__prefab": null, @@ -1278,7 +1339,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 37 }, "_enabled": true, "__prefab": null, @@ -1316,7 +1377,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 37 }, "_enabled": true, "__prefab": null, @@ -1343,19 +1404,19 @@ "_name": "WeaponCollider-004", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 40 - }, - { - "__id__": 41 - }, { "__id__": 42 + }, + { + "__id__": 43 + }, + { + "__id__": 44 } ], "_prefab": null, @@ -1392,7 +1453,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 39 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1413,7 +1474,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 39 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1451,7 +1512,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 39 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1478,19 +1539,19 @@ "_name": "WeaponCollider-005", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 44 - }, - { - "__id__": 45 - }, { "__id__": 46 + }, + { + "__id__": 47 + }, + { + "__id__": 48 } ], "_prefab": null, @@ -1527,7 +1588,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 45 }, "_enabled": true, "__prefab": null, @@ -1548,7 +1609,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 45 }, "_enabled": true, "__prefab": null, @@ -1586,7 +1647,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 45 }, "_enabled": true, "__prefab": null, @@ -1613,7 +1674,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 22 + "__id__": 24 }, "_enabled": true, "__prefab": null, @@ -1634,7 +1695,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 22 + "__id__": 24 }, "_enabled": true, "__prefab": null, @@ -1656,28 +1717,28 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 22 + "__id__": 24 }, "_enabled": true, "__prefab": null, "colliders": [ { - "__id__": 26 + "__id__": 28 }, { - "__id__": 30 + "__id__": 32 }, { - "__id__": 34 + "__id__": 36 }, { - "__id__": 38 + "__id__": 40 }, { - "__id__": 42 + "__id__": 44 }, { - "__id__": 46 + "__id__": 48 } ], "_id": "efTecDVf5IyZOD5/n+1DG7" @@ -1687,15 +1748,15 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 21 + "__id__": 23 }, "_enabled": true, "__prefab": null, "weaponAnimation": { - "__id__": 48 + "__id__": 50 }, "upgradableCollider": { - "__id__": 49 + "__id__": 51 }, "_id": "femtdMmA5Ax5K78hjELCcD" }, @@ -1704,7 +1765,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 5 + "__id__": 7 }, "_enabled": true, "__prefab": null, @@ -1725,7 +1786,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 5 + "__id__": 7 }, "_enabled": true, "__prefab": null, @@ -1763,19 +1824,19 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 5 + "__id__": 7 }, "_enabled": true, "__prefab": null, "speed": 100, "collider": { - "__id__": 54 + "__id__": 56 }, "playerUI": { - "__id__": 20 + "__id__": 22 }, "weapon": { - "__id__": 50 + "__id__": 52 }, "_id": "5aDEGDNWpIaL+U2iIxK4vA" }, @@ -1784,7 +1845,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 5 + "__id__": 7 }, "_enabled": true, "__prefab": null, @@ -1815,16 +1876,16 @@ }, "_children": [ { - "__id__": 56 + "__id__": 58 }, { - "__id__": 58 + "__id__": 60 } ], "_active": true, "_components": [ { - "__id__": 60 + "__id__": 62 } ], "_prefab": null, @@ -1861,13 +1922,13 @@ "_name": "XPSpawner", "_objFlags": 0, "_parent": { - "__id__": 55 + "__id__": 57 }, "_children": [], "_active": true, "_components": [ { - "__id__": 57 + "__id__": 59 } ], "_prefab": null, @@ -1904,7 +1965,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 56 + "__id__": 58 }, "_enabled": true, "__prefab": null, @@ -1919,13 +1980,13 @@ "_name": "EnemySpawner", "_objFlags": 0, "_parent": { - "__id__": 55 + "__id__": 57 }, "_children": [], "_active": true, "_components": [ { - "__id__": 59 + "__id__": 61 } ], "_prefab": null, @@ -1962,7 +2023,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 58 + "__id__": 60 }, "_enabled": true, "__prefab": null, @@ -1979,15 +2040,15 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 55 + "__id__": 57 }, "_enabled": true, "__prefab": null, "enemySpawner": { - "__id__": 59 + "__id__": 61 }, "xpSpawner": { - "__id__": 57 + "__id__": 59 }, "_id": "1ffjazmm5IkZwKInsSIULY" }, @@ -2000,28 +2061,28 @@ }, "_children": [ { - "__id__": 62 + "__id__": 64 }, { - "__id__": 85 + "__id__": 87 }, { - "__id__": 99 + "__id__": 101 }, { - "__id__": 102 + "__id__": 104 }, { - "__id__": 105 + "__id__": 107 }, { - "__id__": 108 + "__id__": 110 } ], "_active": true, "_components": [ { - "__id__": 111 + "__id__": 113 } ], "_prefab": null, @@ -2058,20 +2119,20 @@ "_name": "GameUI", "_objFlags": 0, "_parent": { - "__id__": 61 + "__id__": 63 }, "_children": [ { - "__id__": 63 + "__id__": 65 }, { - "__id__": 75 + "__id__": 77 } ], "_active": true, "_components": [ { - "__id__": 84 + "__id__": 86 } ], "_prefab": null, @@ -2108,20 +2169,20 @@ "_name": "TopUI", "_objFlags": 0, "_parent": { - "__id__": 62 + "__id__": 64 }, "_children": [ { - "__id__": 64 + "__id__": 66 } ], "_active": true, "_components": [ { - "__id__": 73 + "__id__": 75 }, { - "__id__": 74 + "__id__": 76 } ], "_prefab": null, @@ -2158,23 +2219,23 @@ "_name": "XpBar", "_objFlags": 0, "_parent": { - "__id__": 63 + "__id__": 65 }, "_children": [ { - "__id__": 65 + "__id__": 67 }, { - "__id__": 68 + "__id__": 70 } ], "_active": true, "_components": [ { - "__id__": 71 + "__id__": 73 }, { - "__id__": 72 + "__id__": 74 } ], "_prefab": null, @@ -2211,16 +2272,16 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 64 + "__id__": 66 }, "_children": [], "_active": true, "_components": [ { - "__id__": 66 + "__id__": 68 }, { - "__id__": 67 + "__id__": 69 } ], "_prefab": null, @@ -2257,7 +2318,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 65 + "__id__": 67 }, "_enabled": true, "__prefab": null, @@ -2278,7 +2339,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 65 + "__id__": 67 }, "_enabled": true, "__prefab": null, @@ -2316,16 +2377,16 @@ "_name": "MovableBar", "_objFlags": 0, "_parent": { - "__id__": 64 + "__id__": 66 }, "_children": [], "_active": true, "_components": [ { - "__id__": 69 + "__id__": 71 }, { - "__id__": 70 + "__id__": 72 } ], "_prefab": null, @@ -2362,7 +2423,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 68 + "__id__": 70 }, "_enabled": true, "__prefab": null, @@ -2383,7 +2444,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 68 + "__id__": 70 }, "_enabled": true, "__prefab": null, @@ -2421,7 +2482,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 64 + "__id__": 66 }, "_enabled": true, "__prefab": null, @@ -2442,12 +2503,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 64 + "__id__": 66 }, "_enabled": true, "__prefab": null, "_barSprite": { - "__id__": 70 + "__id__": 72 }, "_mode": 0, "_totalLength": 600, @@ -2460,7 +2521,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 63 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2481,7 +2542,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 63 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2510,17 +2571,17 @@ "_name": "UI", "_objFlags": 0, "_parent": { - "__id__": 62 + "__id__": 64 }, "_children": [ { - "__id__": 76 + "__id__": 78 } ], "_active": true, "_components": [ { - "__id__": 83 + "__id__": 85 } ], "_prefab": null, @@ -2557,23 +2618,23 @@ "_name": "VirtualJoystic", "_objFlags": 0, "_parent": { - "__id__": 75 + "__id__": 77 }, "_children": [ { - "__id__": 77 + "__id__": 79 } ], "_active": true, "_components": [ - { - "__id__": 80 - }, - { - "__id__": 81 - }, { "__id__": 82 + }, + { + "__id__": 83 + }, + { + "__id__": 84 } ], "_prefab": null, @@ -2610,16 +2671,16 @@ "_name": "Knob", "_objFlags": 0, "_parent": { - "__id__": 76 + "__id__": 78 }, "_children": [], "_active": true, "_components": [ { - "__id__": 78 + "__id__": 80 }, { - "__id__": 79 + "__id__": 81 } ], "_prefab": null, @@ -2656,7 +2717,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 77 + "__id__": 79 }, "_enabled": true, "__prefab": null, @@ -2677,7 +2738,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 77 + "__id__": 79 }, "_enabled": true, "__prefab": null, @@ -2715,7 +2776,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 76 + "__id__": 78 }, "_enabled": true, "__prefab": null, @@ -2736,7 +2797,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 76 + "__id__": 78 }, "_enabled": true, "__prefab": null, @@ -2774,13 +2835,13 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 76 + "__id__": 78 }, "_enabled": true, "__prefab": null, "maxDistance": 50, "knob": { - "__id__": 77 + "__id__": 79 }, "_id": "50ceZG62tGlYXvZWEvSDKl" }, @@ -2789,7 +2850,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 75 + "__id__": 77 }, "_enabled": true, "__prefab": null, @@ -2810,12 +2871,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 62 + "__id__": 64 }, "_enabled": true, "__prefab": null, "xpBar": { - "__id__": 72 + "__id__": 74 }, "_id": "bau/7eItRFrKKoAZZb/uYL" }, @@ -2824,20 +2885,20 @@ "_name": "ModalWindowManager", "_objFlags": 0, "_parent": { - "__id__": 61 + "__id__": 63 }, "_children": [ { - "__id__": 86 + "__id__": 88 } ], "_active": true, "_components": [ { - "__id__": 97 + "__id__": 99 }, { - "__id__": 98 + "__id__": 100 } ], "_prefab": null, @@ -2873,17 +2934,17 @@ "__type__": "cc.Node", "_objFlags": 0, "_parent": { - "__id__": 85 + "__id__": 87 }, "_prefab": { - "__id__": 87 + "__id__": 89 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 86 + "__id__": 88 }, "asset": { "__uuid__": "663674aa-da1c-44b0-8049-49db9b020973", @@ -2891,11 +2952,11 @@ }, "fileId": "32U/bJCUBDlaQxxGFNXZTu", "instance": { - "__id__": 88 + "__id__": 90 }, "targetOverrides": [ { - "__id__": 95 + "__id__": 97 } ] }, @@ -2905,20 +2966,20 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 89 - }, { "__id__": 91 }, - { - "__id__": 92 - }, { "__id__": 93 }, { "__id__": 94 + }, + { + "__id__": 95 + }, + { + "__id__": 96 } ], "removedComponents": [] @@ -2926,7 +2987,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 90 + "__id__": 92 }, "propertyPath": [ "_name" @@ -2942,7 +3003,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 90 + "__id__": 92 }, "propertyPath": [ "_lpos" @@ -2957,7 +3018,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 90 + "__id__": 92 }, "propertyPath": [ "_lrot" @@ -2973,7 +3034,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 90 + "__id__": 92 }, "propertyPath": [ "_euler" @@ -2988,7 +3049,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 90 + "__id__": 92 }, "propertyPath": [ "_active" @@ -3005,7 +3066,7 @@ ], "target": null, "targetInfo": { - "__id__": 96 + "__id__": 98 } }, { @@ -3019,7 +3080,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 85 + "__id__": 87 }, "_enabled": true, "__prefab": null, @@ -3040,7 +3101,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 85 + "__id__": 87 }, "_enabled": true, "__prefab": null, @@ -3057,16 +3118,16 @@ "_name": "Sprite", "_objFlags": 0, "_parent": { - "__id__": 61 + "__id__": 63 }, "_children": [], "_active": true, "_components": [ { - "__id__": 100 + "__id__": 102 }, { - "__id__": 101 + "__id__": 103 } ], "_prefab": null, @@ -3103,7 +3164,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 99 + "__id__": 101 }, "_enabled": true, "__prefab": null, @@ -3124,7 +3185,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 99 + "__id__": 101 }, "_enabled": true, "__prefab": null, @@ -3162,16 +3223,16 @@ "_name": "Sprite-001", "_objFlags": 0, "_parent": { - "__id__": 61 + "__id__": 63 }, "_children": [], "_active": true, "_components": [ { - "__id__": 103 + "__id__": 105 }, { - "__id__": 104 + "__id__": 106 } ], "_prefab": null, @@ -3208,7 +3269,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 102 + "__id__": 104 }, "_enabled": true, "__prefab": null, @@ -3229,7 +3290,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 102 + "__id__": 104 }, "_enabled": true, "__prefab": null, @@ -3267,16 +3328,16 @@ "_name": "Sprite-002", "_objFlags": 0, "_parent": { - "__id__": 61 + "__id__": 63 }, "_children": [], "_active": true, "_components": [ { - "__id__": 106 + "__id__": 108 }, { - "__id__": 107 + "__id__": 109 } ], "_prefab": null, @@ -3313,7 +3374,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 105 + "__id__": 107 }, "_enabled": true, "__prefab": null, @@ -3334,7 +3395,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 105 + "__id__": 107 }, "_enabled": true, "__prefab": null, @@ -3372,16 +3433,16 @@ "_name": "Sprite-003", "_objFlags": 0, "_parent": { - "__id__": 61 + "__id__": 63 }, "_children": [], "_active": true, "_components": [ { - "__id__": 109 + "__id__": 111 }, { - "__id__": 110 + "__id__": 112 } ], "_prefab": null, @@ -3418,7 +3479,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 108 + "__id__": 110 }, "_enabled": true, "__prefab": null, @@ -3439,7 +3500,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 108 + "__id__": 110 }, "_enabled": true, "__prefab": null, @@ -3477,7 +3538,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 61 + "__id__": 63 }, "_enabled": true, "__prefab": null, @@ -3546,7 +3607,7 @@ "_enabled": true, "__prefab": null, "_cameraComponent": { - "__id__": 111 + "__id__": 113 }, "_alignCanvasWithScreen": true, "_id": "12O/ljcVlEqLmVm3U2gEOQ" @@ -3590,25 +3651,28 @@ "_enabled": true, "__prefab": null, "virtualJoystic": { - "__id__": 82 + "__id__": 84 }, "player": { - "__id__": 53 + "__id__": 55 }, "haloProjectiles": { "__id__": 4 }, + "verticalProjectileLauncher": { + "__id__": 6 + }, "enemyManager": { - "__id__": 60 + "__id__": 62 }, "camera": { - "__id__": 111 + "__id__": 113 }, "gameUI": { - "__id__": 84 + "__id__": 86 }, "modalWindowManager": { - "__id__": 98 + "__id__": 100 }, "settingsAsset": { "__uuid__": "6828fb79-0a56-437e-b718-9f43bf234fbc", @@ -3621,26 +3685,26 @@ "fileId": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f", "nestedPrefabInstanceRoots": [ { - "__id__": 86 + "__id__": 88 } ] }, { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 118 - }, - "shadows": { - "__id__": 119 - }, - "_skybox": { "__id__": 120 }, - "fog": { + "shadows": { "__id__": 121 }, - "octree": { + "_skybox": { "__id__": 122 + }, + "fog": { + "__id__": 123 + }, + "octree": { + "__id__": 124 } }, { diff --git a/assets/Scripts/Game/Data/GameSettings.ts b/assets/Scripts/Game/Data/GameSettings.ts index 22b361f..146a982 100644 --- a/assets/Scripts/Game/Data/GameSettings.ts +++ b/assets/Scripts/Game/Data/GameSettings.ts @@ -18,9 +18,15 @@ export class WeaponSettings { } export class HaloLauncherSettings { + public projectilesToSpawn = 0; + public launcher = new ProjectileLauncherSettings(); +} + +export class ProjectileLauncherSettings { public projectileLifetime = 0; public projectileSpeed = 0; - public projectilesToSpawn = 0; + public wavesToShoot = 0; + public wavesDelayMs = 0; public cooldown = 0; } diff --git a/assets/Scripts/Game/GameBootstrapper.ts b/assets/Scripts/Game/GameBootstrapper.ts index f299633..da0092c 100644 --- a/assets/Scripts/Game/GameBootstrapper.ts +++ b/assets/Scripts/Game/GameBootstrapper.ts @@ -1,4 +1,4 @@ -import { Camera, Component, JsonAsset, KeyCode, _decorator } from "cc"; +import { Camera, Component, JsonAsset, KeyCode, Vec2, _decorator } from "cc"; import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager"; import { PlayerCollisionSystem } from "./Collision/PlayerCollisionSystem"; import { PlayerProjectileCollisionSystem } from "./Collision/PlayerProjectileCollisionSystem"; @@ -13,6 +13,7 @@ import { GameUI } from "./UI/GameUI"; import { EnemyManager } from "./Unit/Enemy/EnemyManager"; import { Player } from "./Unit/Player/Player"; import { HaloProjectileLauncher } from "./Unit/Player/ProjectileLauncher/Halo/HaloProjectileLauncher"; +import { ProjectileLauncher } from "./Unit/Player/ProjectileLauncher/ProjectileLauncher"; import { Upgrader } from "./Upgrades/Upgrader"; const { ccclass, property } = _decorator; @@ -22,6 +23,7 @@ export class GameBootstrapper extends Component { @property(VirtualJoystic) private virtualJoystic: VirtualJoystic; @property(Player) private player: Player; @property(HaloProjectileLauncher) private haloProjectiles: HaloProjectileLauncher; + @property(ProjectileLauncher) private verticalProjectileLauncher: ProjectileLauncher; @property(EnemyManager) private enemyManager: EnemyManager; @property(Camera) private camera: Camera; @property(GameUI) private gameUI: GameUI; @@ -53,6 +55,9 @@ export class GameBootstrapper extends Component { this.haloProjectiles.init(this.player.node, settings.player.haloLauncher); this.haloProjectiles.upgrade(); + this.verticalProjectileLauncher.init(this.player.node, [new Vec2(-1, 0)]); + this.verticalProjectileLauncher.upgrade(); + new PlayerProjectileCollisionSystem(this.haloProjectiles); this.gameUI.init(this.player); @@ -65,6 +70,7 @@ export class GameBootstrapper extends Component { this.playerCollisionSystem.gameTick(deltaTime); this.enemyManager.gameTick(deltaTime); this.haloProjectiles.gameTick(deltaTime); + this.verticalProjectileLauncher.gameTick(deltaTime); this.camera.node.worldPosition = this.player.node.worldPosition; } diff --git a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/Halo/HaloProjectileLauncher.ts b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/Halo/HaloProjectileLauncher.ts index d389731..c38b00a 100644 --- a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/Halo/HaloProjectileLauncher.ts +++ b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/Halo/HaloProjectileLauncher.ts @@ -33,11 +33,11 @@ export class HaloProjectileLauncher extends Component { public init(playerNode: Node, settings: HaloLauncherSettings): void { this.playerNode = playerNode; this.projectilesToSpawn = settings.projectilesToSpawn; - this.projectilePool = new ObjectPool(this.projectilePrefab, this.node, this.projectilesToSpawn, "PlayerProjectile"); + this.projectilePool = new ObjectPool(this.projectilePrefab, this.node, this.projectilesToSpawn, "Projectile"); - this.speed = settings.projectileSpeed; - this.defaultCooldown = settings.cooldown; - this.lifetimeTimer = new GameTimer(settings.projectileLifetime); + this.speed = settings.launcher.projectileSpeed; + this.defaultCooldown = settings.launcher.cooldown; + this.lifetimeTimer = new GameTimer(settings.launcher.projectileLifetime); this.fireTimer = new GameTimer(this.defaultCooldown); const angle: number = (2 * Math.PI) / this.projectilesToSpawn; diff --git a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts new file mode 100644 index 0000000..de2f2a1 --- /dev/null +++ b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts @@ -0,0 +1,92 @@ +import { _decorator, Component, Node, Prefab, Vec2, Vec3 } from "cc"; +import { GameTimer } from "../../../../Services/GameTimer"; +import { ObjectPool } from "../../../../Services/ObjectPool"; +import { delay } from "../../../../Services/Utils/AsyncUtils"; +import { Projectile } from "../../../Projectile/Projectile"; +const { ccclass, property } = _decorator; + +@ccclass("ProjectileLauncher") +export class ProjectileLauncher extends Component { + @property(Prefab) private projectilePrefab: Prefab; + private projectilePool: ObjectPool; + private fireTimer: GameTimer; + private projectileLifetime = 5; + private speed = 300; + + private fireDirections: Vec2[]; + + private projectiles: Projectile[] = []; + private directions: Vec2[] = []; + private expireTimes: number[] = []; + private currentTime = 0; + + private currentUpgrade = 0; + + private playerNode: Node; + + public init(playerNode: Node, fireDirections: Vec2[]): void { + this.playerNode = playerNode; + this.fireDirections = fireDirections; + this.projectilePool = new ObjectPool(this.projectilePrefab, this.node, 6, "Projectile"); + this.fireTimer = new GameTimer(2); + } + + public gameTick(deltaTime: number): void { + if (this.currentUpgrade == 0) return; + + this.currentTime += deltaTime; + this.fireTimer.gameTick(deltaTime); + if (this.fireTimer.tryFinishPeriod()) { + this.fireProjectiles(); + } + + this.tryRemoveExpiredProjectiles(); + this.moveAllProjectiles(deltaTime); + } + + public upgrade(): void { + this.currentUpgrade++; + } + + private async fireProjectiles(): Promise { + for (let i = 0; i < this.currentUpgrade; i++) { + await delay(100); + for (const direction of this.fireDirections) { + this.fireProjectile(direction); + } + } + } + + private fireProjectile(direction: Vec2): void { + const projectile: Projectile = this.projectilePool.borrow(); + projectile.tryInit(); + projectile.node.setWorldPosition(this.playerNode.worldPosition); + projectile.node.active = true; + + this.projectiles.push(projectile); + this.directions.push(direction); + this.expireTimes.push(this.currentTime + this.projectileLifetime); + } + + private tryRemoveExpiredProjectiles(): void { + for (let i = 0; i < this.projectiles.length; i++) { + if (this.currentTime < this.expireTimes[i]) break; // the oldest particles are at the start of the array + + this.projectilePool.return(this.projectiles[i]); + this.projectiles.splice(i, 1); + this.directions.splice(i, 1); + this.expireTimes.splice(i, 1); + i--; // Check the same index + } + } + + private moveAllProjectiles(deltaTime: number): void { + for (let i = 0; i < this.projectiles.length; i++) { + const newPosition: Vec3 = this.projectiles[i].node.worldPosition; + newPosition.x += this.directions[i].x * deltaTime * this.speed; + newPosition.y += this.directions[i].y * deltaTime * this.speed; + + this.projectiles[i].node.setWorldPosition(newPosition); + } + } +} diff --git a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts.meta b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts.meta new file mode 100644 index 0000000..3cbde2b --- /dev/null +++ b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "e3d06e80-f1ec-4505-a596-9f6831e1ce23", + "files": [], + "subMetas": {}, + "userData": {} +}