diff --git a/assets/Data/GameSettings.json b/assets/Data/GameSettings.json index 38928ba..ce18722 100644 --- a/assets/Data/GameSettings.json +++ b/assets/Data/GameSettings.json @@ -135,6 +135,15 @@ } }, "enemyManager": { + "projectileLauncher1": { + "enemyIds": [ + "BasicEnemy" + ], + "projectileLifetime": 10, + "projectileSpeed": 150, + "projectileDamage": 1, + "cooldown": 10 + }, "enemies": [ { "id": "BasicEnemy", diff --git a/assets/Media/Prefabs/Game/Projectiles/EnemyProjectile.prefab b/assets/Media/Prefabs/Game/Projectiles/EnemyProjectile.prefab new file mode 100644 index 0000000..ca15429 --- /dev/null +++ b/assets/Media/Prefabs/Game/Projectiles/EnemyProjectile.prefab @@ -0,0 +1,197 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "EnemyProjectile", + "_objFlags": 0, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false, + "asyncLoadAssets": false + }, + { + "__type__": "cc.Node", + "_name": "EnemyProjectile", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 2 + }, + { + "__id__": 4 + }, + { + "__id__": 6 + }, + { + "__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": 2, + "y": 2, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 3 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 26, + "height": 8 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "baF+RbIRdMqqYdGWVAqM48" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 5 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 0, + "b": 0, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "6826a961-a189-448f-adf7-d3795b2439b2@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 1, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "46qOXlbU5GmbOpfjiX4jGV" + }, + { + "__type__": "cc.CircleCollider2D", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 7 + }, + "tag": 0, + "_group": 64, + "_density": 1, + "_sensor": false, + "_friction": 0.2, + "_restitution": 0, + "_offset": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_radius": 13, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "7cR5oa68RG/oqkiwJ9HQ3X" + }, + { + "__type__": "6a24eYAhmtMDZo5Wb8iLC5Q", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 9 + }, + "collider": { + "__id__": 6 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a81ki8NjhA4KniWAiobzy2" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "26opAI9A5IGabbGPZh6QDI" + } +] \ No newline at end of file diff --git a/assets/Media/Prefabs/Game/Projectiles/EnemyProjectile.prefab.meta b/assets/Media/Prefabs/Game/Projectiles/EnemyProjectile.prefab.meta new file mode 100644 index 0000000..27f0193 --- /dev/null +++ b/assets/Media/Prefabs/Game/Projectiles/EnemyProjectile.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.40", + "importer": "prefab", + "imported": true, + "uuid": "01948a38-ee6f-4cd8-8a55-9b518e72c5f3", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "EnemyProjectile" + } +} diff --git a/assets/Scenes/Game.scene b/assets/Scenes/Game.scene index 3cadb2a..9266fd9 100644 --- a/assets/Scenes/Game.scene +++ b/assets/Scenes/Game.scene @@ -27,11 +27,11 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 104 + "__id__": 106 }, "autoReleaseAssets": false, "_globals": { - "__id__": 107 + "__id__": 109 }, "_id": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f" }, @@ -232,28 +232,31 @@ "__id__": 24 }, { - "__id__": 32 + "__id__": 26 }, { - "__id__": 42 + "__id__": 34 }, { - "__id__": 46 + "__id__": 44 + }, + { + "__id__": 48 } ], "_active": true, "_components": [ - { - "__id__": 100 - }, - { - "__id__": 101 - }, { "__id__": 102 }, { "__id__": 103 + }, + { + "__id__": 104 + }, + { + "__id__": 105 } ], "_prefab": null, @@ -617,6 +620,64 @@ }, "_id": "cb9igS0YNCNqD6RDXRC51W" }, + { + "__type__": "cc.Node", + "_name": "EnemyProjectileLauncher", + "_objFlags": 0, + "_parent": { + "__id__": 12 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 25 + } + ], + "_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": "c9qaeah3VF2Zs3vTlfmgbc" + }, + { + "__type__": "e3d066A8exFBaWWn2gx4c4j", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 24 + }, + "_enabled": true, + "__prefab": null, + "projectilePrefab": { + "__uuid__": "01948a38-ee6f-4cd8-8a55-9b518e72c5f3", + "__expectedType__": "cc.Prefab" + }, + "_id": "40l/whemJG4K5lZIsyHCB1" + }, { "__type__": "cc.Node", "_objFlags": 0, @@ -624,14 +685,14 @@ "__id__": 12 }, "_prefab": { - "__id__": 25 + "__id__": 27 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 24 + "__id__": 26 }, "asset": { "__uuid__": "27c97ec7-9bb8-4e4e-a264-ce49f2ae9843", @@ -639,7 +700,7 @@ }, "fileId": "fbcM/H31RNxK0HvQrwpElL", "instance": { - "__id__": 26 + "__id__": 28 } }, { @@ -648,17 +709,17 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 27 - }, { "__id__": 29 }, { - "__id__": 30 + "__id__": 31 }, { - "__id__": 31 + "__id__": 32 + }, + { + "__id__": 33 } ], "removedComponents": [] @@ -666,7 +727,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 28 + "__id__": 30 }, "propertyPath": [ "_name" @@ -682,7 +743,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 28 + "__id__": 30 }, "propertyPath": [ "_lpos" @@ -697,7 +758,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 28 + "__id__": 30 }, "propertyPath": [ "_lrot" @@ -713,7 +774,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 28 + "__id__": 30 }, "propertyPath": [ "_euler" @@ -733,9 +794,6 @@ "__id__": 12 }, "_children": [ - { - "__id__": 33 - }, { "__id__": 35 }, @@ -744,12 +802,15 @@ }, { "__id__": 39 + }, + { + "__id__": 41 } ], "_active": true, "_components": [ { - "__id__": 41 + "__id__": 43 } ], "_prefab": null, @@ -786,13 +847,13 @@ "_name": "XPSpawner", "_objFlags": 0, "_parent": { - "__id__": 32 + "__id__": 34 }, "_children": [], "_active": true, "_components": [ { - "__id__": 34 + "__id__": 36 } ], "_prefab": null, @@ -829,7 +890,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 33 + "__id__": 35 }, "_enabled": true, "__prefab": null, @@ -844,13 +905,13 @@ "_name": "GoldSpawner", "_objFlags": 0, "_parent": { - "__id__": 32 + "__id__": 34 }, "_children": [], "_active": true, "_components": [ { - "__id__": 36 + "__id__": 38 } ], "_prefab": null, @@ -887,7 +948,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 37 }, "_enabled": true, "__prefab": null, @@ -902,13 +963,13 @@ "_name": "HealthPotionSpawner", "_objFlags": 0, "_parent": { - "__id__": 32 + "__id__": 34 }, "_children": [], "_active": true, "_components": [ { - "__id__": 38 + "__id__": 40 } ], "_prefab": null, @@ -945,7 +1006,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 37 + "__id__": 39 }, "_enabled": true, "__prefab": null, @@ -960,13 +1021,13 @@ "_name": "PickupEffectManager", "_objFlags": 0, "_parent": { - "__id__": 32 + "__id__": 34 }, "_children": [], "_active": true, "_components": [ { - "__id__": 40 + "__id__": 42 } ], "_prefab": null, @@ -1003,7 +1064,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 39 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1018,22 +1079,22 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 32 + "__id__": 34 }, "_enabled": true, "__prefab": null, "xpSpawner": { - "__id__": 34 - }, - "goldSpawner": { "__id__": 36 }, - "healthPotionSpawner": { + "goldSpawner": { "__id__": 38 }, - "pickupEffectManager": { + "healthPotionSpawner": { "__id__": 40 }, + "pickupEffectManager": { + "__id__": 42 + }, "_id": "98EDpSoeBKp7eDmPXKNFJ0" }, { @@ -1045,13 +1106,13 @@ }, "_children": [ { - "__id__": 43 + "__id__": 45 } ], "_active": true, "_components": [ { - "__id__": 45 + "__id__": 47 } ], "_prefab": null, @@ -1088,13 +1149,13 @@ "_name": "EnemySpawner", "_objFlags": 0, "_parent": { - "__id__": 42 + "__id__": 44 }, "_children": [], "_active": true, "_components": [ { - "__id__": 44 + "__id__": 46 } ], "_prefab": null, @@ -1131,7 +1192,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 45 }, "_enabled": true, "__prefab": null, @@ -1160,12 +1221,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 42 + "__id__": 44 }, "_enabled": true, "__prefab": null, "enemySpawner": { - "__id__": 44 + "__id__": 46 }, "_id": "1ffjazmm5IkZwKInsSIULY" }, @@ -1178,28 +1239,28 @@ }, "_children": [ { - "__id__": 47 + "__id__": 49 }, { - "__id__": 73 + "__id__": 75 }, { - "__id__": 87 + "__id__": 89 }, { - "__id__": 90 + "__id__": 92 }, { - "__id__": 93 + "__id__": 95 }, { - "__id__": 96 + "__id__": 98 } ], "_active": true, "_components": [ { - "__id__": 99 + "__id__": 101 } ], "_prefab": null, @@ -1236,20 +1297,20 @@ "_name": "GameUI", "_objFlags": 0, "_parent": { - "__id__": 46 + "__id__": 48 }, "_children": [ { - "__id__": 48 + "__id__": 50 }, { - "__id__": 63 + "__id__": 65 } ], "_active": true, "_components": [ { - "__id__": 72 + "__id__": 74 } ], "_prefab": null, @@ -1286,23 +1347,23 @@ "_name": "TopUI", "_objFlags": 0, "_parent": { - "__id__": 47 + "__id__": 49 }, "_children": [ { - "__id__": 49 + "__id__": 51 }, { - "__id__": 58 + "__id__": 60 } ], "_active": true, "_components": [ { - "__id__": 61 + "__id__": 63 }, { - "__id__": 62 + "__id__": 64 } ], "_prefab": null, @@ -1339,23 +1400,23 @@ "_name": "XpBar", "_objFlags": 0, "_parent": { - "__id__": 48 + "__id__": 50 }, "_children": [ { - "__id__": 50 + "__id__": 52 }, { - "__id__": 53 + "__id__": 55 } ], "_active": true, "_components": [ { - "__id__": 56 + "__id__": 58 }, { - "__id__": 57 + "__id__": 59 } ], "_prefab": null, @@ -1392,16 +1453,16 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 49 + "__id__": 51 }, "_children": [], "_active": true, "_components": [ { - "__id__": 51 + "__id__": 53 }, { - "__id__": 52 + "__id__": 54 } ], "_prefab": null, @@ -1438,7 +1499,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 50 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1459,7 +1520,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 50 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1497,16 +1558,16 @@ "_name": "MovableBar", "_objFlags": 0, "_parent": { - "__id__": 49 + "__id__": 51 }, "_children": [], "_active": true, "_components": [ { - "__id__": 54 + "__id__": 56 }, { - "__id__": 55 + "__id__": 57 } ], "_prefab": null, @@ -1543,7 +1604,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 55 }, "_enabled": true, "__prefab": null, @@ -1564,7 +1625,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 55 }, "_enabled": true, "__prefab": null, @@ -1602,7 +1663,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 49 + "__id__": 51 }, "_enabled": true, "__prefab": null, @@ -1623,12 +1684,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 49 + "__id__": 51 }, "_enabled": true, "__prefab": null, "_barSprite": { - "__id__": 55 + "__id__": 57 }, "_mode": 0, "_totalLength": 600, @@ -1641,16 +1702,16 @@ "_name": "TimeAliveText", "_objFlags": 0, "_parent": { - "__id__": 48 + "__id__": 50 }, "_children": [], "_active": true, "_components": [ { - "__id__": 59 + "__id__": 61 }, { - "__id__": 60 + "__id__": 62 } ], "_prefab": null, @@ -1687,7 +1748,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 58 + "__id__": 60 }, "_enabled": true, "__prefab": null, @@ -1708,7 +1769,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 58 + "__id__": 60 }, "_enabled": true, "__prefab": null, @@ -1749,7 +1810,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 48 + "__id__": 50 }, "_enabled": true, "__prefab": null, @@ -1770,7 +1831,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 48 + "__id__": 50 }, "_enabled": true, "__prefab": null, @@ -1799,17 +1860,17 @@ "_name": "UI", "_objFlags": 0, "_parent": { - "__id__": 47 + "__id__": 49 }, "_children": [ { - "__id__": 64 + "__id__": 66 } ], "_active": true, "_components": [ { - "__id__": 71 + "__id__": 73 } ], "_prefab": null, @@ -1846,23 +1907,23 @@ "_name": "VirtualJoystic", "_objFlags": 0, "_parent": { - "__id__": 63 + "__id__": 65 }, "_children": [ { - "__id__": 65 + "__id__": 67 } ], "_active": true, "_components": [ - { - "__id__": 68 - }, - { - "__id__": 69 - }, { "__id__": 70 + }, + { + "__id__": 71 + }, + { + "__id__": 72 } ], "_prefab": null, @@ -1899,16 +1960,16 @@ "_name": "Knob", "_objFlags": 0, "_parent": { - "__id__": 64 + "__id__": 66 }, "_children": [], "_active": true, "_components": [ { - "__id__": 66 + "__id__": 68 }, { - "__id__": 67 + "__id__": 69 } ], "_prefab": null, @@ -1945,7 +2006,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 65 + "__id__": 67 }, "_enabled": true, "__prefab": null, @@ -1966,7 +2027,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 65 + "__id__": 67 }, "_enabled": true, "__prefab": null, @@ -2004,7 +2065,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 64 + "__id__": 66 }, "_enabled": true, "__prefab": null, @@ -2025,7 +2086,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 64 + "__id__": 66 }, "_enabled": true, "__prefab": null, @@ -2063,13 +2124,13 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 64 + "__id__": 66 }, "_enabled": true, "__prefab": null, "maxDistance": 50, "knob": { - "__id__": 65 + "__id__": 67 }, "_id": "50ceZG62tGlYXvZWEvSDKl" }, @@ -2078,7 +2139,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 63 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2099,15 +2160,15 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 47 + "__id__": 49 }, "_enabled": true, "__prefab": null, "xpBar": { - "__id__": 57 + "__id__": 59 }, "timeAliveText": { - "__id__": 60 + "__id__": 62 }, "_id": "bau/7eItRFrKKoAZZb/uYL" }, @@ -2116,20 +2177,20 @@ "_name": "ModalWindowManager", "_objFlags": 0, "_parent": { - "__id__": 46 + "__id__": 48 }, "_children": [ { - "__id__": 74 + "__id__": 76 } ], "_active": true, "_components": [ { - "__id__": 85 + "__id__": 87 }, { - "__id__": 86 + "__id__": 88 } ], "_prefab": null, @@ -2165,17 +2226,17 @@ "__type__": "cc.Node", "_objFlags": 0, "_parent": { - "__id__": 73 + "__id__": 75 }, "_prefab": { - "__id__": 75 + "__id__": 77 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 74 + "__id__": 76 }, "asset": { "__uuid__": "663674aa-da1c-44b0-8049-49db9b020973", @@ -2183,11 +2244,11 @@ }, "fileId": "32U/bJCUBDlaQxxGFNXZTu", "instance": { - "__id__": 76 + "__id__": 78 }, "targetOverrides": [ { - "__id__": 83 + "__id__": 85 } ] }, @@ -2197,20 +2258,20 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 77 - }, { "__id__": 79 }, - { - "__id__": 80 - }, { "__id__": 81 }, { "__id__": 82 + }, + { + "__id__": 83 + }, + { + "__id__": 84 } ], "removedComponents": [] @@ -2218,7 +2279,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 78 + "__id__": 80 }, "propertyPath": [ "_name" @@ -2234,7 +2295,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 78 + "__id__": 80 }, "propertyPath": [ "_lpos" @@ -2249,7 +2310,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 78 + "__id__": 80 }, "propertyPath": [ "_lrot" @@ -2265,7 +2326,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 78 + "__id__": 80 }, "propertyPath": [ "_euler" @@ -2280,7 +2341,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 78 + "__id__": 80 }, "propertyPath": [ "_active" @@ -2297,7 +2358,7 @@ ], "target": null, "targetInfo": { - "__id__": 84 + "__id__": 86 } }, { @@ -2311,7 +2372,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 73 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -2332,7 +2393,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 73 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -2349,16 +2410,16 @@ "_name": "Sprite", "_objFlags": 0, "_parent": { - "__id__": 46 + "__id__": 48 }, "_children": [], "_active": true, "_components": [ { - "__id__": 88 + "__id__": 90 }, { - "__id__": 89 + "__id__": 91 } ], "_prefab": null, @@ -2395,7 +2456,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 87 + "__id__": 89 }, "_enabled": true, "__prefab": null, @@ -2416,7 +2477,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 87 + "__id__": 89 }, "_enabled": true, "__prefab": null, @@ -2454,16 +2515,16 @@ "_name": "Sprite-001", "_objFlags": 0, "_parent": { - "__id__": 46 + "__id__": 48 }, "_children": [], "_active": true, "_components": [ { - "__id__": 91 + "__id__": 93 }, { - "__id__": 92 + "__id__": 94 } ], "_prefab": null, @@ -2500,7 +2561,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 90 + "__id__": 92 }, "_enabled": true, "__prefab": null, @@ -2521,7 +2582,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 90 + "__id__": 92 }, "_enabled": true, "__prefab": null, @@ -2559,16 +2620,16 @@ "_name": "Sprite-002", "_objFlags": 0, "_parent": { - "__id__": 46 + "__id__": 48 }, "_children": [], "_active": true, "_components": [ { - "__id__": 94 + "__id__": 96 }, { - "__id__": 95 + "__id__": 97 } ], "_prefab": null, @@ -2605,7 +2666,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 93 + "__id__": 95 }, "_enabled": true, "__prefab": null, @@ -2626,7 +2687,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 93 + "__id__": 95 }, "_enabled": true, "__prefab": null, @@ -2664,16 +2725,16 @@ "_name": "Sprite-003", "_objFlags": 0, "_parent": { - "__id__": 46 + "__id__": 48 }, "_children": [], "_active": true, "_components": [ { - "__id__": 97 + "__id__": 99 }, { - "__id__": 98 + "__id__": 100 } ], "_prefab": null, @@ -2710,7 +2771,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 96 + "__id__": 98 }, "_enabled": true, "__prefab": null, @@ -2731,7 +2792,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 96 + "__id__": 98 }, "_enabled": true, "__prefab": null, @@ -2769,7 +2830,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 46 + "__id__": 48 }, "_enabled": true, "__prefab": null, @@ -2838,7 +2899,7 @@ "_enabled": true, "__prefab": null, "_cameraComponent": { - "__id__": 99 + "__id__": 101 }, "_alignCanvasWithScreen": true, "_id": "12O/ljcVlEqLmVm3U2gEOQ" @@ -2882,7 +2943,7 @@ "_enabled": true, "__prefab": null, "virtualJoystic": { - "__id__": 70 + "__id__": 72 }, "player": null, "haloProjectileLauncherComponent": { @@ -2894,23 +2955,26 @@ "diagonalProjectileLauncherComponent": { "__id__": 23 }, + "enemyProjectileLauncherComponent": { + "__id__": 25 + }, "enemyManager": { - "__id__": 45 + "__id__": 47 }, "itemManager": { - "__id__": 41 + "__id__": 43 }, "camera": { - "__id__": 99 + "__id__": 101 }, "gameUI": { - "__id__": 72 + "__id__": 74 }, "background": { "__id__": 17 }, "modalWindowManager": { - "__id__": 86 + "__id__": 88 }, "gameAudioAdapter": { "__id__": 14 @@ -2922,7 +2986,7 @@ "fileId": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f", "targetOverrides": [ { - "__id__": 105 + "__id__": 107 } ], "nestedPrefabInstanceRoots": [ @@ -2930,27 +2994,27 @@ "__id__": 2 }, { - "__id__": 24 + "__id__": 26 }, { - "__id__": 74 + "__id__": 76 } ] }, { "__type__": "cc.TargetOverrideInfo", "source": { - "__id__": 103 + "__id__": 105 }, "sourceInfo": null, "propertyPath": [ "player" ], "target": { - "__id__": 24 + "__id__": 26 }, "targetInfo": { - "__id__": 106 + "__id__": 108 } }, { @@ -2962,19 +3026,19 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 108 - }, - "shadows": { - "__id__": 109 - }, - "_skybox": { "__id__": 110 }, - "fog": { + "shadows": { "__id__": 111 }, - "octree": { + "_skybox": { "__id__": 112 + }, + "fog": { + "__id__": 113 + }, + "octree": { + "__id__": 114 } }, { diff --git a/assets/Scripts/Game/Collision/PlayerCollisionSystem.ts b/assets/Scripts/Game/Collision/PlayerCollisionSystem.ts index b7e4609..afdd0c4 100644 --- a/assets/Scripts/Game/Collision/PlayerCollisionSystem.ts +++ b/assets/Scripts/Game/Collision/PlayerCollisionSystem.ts @@ -7,6 +7,7 @@ import { Gold } from "../Items/Gold/Gold"; import { HealthPotion } from "../Items/HealthPotion/HealthPotion"; import { ItemManager } from "../Items/ItemManager"; import { XP } from "../Items/XP/XP"; +import { Projectile } from "../Projectile/Projectile"; import { Enemy } from "../Unit/Enemy/Enemy"; import { Player } from "../Unit/Player/Player"; @@ -27,6 +28,7 @@ export class PlayerCollisionSystem { this.collisionTimer = new GameTimer(collisionDelay); this.groupToResolver.set(GroupType.ENEMY, this.resolveEnemyContact.bind(this)); + this.groupToResolver.set(GroupType.ENEMY_PROJECTILE, this.resolveEnemyProjectileContact.bind(this)); this.groupToResolver.set(GroupType.XP, this.resolveXpContact.bind(this)); this.groupToResolver.set(GroupType.GOLD, this.resolveGoldContact.bind(this)); this.groupToResolver.set(GroupType.HEALTH_POTION, this.resolveHealthPotionContact.bind(this)); @@ -75,6 +77,15 @@ export class PlayerCollisionSystem { this.player.Health.damage(damage); } + private resolveEnemyProjectileContact(enemyCollider: Collider2D): void { + const projectile = enemyCollider.node.getComponent(Projectile); + const damage: number = projectile.Damage; + projectile.pierce(); + console.log("Collided with enemy projectile: Damage: " + damage); + + this.player.Health.damage(damage); + } + private resolveXpContact(xpCollider: Collider2D): void { console.log("Collided with XP"); this.itemManager.pickupXP(xpCollider.node.getComponent(XP)); diff --git a/assets/Scripts/Game/Data/GameSettings.ts b/assets/Scripts/Game/Data/GameSettings.ts index 3b03001..5f0bf57 100644 --- a/assets/Scripts/Game/Data/GameSettings.ts +++ b/assets/Scripts/Game/Data/GameSettings.ts @@ -1,3 +1,5 @@ +import { EnemyProjectileLauncher } from "../Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher"; + export class GameSettings { public player: PlayerSettings = new PlayerSettings(); public upgrades: UpgradeSettings = new UpgradeSettings(); @@ -34,6 +36,14 @@ export class HaloLauncherSettings { public launcher = new ProjectileLauncherSettings(); } +export class EnemyLauncherSettings { + public enemyIds: string[] = []; + public projectileLifetime = 0; + public projectileSpeed = 0; + public projectileDamage = 0; + public cooldown = 0; +} + export class ProjectileLauncherSettings { public projectileLifetime = 0; public projectileSpeed = 0; @@ -66,6 +76,7 @@ export class MetaUpgradeSettings { } export class EnemyManagerSettings { + public projectileLauncher1 = new EnemyLauncherSettings(); public enemies: EnemySettings[] = [new EnemySettings()]; public periodicFollowMovers: PeriodicFollowMoverSettings[] = [new PeriodicFollowMoverSettings()]; public individualEnemySpawners: IndividualEnemySpawnerSettings[] = [new IndividualEnemySpawnerSettings()]; diff --git a/assets/Scripts/Game/Game.ts b/assets/Scripts/Game/Game.ts index d256872..c011014 100644 --- a/assets/Scripts/Game/Game.ts +++ b/assets/Scripts/Game/Game.ts @@ -26,6 +26,7 @@ import { ProjectileData } from "./Unit/Player/ProjectileLauncher/ProjectileData" import { WaveProjectileLauncher } from "./Unit/Player/ProjectileLauncher/WaveProjectileLauncher"; import { Upgrader } from "./Upgrades/Upgrader"; import { MetaUpgradeType } from "./Upgrades/UpgradeType"; +import { EnemyProjectileLauncher } from "./Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher"; const { ccclass, property } = _decorator; @@ -36,6 +37,7 @@ export class Game extends Component { @property(ProjectileLauncher) private haloProjectileLauncherComponent: ProjectileLauncher; @property(ProjectileLauncher) private horizontalProjectileLauncherComponent: ProjectileLauncher; @property(ProjectileLauncher) private diagonalProjectileLauncherComponent: ProjectileLauncher; + @property(ProjectileLauncher) private enemyProjectileLauncherComponent: ProjectileLauncher; @property(EnemyManager) private enemyManager: EnemyManager; @property(ItemManager) private itemManager: ItemManager; @property(Camera) private camera: Camera; @@ -49,6 +51,8 @@ export class Game extends Component { private horizontalProjectileLauncher: WaveProjectileLauncher; private diagonalProjectileLauncher: WaveProjectileLauncher; + private enemyProjectileLauncher: EnemyProjectileLauncher; + private gamePauser: Pauser = new Pauser(); private static instance: Game; @@ -112,6 +116,13 @@ export class Game extends Component { projectileData ); + this.enemyProjectileLauncher = new EnemyProjectileLauncher( + this.enemyProjectileLauncherComponent, + this.player.node, + this.enemyManager, + settings.enemyManager.projectileLauncher1 + ); + new PlayerProjectileCollisionSystem([this.haloProjectileLauncher, this.horizontalProjectileLauncher, this.diagonalProjectileLauncher]); const upgrader = new Upgrader( @@ -150,6 +161,7 @@ export class Game extends Component { this.haloProjectileLauncher.gameTick(deltaTime); this.horizontalProjectileLauncher.gameTick(deltaTime); this.diagonalProjectileLauncher.gameTick(deltaTime); + this.enemyProjectileLauncher.gameTick(deltaTime); this.background.gameTick(); this.timeAlive += deltaTime; diff --git a/assets/Scripts/Game/Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher.ts b/assets/Scripts/Game/Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher.ts index b238895..df179c7 100644 --- a/assets/Scripts/Game/Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher.ts +++ b/assets/Scripts/Game/Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher.ts @@ -1,30 +1,54 @@ import { Vec3, Node, Vec2 } from "cc"; import { GameTimer } from "../../../../Services/GameTimer"; +import { EnemyLauncherSettings } from "../../../Data/GameSettings"; import { ProjectileLauncher } from "../../Player/ProjectileLauncher/ProjectileLauncher"; import { Enemy } from "../Enemy"; import { EnemyManager } from "../EnemyManager"; export class EnemyProjectileLauncher { - private enemies: Enemy[] = []; - private shootTimer: GameTimer = new GameTimer(3); + private enemyToTimer = new Map(); + private cooldown: number; + private enemyIds: string[]; - public constructor(private playerNode: Node, private projectileLauncher: ProjectileLauncher, enemyManager: EnemyManager) { + public constructor( + private projectileLauncher: ProjectileLauncher, + private playerNode: Node, + enemyManager: EnemyManager, + settings: EnemyLauncherSettings + ) { enemyManager.EnemyAddedEvent.on(this.tryAddEnemy, this); enemyManager.EnemyRemovedEvent.on(this.tryRemoveEnemy, this); + + this.cooldown = settings.cooldown; + this.enemyIds = settings.enemyIds; + projectileLauncher.init(settings.projectileLifetime, settings.projectileSpeed, settings.projectileDamage, 1); } private tryAddEnemy(enemy: Enemy): void { - if (enemy.Id == "BasicEnemy") { - this.enemies.push(); + if (this.enemyIds.includes(enemy.Id)) { + this.enemyToTimer.set(enemy, new GameTimer(this.cooldown)); } } private tryRemoveEnemy(enemy: Enemy): void { - if (enemy.Id == "BasicEnemy") { - const index = this.enemies.indexOf(enemy); - this.enemies.splice(index, 1); - } + if (!this.enemyToTimer.has(enemy)) return; + + this.enemyToTimer.delete(enemy); } - public gameTick(deltaTime: number): void {} + public gameTick(deltaTime: number): void { + this.projectileLauncher.gameTick(deltaTime); + + for (const enemyAndTimerPair of this.enemyToTimer) { + const enemyWorldPosition: Vec3 = enemyAndTimerPair[0].node.worldPosition; + const shootTimer: GameTimer = enemyAndTimerPair[1]; + + shootTimer.gameTick(deltaTime); + if (shootTimer.tryFinishPeriod()) { + let direction: Vec3 = new Vec3(); + direction = Vec3.subtract(direction, this.playerNode.worldPosition, enemyWorldPosition); + this.projectileLauncher.fireProjectiles(enemyWorldPosition, [new Vec2(direction.x, direction.y)]); + } + } + } } diff --git a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts index 8a8e27a..d6d6d2f 100644 --- a/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts +++ b/assets/Scripts/Game/Unit/Player/ProjectileLauncher/ProjectileLauncher.ts @@ -51,6 +51,7 @@ export class ProjectileLauncher extends Component implements IProjectileCollisio } private fireProjectile(startPosition: Vec3, direction: Vec2): void { + direction = direction.normalize(); const projectile: Projectile = this.projectilePool.borrow(); projectile.init(this.projectileDamage, this.projectilePierces, getDegreeAngleFromDirection(direction.x, direction.y)); projectile.node.setWorldPosition(startPosition);