From 2a3ce76c4b900e4e74ba3baaecaebf16b2927fb7 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 28 Nov 2022 11:49:16 +0100 Subject: [PATCH] new upgrades, restrucutre --- assets/Data/GameSettings.json | 16 +- assets/Media/Prefabs/Enemy.prefab | 4 +- assets/Scenes/scene.scene | 1135 +++++++++++++---- .../Game/Collision/PlayerCollisionSystem.ts | 2 +- .../Game/Collision/WeaponCollisionSystem.ts | 8 +- assets/Scripts/Game/Data/GameSettings.ts | 14 +- assets/Scripts/Game/Enemy.meta | 2 +- assets/Scripts/Game/Enemy/Enemy.ts.meta | 2 +- .../Scripts/Game/Enemy/EnemyManager.ts.meta | 2 +- assets/Scripts/Game/Enemy/EnemyMover.ts.meta | 2 +- .../Scripts/Game/Enemy/EnemySpawner.ts.meta | 2 +- assets/Scripts/Game/GameBootstrapper.ts | 16 +- .../Game/ModalWIndows/GameModalLauncher.ts | 2 +- assets/Scripts/Game/Player.meta | 2 +- assets/Scripts/Game/Player/PlayerUI.meta | 2 +- .../Player/PlayerUI/PlayerHealthUI.ts.meta | 2 +- .../Game/Player/PlayerUI/PlayerUI.ts.meta | 2 +- assets/Scripts/Game/Player/UnitHealth.ts.meta | 2 +- assets/Scripts/Game/Player/UnitLevel.ts.meta | 2 +- assets/Scripts/Game/Player/Weapon.meta | 12 + .../Game/Player/Weapon/UpgradableCollider.ts | 43 + .../Player/Weapon/UpgradableCollider.ts.meta | 9 + .../Game/{ => Player/Weapon}/Weapon.ts | 31 +- .../Game/{ => Player/Weapon}/Weapon.ts.meta | 0 assets/Scripts/Game/UI/GameUI.ts | 4 +- .../UI/LevelUpWindow/LevelUpModalWindow.ts | 4 +- .../Game/UI/LevelUpWindow/LevelUpSkill.ts | 9 +- assets/Scripts/Game/Upgrades/Upgrader.ts | 13 +- 28 files changed, 1072 insertions(+), 272 deletions(-) create mode 100644 assets/Scripts/Game/Player/Weapon.meta create mode 100644 assets/Scripts/Game/Player/Weapon/UpgradableCollider.ts create mode 100644 assets/Scripts/Game/Player/Weapon/UpgradableCollider.ts.meta rename assets/Scripts/Game/{ => Player/Weapon}/Weapon.ts (53%) rename assets/Scripts/Game/{ => Player/Weapon}/Weapon.ts.meta (100%) diff --git a/assets/Data/GameSettings.json b/assets/Data/GameSettings.json index bb8cb64..69ac28f 100644 --- a/assets/Data/GameSettings.json +++ b/assets/Data/GameSettings.json @@ -1,5 +1,5 @@ { - "playerSettings": { + "player": { "defaultHP": 50, "requiredXP": [ 5, @@ -13,12 +13,16 @@ 20, 20 ], - "collisionDelay": 0.5, - "testSettings": { - "test": 0 - } + "collisionDelay": 0.5 }, - "weaponSettings": { + "weapon": { "strikeDelay": 2 + }, + "upgrades": { + "maxWeaponLengthUpgrades": 5, + "maxWeaponDamageUpgrades": 5, + "maxHorizontalProjectileUpgrades": 0, + "maxVerticalProjectileUpgrades": 0, + "maxRegenerationUpgrades": 0 } } \ No newline at end of file diff --git a/assets/Media/Prefabs/Enemy.prefab b/assets/Media/Prefabs/Enemy.prefab index f1f9f62..640a9ca 100644 --- a/assets/Media/Prefabs/Enemy.prefab +++ b/assets/Media/Prefabs/Enemy.prefab @@ -169,7 +169,7 @@ "fileId": "5dR8969SVAfLXx5AY1X9B5" }, { - "__type__": "e6f96nAJ4NOs7RnNWxo20US", + "__type__": "7f8b6NKHsNNW5nLY3fwejhw", "_name": "", "_objFlags": 0, "node": { @@ -186,7 +186,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "94XkV2AslIlKb4oyiOnsKv" + "fileId": "b5ONKVkchBpaoqReE981lo" }, { "__type__": "cc.PrefabInfo", diff --git a/assets/Scenes/scene.scene b/assets/Scenes/scene.scene index f83b630..b6bfd17 100644 --- a/assets/Scenes/scene.scene +++ b/assets/Scenes/scene.scene @@ -21,11 +21,11 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 93 + "__id__": 114 }, "autoReleaseAssets": false, "_globals": { - "__id__": 94 + "__id__": 115 }, "_id": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f" }, @@ -41,28 +41,28 @@ "__id__": 3 }, { - "__id__": 12 + "__id__": 33 }, { - "__id__": 32 + "__id__": 53 }, { - "__id__": 38 + "__id__": 59 } ], "_active": true, "_components": [ { - "__id__": 89 + "__id__": 110 }, { - "__id__": 90 + "__id__": 111 }, { - "__id__": 91 + "__id__": 112 }, { - "__id__": 92 + "__id__": 113 } ], "_prefab": null, @@ -109,7 +109,7 @@ "_active": true, "_components": [ { - "__id__": 11 + "__id__": 32 } ], "_prefab": null, @@ -151,15 +151,33 @@ "_children": [ { "__id__": 5 + }, + { + "__id__": 9 + }, + { + "__id__": 13 + }, + { + "__id__": 17 + }, + { + "__id__": 21 + }, + { + "__id__": 25 } ], "_active": true, "_components": [ { - "__id__": 9 + "__id__": 29 }, { - "__id__": 10 + "__id__": 30 + }, + { + "__id__": 31 } ], "_prefab": null, @@ -227,8 +245,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.49999999999999994, - "y": 1.5, + "x": 1, + "y": 1, "z": 1 }, "_layer": 33554432, @@ -251,8 +269,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 40, - "height": 40 + "width": 20, + "height": 60 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -286,7 +304,7 @@ }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -321,11 +339,686 @@ }, "_size": { "__type__": "cc.Size", - "width": 40, - "height": 40 + "width": 20, + "height": 60 }, "_id": "3aF6QUKjlBv6hc4EtxRzck" }, + { + "__type__": "cc.Node", + "_name": "WeaponCollider-001", + "_objFlags": 0, + "_parent": { + "__id__": 4 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 11 + }, + { + "__id__": 12 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 77, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0.7071067811865475, + "w": 0.7071067811865476 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 90 + }, + "_id": "6a4ptKRuFNDJPobiRKOM5O" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 70 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "deYd2NbJtCe5Df9jK8tU7c" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 10, + "b": 10, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "f1vMaltlxDK53V7eyR5nAI" + }, + { + "__type__": "cc.BoxCollider2D", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": null, + "tag": 0, + "_group": 8, + "_density": 1, + "_sensor": false, + "_friction": 0.2, + "_restitution": 0, + "_offset": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_size": { + "__type__": "cc.Size", + "width": 20, + "height": 70 + }, + "_id": "bd1VBaovZHT4m/3826DnjC" + }, + { + "__type__": "cc.Node", + "_name": "WeaponCollider-002", + "_objFlags": 0, + "_parent": { + "__id__": 4 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 14 + }, + { + "__id__": 15 + }, + { + "__id__": 16 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 82, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0.7071067811865475, + "w": 0.7071067811865476 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 90 + }, + "_id": "01/mwfVYBMkqZJrFYIKj5A" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 80 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "65frUzl7VMc6qGQAW/k65x" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 10, + "b": 10, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "677VqCBdlNRKuT0qWrhDW0" + }, + { + "__type__": "cc.BoxCollider2D", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "__prefab": null, + "tag": 0, + "_group": 8, + "_density": 1, + "_sensor": false, + "_friction": 0.2, + "_restitution": 0, + "_offset": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_size": { + "__type__": "cc.Size", + "width": 20, + "height": 80 + }, + "_id": "2fLL+SLUlFjIhyArlZE8wX" + }, + { + "__type__": "cc.Node", + "_name": "WeaponCollider-003", + "_objFlags": 0, + "_parent": { + "__id__": 4 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 18 + }, + { + "__id__": 19 + }, + { + "__id__": 20 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 87, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0.7071067811865475, + "w": 0.7071067811865476 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 90 + }, + "_id": "6aq2En3uVONrTOfKJ9LKws" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 17 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 90 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "d7yUBTwDlNdo0SxocYm4c0" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 17 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 10, + "b": 10, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "b4/f+2GRFCcbeuc1d6BI3B" + }, + { + "__type__": "cc.BoxCollider2D", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 17 + }, + "_enabled": true, + "__prefab": null, + "tag": 0, + "_group": 8, + "_density": 1, + "_sensor": false, + "_friction": 0.2, + "_restitution": 0, + "_offset": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_size": { + "__type__": "cc.Size", + "width": 20, + "height": 90 + }, + "_id": "cdJ3b7a79PJKD7PsVLTLRz" + }, + { + "__type__": "cc.Node", + "_name": "WeaponCollider-004", + "_objFlags": 0, + "_parent": { + "__id__": 4 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 22 + }, + { + "__id__": 23 + }, + { + "__id__": 24 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 92, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0.7071067811865475, + "w": 0.7071067811865476 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 90 + }, + "_id": "5cy6b2p75Ec5CNmUYN4v3U" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "90G2/JRPxCuLF/YltaOE6x" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 10, + "b": 10, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "1anCpabENOgYx59yUp3QpE" + }, + { + "__type__": "cc.BoxCollider2D", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "__prefab": null, + "tag": 0, + "_group": 8, + "_density": 1, + "_sensor": false, + "_friction": 0.2, + "_restitution": 0, + "_offset": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_size": { + "__type__": "cc.Size", + "width": 20, + "height": 100 + }, + "_id": "87IzyLtZJPxJsgbhFP75PZ" + }, + { + "__type__": "cc.Node", + "_name": "WeaponCollider-005", + "_objFlags": 0, + "_parent": { + "__id__": 4 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 26 + }, + { + "__id__": 27 + }, + { + "__id__": 28 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 97, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0.7071067811865475, + "w": 0.7071067811865476 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 90 + }, + "_id": "f2gu31xvpKaZ8O6R46LaWo" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 110 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "f8LpyOdKdH/Z9hJlfUyKg1" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 10, + "b": 10, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "5aIBtQGwRH5JO5FJwmtM2U" + }, + { + "__type__": "cc.BoxCollider2D", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": null, + "tag": 0, + "_group": 8, + "_density": 1, + "_sensor": false, + "_friction": 0.2, + "_restitution": 0, + "_offset": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_size": { + "__type__": "cc.Size", + "width": 20, + "height": 110 + }, + "_id": "0aG49hWrZCa686F6VVqqCL" + }, { "__type__": "cc.UITransform", "_name": "", @@ -369,6 +1062,37 @@ }, "_id": "3cAaPvthdElK2Tk7R8V3xz" }, + { + "__type__": "bba49sAP+VAQoXzfR8BfXXT", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 4 + }, + "_enabled": true, + "__prefab": null, + "colliders": [ + { + "__id__": 8 + }, + { + "__id__": 12 + }, + { + "__id__": 16 + }, + { + "__id__": 20 + }, + { + "__id__": 24 + }, + { + "__id__": 28 + } + ], + "_id": "efTecDVf5IyZOD5/n+1DG7" + }, { "__type__": "2391bi3+fpCqLBGVf9XsH0C", "_name": "", @@ -379,10 +1103,10 @@ "_enabled": true, "__prefab": null, "weaponAnimation": { - "__id__": 10 + "__id__": 30 }, - "collider": { - "__id__": 8 + "upgradableCollider": { + "__id__": 31 }, "_id": "femtdMmA5Ax5K78hjELCcD" }, @@ -395,22 +1119,22 @@ }, "_children": [ { - "__id__": 13 + "__id__": 34 } ], "_active": true, "_components": [ { - "__id__": 28 + "__id__": 49 }, { - "__id__": 29 + "__id__": 50 }, { - "__id__": 30 + "__id__": 51 }, { - "__id__": 31 + "__id__": 52 } ], "_prefab": null, @@ -447,20 +1171,20 @@ "_name": "PlayerUI", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 33 }, "_children": [ { - "__id__": 14 + "__id__": 35 } ], "_active": true, "_components": [ { - "__id__": 26 + "__id__": 47 }, { - "__id__": 27 + "__id__": 48 } ], "_prefab": null, @@ -497,23 +1221,23 @@ "_name": "PlayerHealthUI", "_objFlags": 0, "_parent": { - "__id__": 13 + "__id__": 34 }, "_children": [ { - "__id__": 15 + "__id__": 36 }, { - "__id__": 18 + "__id__": 39 } ], "_active": true, "_components": [ { - "__id__": 24 + "__id__": 45 }, { - "__id__": 25 + "__id__": 46 } ], "_prefab": null, @@ -550,16 +1274,16 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 14 + "__id__": 35 }, "_children": [], "_active": true, "_components": [ { - "__id__": 16 + "__id__": 37 }, { - "__id__": 17 + "__id__": 38 } ], "_prefab": null, @@ -596,7 +1320,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 15 + "__id__": 36 }, "_enabled": true, "__prefab": null, @@ -617,7 +1341,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 15 + "__id__": 36 }, "_enabled": true, "__prefab": null, @@ -655,20 +1379,20 @@ "_name": "HpBar", "_objFlags": 0, "_parent": { - "__id__": 14 + "__id__": 35 }, "_children": [ { - "__id__": 19 + "__id__": 40 } ], "_active": true, "_components": [ { - "__id__": 22 + "__id__": 43 }, { - "__id__": 23 + "__id__": 44 } ], "_prefab": null, @@ -705,16 +1429,16 @@ "_name": "MovableBar", "_objFlags": 0, "_parent": { - "__id__": 18 + "__id__": 39 }, "_children": [], "_active": true, "_components": [ { - "__id__": 20 + "__id__": 41 }, { - "__id__": 21 + "__id__": 42 } ], "_prefab": null, @@ -751,7 +1475,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 40 }, "_enabled": true, "__prefab": null, @@ -772,7 +1496,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 40 }, "_enabled": true, "__prefab": null, @@ -810,7 +1534,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 18 + "__id__": 39 }, "_enabled": true, "__prefab": null, @@ -831,12 +1555,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 18 + "__id__": 39 }, "_enabled": true, "__prefab": null, "_barSprite": { - "__id__": 21 + "__id__": 42 }, "_mode": 0, "_totalLength": 80, @@ -849,7 +1573,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 14 + "__id__": 35 }, "_enabled": true, "__prefab": null, @@ -866,25 +1590,25 @@ "_id": "7ekl5hIYtHP4LyYKcIy1P+" }, { - "__type__": "84a1cBXLvhOrYkDV1Pzasc1", + "__type__": "def45qvzIhOxpf/TVsL6wFb", "_name": "", "_objFlags": 0, "node": { - "__id__": 14 + "__id__": 35 }, "_enabled": true, "__prefab": null, "healthBar": { - "__id__": 23 + "__id__": 44 }, - "_id": "fdR9eSdI9Kh7IrotzIY0Rb" + "_id": "8doWxm45ZCKLqr0rVRHJa2" }, { "__type__": "cc.UITransform", "_name": "", "_objFlags": 0, "node": { - "__id__": 13 + "__id__": 34 }, "_enabled": true, "__prefab": null, @@ -901,25 +1625,22 @@ "_id": "57ch5XLAJEmKuYOYTW3ZCz" }, { - "__type__": "634f6dvwzVCooXo8hTpzl63", + "__type__": "6247fDeRcFOdImqOIwhfOOj", "_name": "", "_objFlags": 0, "node": { - "__id__": 13 + "__id__": 34 }, "_enabled": true, "__prefab": null, - "healthUI": { - "__id__": 25 - }, - "_id": "d2D9WtiThPe6mF1BVz5+iU" + "_id": "49hVDAypRMuoVp+F+IPkXM" }, { "__type__": "cc.UITransform", "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -940,7 +1661,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -978,17 +1699,15 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 33 }, "_enabled": true, "__prefab": null, "speed": 100, "collider": { - "__id__": 31 - }, - "playerUI": { - "__id__": 27 + "__id__": 52 }, + "playerUI": null, "_id": "5aDEGDNWpIaL+U2iIxK4vA" }, { @@ -996,7 +1715,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 33 }, "_enabled": true, "__prefab": null, @@ -1027,16 +1746,16 @@ }, "_children": [ { - "__id__": 33 + "__id__": 54 }, { - "__id__": 35 + "__id__": 56 } ], "_active": true, "_components": [ { - "__id__": 37 + "__id__": 58 } ], "_prefab": null, @@ -1073,13 +1792,13 @@ "_name": "XPSpawner", "_objFlags": 0, "_parent": { - "__id__": 32 + "__id__": 53 }, "_children": [], "_active": true, "_components": [ { - "__id__": 34 + "__id__": 55 } ], "_prefab": null, @@ -1116,7 +1835,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 33 + "__id__": 54 }, "_enabled": true, "__prefab": null, @@ -1131,13 +1850,13 @@ "_name": "EnemySpawner", "_objFlags": 0, "_parent": { - "__id__": 32 + "__id__": 53 }, "_children": [], "_active": true, "_components": [ { - "__id__": 36 + "__id__": 57 } ], "_prefab": null, @@ -1170,11 +1889,11 @@ "_id": "936Vpv3ydL8JZMvakVgAP5" }, { - "__type__": "8aa2aOTzVFLtKl5CV5vzpWp", + "__type__": "7914boZbMpO4oIxuuvZ61Wb", "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -1184,24 +1903,24 @@ "__expectedType__": "cc.Prefab" } ], - "_id": "0bYOmE6uFKe6bZiYUsXVFn" + "_id": "55UHuO7YRLaa/e/fP7FAK2" }, { - "__type__": "c5416rtZLFCbpWbvH1cdF52", + "__type__": "839f4SZvHNBFaiDSpMi6pOJ", "_name": "", "_objFlags": 0, "node": { - "__id__": 32 + "__id__": 53 }, "_enabled": true, "__prefab": null, "enemySpawner": { - "__id__": 36 + "__id__": 57 }, "xpSpawner": { - "__id__": 34 + "__id__": 55 }, - "_id": "389jvXDeVHmanyKnmtceKg" + "_id": "1ffjazmm5IkZwKInsSIULY" }, { "__type__": "cc.Node", @@ -1212,28 +1931,28 @@ }, "_children": [ { - "__id__": 39 + "__id__": 60 }, { - "__id__": 62 + "__id__": 83 }, { - "__id__": 76 + "__id__": 97 }, { - "__id__": 79 + "__id__": 100 }, { - "__id__": 82 + "__id__": 103 }, { - "__id__": 85 + "__id__": 106 } ], "_active": true, "_components": [ { - "__id__": 88 + "__id__": 109 } ], "_prefab": null, @@ -1270,20 +1989,20 @@ "_name": "GameUI", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 59 }, "_children": [ { - "__id__": 40 + "__id__": 61 }, { - "__id__": 52 + "__id__": 73 } ], "_active": true, "_components": [ { - "__id__": 61 + "__id__": 82 } ], "_prefab": null, @@ -1320,20 +2039,20 @@ "_name": "TopUI", "_objFlags": 0, "_parent": { - "__id__": 39 + "__id__": 60 }, "_children": [ { - "__id__": 41 + "__id__": 62 } ], "_active": true, "_components": [ { - "__id__": 50 + "__id__": 71 }, { - "__id__": 51 + "__id__": 72 } ], "_prefab": null, @@ -1370,23 +2089,23 @@ "_name": "XpBar", "_objFlags": 0, "_parent": { - "__id__": 40 + "__id__": 61 }, "_children": [ { - "__id__": 42 + "__id__": 63 }, { - "__id__": 45 + "__id__": 66 } ], "_active": true, "_components": [ { - "__id__": 48 + "__id__": 69 }, { - "__id__": 49 + "__id__": 70 } ], "_prefab": null, @@ -1423,16 +2142,16 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 41 + "__id__": 62 }, "_children": [], "_active": true, "_components": [ { - "__id__": 43 + "__id__": 64 }, { - "__id__": 44 + "__id__": 65 } ], "_prefab": null, @@ -1469,7 +2188,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 42 + "__id__": 63 }, "_enabled": true, "__prefab": null, @@ -1490,7 +2209,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 42 + "__id__": 63 }, "_enabled": true, "__prefab": null, @@ -1528,16 +2247,16 @@ "_name": "MovableBar", "_objFlags": 0, "_parent": { - "__id__": 41 + "__id__": 62 }, "_children": [], "_active": true, "_components": [ { - "__id__": 46 + "__id__": 67 }, { - "__id__": 47 + "__id__": 68 } ], "_prefab": null, @@ -1574,7 +2293,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 45 + "__id__": 66 }, "_enabled": true, "__prefab": null, @@ -1595,7 +2314,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 45 + "__id__": 66 }, "_enabled": true, "__prefab": null, @@ -1633,7 +2352,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 41 + "__id__": 62 }, "_enabled": true, "__prefab": null, @@ -1654,12 +2373,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 41 + "__id__": 62 }, "_enabled": true, "__prefab": null, "_barSprite": { - "__id__": 47 + "__id__": 68 }, "_mode": 0, "_totalLength": 600, @@ -1672,7 +2391,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 40 + "__id__": 61 }, "_enabled": true, "__prefab": null, @@ -1693,7 +2412,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 40 + "__id__": 61 }, "_enabled": true, "__prefab": null, @@ -1722,17 +2441,17 @@ "_name": "UI", "_objFlags": 0, "_parent": { - "__id__": 39 + "__id__": 60 }, "_children": [ { - "__id__": 53 + "__id__": 74 } ], "_active": true, "_components": [ { - "__id__": 60 + "__id__": 81 } ], "_prefab": null, @@ -1769,23 +2488,23 @@ "_name": "VirtualJoystic", "_objFlags": 0, "_parent": { - "__id__": 52 + "__id__": 73 }, "_children": [ { - "__id__": 54 + "__id__": 75 } ], "_active": true, "_components": [ { - "__id__": 57 + "__id__": 78 }, { - "__id__": 58 + "__id__": 79 }, { - "__id__": 59 + "__id__": 80 } ], "_prefab": null, @@ -1822,16 +2541,16 @@ "_name": "Knob", "_objFlags": 0, "_parent": { - "__id__": 53 + "__id__": 74 }, "_children": [], "_active": true, "_components": [ { - "__id__": 55 + "__id__": 76 }, { - "__id__": 56 + "__id__": 77 } ], "_prefab": null, @@ -1868,7 +2587,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 54 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -1889,7 +2608,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 54 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -1927,7 +2646,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -1948,7 +2667,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -1986,13 +2705,13 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 74 }, "_enabled": true, "__prefab": null, "maxDistance": 50, "knob": { - "__id__": 54 + "__id__": 75 }, "_id": "50ceZG62tGlYXvZWEvSDKl" }, @@ -2001,7 +2720,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 52 + "__id__": 73 }, "_enabled": true, "__prefab": null, @@ -2022,12 +2741,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 39 + "__id__": 60 }, "_enabled": true, "__prefab": null, "xpBar": { - "__id__": 49 + "__id__": 70 }, "_id": "bau/7eItRFrKKoAZZb/uYL" }, @@ -2036,20 +2755,20 @@ "_name": "ModalWindowManager", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 59 }, "_children": [ { - "__id__": 63 + "__id__": 84 } ], "_active": true, "_components": [ { - "__id__": 74 + "__id__": 95 }, { - "__id__": 75 + "__id__": 96 } ], "_prefab": null, @@ -2085,17 +2804,17 @@ "__type__": "cc.Node", "_objFlags": 0, "_parent": { - "__id__": 62 + "__id__": 83 }, "_prefab": { - "__id__": 64 + "__id__": 85 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 63 + "__id__": 84 }, "asset": { "__uuid__": "663674aa-da1c-44b0-8049-49db9b020973", @@ -2103,11 +2822,11 @@ }, "fileId": "32U/bJCUBDlaQxxGFNXZTu", "instance": { - "__id__": 65 + "__id__": 86 }, "targetOverrides": [ { - "__id__": 72 + "__id__": 93 } ] }, @@ -2118,19 +2837,19 @@ "mountedComponents": [], "propertyOverrides": [ { - "__id__": 66 + "__id__": 87 }, { - "__id__": 68 + "__id__": 89 }, { - "__id__": 69 + "__id__": 90 }, { - "__id__": 70 + "__id__": 91 }, { - "__id__": 71 + "__id__": 92 } ], "removedComponents": [] @@ -2138,7 +2857,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 88 }, "propertyPath": [ "_name" @@ -2154,7 +2873,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 88 }, "propertyPath": [ "_lpos" @@ -2169,7 +2888,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 88 }, "propertyPath": [ "_lrot" @@ -2185,7 +2904,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 88 }, "propertyPath": [ "_euler" @@ -2200,7 +2919,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 88 }, "propertyPath": [ "_active" @@ -2217,7 +2936,7 @@ ], "target": null, "targetInfo": { - "__id__": 73 + "__id__": 94 } }, { @@ -2231,7 +2950,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 62 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -2252,7 +2971,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 62 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -2269,16 +2988,16 @@ "_name": "Sprite", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 59 }, "_children": [], "_active": true, "_components": [ { - "__id__": 77 + "__id__": 98 }, { - "__id__": 78 + "__id__": 99 } ], "_prefab": null, @@ -2315,7 +3034,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 76 + "__id__": 97 }, "_enabled": true, "__prefab": null, @@ -2336,7 +3055,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 76 + "__id__": 97 }, "_enabled": true, "__prefab": null, @@ -2374,16 +3093,16 @@ "_name": "Sprite-001", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 59 }, "_children": [], "_active": true, "_components": [ { - "__id__": 80 + "__id__": 101 }, { - "__id__": 81 + "__id__": 102 } ], "_prefab": null, @@ -2420,7 +3139,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 79 + "__id__": 100 }, "_enabled": true, "__prefab": null, @@ -2441,7 +3160,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 79 + "__id__": 100 }, "_enabled": true, "__prefab": null, @@ -2479,16 +3198,16 @@ "_name": "Sprite-002", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 59 }, "_children": [], "_active": true, "_components": [ { - "__id__": 83 + "__id__": 104 }, { - "__id__": 84 + "__id__": 105 } ], "_prefab": null, @@ -2525,7 +3244,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 82 + "__id__": 103 }, "_enabled": true, "__prefab": null, @@ -2546,7 +3265,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 82 + "__id__": 103 }, "_enabled": true, "__prefab": null, @@ -2584,16 +3303,16 @@ "_name": "Sprite-003", "_objFlags": 0, "_parent": { - "__id__": 38 + "__id__": 59 }, "_children": [], "_active": true, "_components": [ { - "__id__": 86 + "__id__": 107 }, { - "__id__": 87 + "__id__": 108 } ], "_prefab": null, @@ -2630,7 +3349,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 85 + "__id__": 106 }, "_enabled": true, "__prefab": null, @@ -2651,7 +3370,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 85 + "__id__": 106 }, "_enabled": true, "__prefab": null, @@ -2689,7 +3408,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 38 + "__id__": 59 }, "_enabled": true, "__prefab": null, @@ -2758,7 +3477,7 @@ "_enabled": true, "__prefab": null, "_cameraComponent": { - "__id__": 88 + "__id__": 109 }, "_alignCanvasWithScreen": true, "_id": "12O/ljcVlEqLmVm3U2gEOQ" @@ -2802,39 +3521,25 @@ "_enabled": true, "__prefab": null, "virtualJoystic": { - "__id__": 59 + "__id__": 80 }, "player": { - "__id__": 30 + "__id__": 51 }, "weapon": { - "__id__": 11 + "__id__": 32 }, "enemyManager": { - "__id__": 37 + "__id__": 58 }, - "strikeDelay": 2, - "collisionDelay": 0.5, "camera": { - "__id__": 88 + "__id__": 109 }, "gameUI": { - "__id__": 61 + "__id__": 82 }, - "requiredLevelXps": [ - 5, - 5, - 5, - 10, - 10, - 10, - 20, - 20, - 20, - 20 - ], "modalWindowManager": { - "__id__": 75 + "__id__": 96 }, "settingsAsset": { "__uuid__": "6828fb79-0a56-437e-b718-9f43bf234fbc", @@ -2847,26 +3552,26 @@ "fileId": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f", "nestedPrefabInstanceRoots": [ { - "__id__": 63 + "__id__": 84 } ] }, { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 95 + "__id__": 116 }, "shadows": { - "__id__": 96 + "__id__": 117 }, "_skybox": { - "__id__": 97 + "__id__": 118 }, "fog": { - "__id__": 98 + "__id__": 119 }, "octree": { - "__id__": 99 + "__id__": 120 } }, { diff --git a/assets/Scripts/Game/Collision/PlayerCollisionSystem.ts b/assets/Scripts/Game/Collision/PlayerCollisionSystem.ts index 8b3abee..eb2f6e9 100644 --- a/assets/Scripts/Game/Collision/PlayerCollisionSystem.ts +++ b/assets/Scripts/Game/Collision/PlayerCollisionSystem.ts @@ -1,6 +1,6 @@ import { Collider2D, Contact2DType } from "cc"; import { GroupType } from "../GroupType"; -import { Player } from "../Player/Player"; +import { Player } from "../Unit/Player/Player"; import { GameTimer } from "../../Services/GameTimer"; import { Enemy } from "../Enemy/Enemy"; import { XP } from "../XP/XP"; diff --git a/assets/Scripts/Game/Collision/WeaponCollisionSystem.ts b/assets/Scripts/Game/Collision/WeaponCollisionSystem.ts index a35b74e..a8d67f4 100644 --- a/assets/Scripts/Game/Collision/WeaponCollisionSystem.ts +++ b/assets/Scripts/Game/Collision/WeaponCollisionSystem.ts @@ -1,15 +1,15 @@ -import { Collider2D, Contact2DType } from "cc"; +import { Collider2D } from "cc"; import { Enemy } from "../Enemy/Enemy"; -import { Weapon } from "../Weapon"; +import { Weapon } from "../Unit/Player/Weapon/Weapon"; export class WeaponCollisionSystem { private weapon: Weapon; public constructor(weapon: Weapon) { this.weapon = weapon; - weapon.Collider.on(Contact2DType.BEGIN_CONTACT, this.onWeaponContactBegin, this); + weapon.Collider.ContactBeginEvent.on(this.onWeaponContactBegin, this); } - private onWeaponContactBegin(_selfCollider: Collider2D, otherCollider: Collider2D): void { + private onWeaponContactBegin(otherCollider: Collider2D): void { otherCollider.getComponent(Enemy).dealDamage(this.weapon.Damage); } } diff --git a/assets/Scripts/Game/Data/GameSettings.ts b/assets/Scripts/Game/Data/GameSettings.ts index 4da1209..e7e0fea 100644 --- a/assets/Scripts/Game/Data/GameSettings.ts +++ b/assets/Scripts/Game/Data/GameSettings.ts @@ -1,6 +1,7 @@ export class GameSettings { - public playerSettings: PlayerSettings = new PlayerSettings(); - public weaponSettings: WeaponSettings = new WeaponSettings(); + public player: PlayerSettings = new PlayerSettings(); + public weapon: WeaponSettings = new WeaponSettings(); + public upgrades: UpgradeSettings = new UpgradeSettings(); } export class PlayerSettings { @@ -11,4 +12,13 @@ export class PlayerSettings { export class WeaponSettings { public strikeDelay = 0; + public damage = 0; +} + +export class UpgradeSettings { + public maxWeaponLengthUpgrades = 0; + public maxWeaponDamageUpgrades = 0; + public maxHorizontalProjectileUpgrades = 0; + public maxVerticalProjectileUpgrades = 0; + public maxRegenerationUpgrades = 0; } diff --git a/assets/Scripts/Game/Enemy.meta b/assets/Scripts/Game/Enemy.meta index 27d2b1a..c5eff62 100644 --- a/assets/Scripts/Game/Enemy.meta +++ b/assets/Scripts/Game/Enemy.meta @@ -2,7 +2,7 @@ "ver": "1.1.0", "importer": "directory", "imported": true, - "uuid": "e71832fc-dfd7-409d-924d-f87037c811e4", + "uuid": "baa05588-9899-4403-91b3-403907780c7a", "files": [], "subMetas": {}, "userData": { diff --git a/assets/Scripts/Game/Enemy/Enemy.ts.meta b/assets/Scripts/Game/Enemy/Enemy.ts.meta index 493d9ce..b926227 100644 --- a/assets/Scripts/Game/Enemy/Enemy.ts.meta +++ b/assets/Scripts/Game/Enemy/Enemy.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "e6f969c0-2783-4eb3-b467-356c68db4512", + "uuid": "7f8b634a-1ec3-4d5b-99cb-6377f07a3870", "files": [], "subMetas": {}, "userData": {} diff --git a/assets/Scripts/Game/Enemy/EnemyManager.ts.meta b/assets/Scripts/Game/Enemy/EnemyManager.ts.meta index 7505b76..3bb71b3 100644 --- a/assets/Scripts/Game/Enemy/EnemyManager.ts.meta +++ b/assets/Scripts/Game/Enemy/EnemyManager.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "c5416aed-64b1-426e-959b-bc7d5c745e76", + "uuid": "839f4499-bc73-4115-a883-4a9322ea9389", "files": [], "subMetas": {}, "userData": {} diff --git a/assets/Scripts/Game/Enemy/EnemyMover.ts.meta b/assets/Scripts/Game/Enemy/EnemyMover.ts.meta index ecd740b..da6b635 100644 --- a/assets/Scripts/Game/Enemy/EnemyMover.ts.meta +++ b/assets/Scripts/Game/Enemy/EnemyMover.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "50aa2052-8c6f-4405-8732-346ac2a942c9", + "uuid": "179f7bfa-44fc-4f41-9432-4aec4f3991a6", "files": [], "subMetas": {}, "userData": {} diff --git a/assets/Scripts/Game/Enemy/EnemySpawner.ts.meta b/assets/Scripts/Game/Enemy/EnemySpawner.ts.meta index 1bb9c7f..c0a6ee9 100644 --- a/assets/Scripts/Game/Enemy/EnemySpawner.ts.meta +++ b/assets/Scripts/Game/Enemy/EnemySpawner.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "8aa2a393-cd51-4bb4-a979-095e6fce95a9", + "uuid": "7914ba19-6cca-4ee2-8231-baebd9eb559b", "files": [], "subMetas": {}, "userData": {} diff --git a/assets/Scripts/Game/GameBootstrapper.ts b/assets/Scripts/Game/GameBootstrapper.ts index 12b0ded..50cbf69 100644 --- a/assets/Scripts/Game/GameBootstrapper.ts +++ b/assets/Scripts/Game/GameBootstrapper.ts @@ -1,4 +1,4 @@ -import { Camera, CCFloat, CCInteger, Component, director, JsonAsset, KeyCode, _decorator } from "cc"; +import { Camera, Component, JsonAsset, KeyCode, _decorator } from "cc"; import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager"; import { PlayerCollisionSystem } from "./Collision/PlayerCollisionSystem"; import { WeaponCollisionSystem } from "./Collision/WeaponCollisionSystem"; @@ -10,10 +10,10 @@ import { VirtualJoystic } from "./Input/VirtualJoystic"; import { GameModalLauncher } from "./ModalWIndows/GameModalLauncher"; import { Pauser } from "./Pauser"; import { Player } from "./Player/Player"; +import { Weapon } from "./Player/Weapon/Weapon"; import { GameUI } from "./UI/GameUI"; import { Upgrader } from "./Upgrades/Upgrader"; -import { UpgradeType } from "./Upgrades/UpgradeType"; -import { Weapon } from "./Weapon"; + const { ccclass, property } = _decorator; @ccclass("GameBootstrapper") @@ -32,19 +32,19 @@ export class GameBootstrapper extends Component { private gamePauser: Pauser = new Pauser(); public start(): void { - const gameSettings: GameSettings = this.settingsAsset.json; + const settings: GameSettings = this.settingsAsset.json; this.virtualJoystic.init(); - this.weapon.init(gameSettings.weaponSettings.strikeDelay); + this.weapon.init(settings.weapon); const wasd = new KeyboardInput(KeyCode.KEY_W, KeyCode.KEY_S, KeyCode.KEY_A, KeyCode.KEY_D); const arrowKeys = new KeyboardInput(KeyCode.ARROW_UP, KeyCode.ARROW_DOWN, KeyCode.ARROW_LEFT, KeyCode.ARROW_RIGHT); const dualInput: MultiInput = new MultiInput([this.virtualJoystic, wasd, arrowKeys]); - this.player.init(dualInput, this.weapon, gameSettings.playerSettings.defaultHP, gameSettings.playerSettings.requiredXP); + this.player.init(dualInput, this.weapon, settings.player.defaultHP, settings.player.requiredXP); - this.playerCollisionSystem = new PlayerCollisionSystem(this.player, gameSettings.playerSettings.collisionDelay); + this.playerCollisionSystem = new PlayerCollisionSystem(this.player, settings.player.collisionDelay); new WeaponCollisionSystem(this.weapon); - const upgrader = new Upgrader(this.player); + const upgrader = new Upgrader(this.player, settings.upgrades); new GameModalLauncher(this.modalWindowManager, this.player, this.gamePauser, upgrader); this.enemyManager.init(this.player.node); diff --git a/assets/Scripts/Game/ModalWIndows/GameModalLauncher.ts b/assets/Scripts/Game/ModalWIndows/GameModalLauncher.ts index de51b54..6246cfb 100644 --- a/assets/Scripts/Game/ModalWIndows/GameModalLauncher.ts +++ b/assets/Scripts/Game/ModalWIndows/GameModalLauncher.ts @@ -1,6 +1,6 @@ import { ModalWindowManager } from "../../Services/ModalWindowSystem/ModalWindowManager"; import { Pauser } from "../Pauser"; -import { Player } from "../Player/Player"; +import { Player } from "../Unit/Player/Player"; import { Upgrader } from "../Upgrades/Upgrader"; import { UpgradeType } from "../Upgrades/UpgradeType"; import { GameModalWindowTypes } from "./GameModalWindowTypes"; diff --git a/assets/Scripts/Game/Player.meta b/assets/Scripts/Game/Player.meta index 8ee04e9..9432dd3 100644 --- a/assets/Scripts/Game/Player.meta +++ b/assets/Scripts/Game/Player.meta @@ -2,7 +2,7 @@ "ver": "1.1.0", "importer": "directory", "imported": true, - "uuid": "3697ba4f-16f0-4a2d-9330-47c472df973a", + "uuid": "3c590530-b416-4184-9b87-f87755610708", "files": [], "subMetas": {}, "userData": { diff --git a/assets/Scripts/Game/Player/PlayerUI.meta b/assets/Scripts/Game/Player/PlayerUI.meta index 88f0d2a..a5f39b9 100644 --- a/assets/Scripts/Game/Player/PlayerUI.meta +++ b/assets/Scripts/Game/Player/PlayerUI.meta @@ -2,7 +2,7 @@ "ver": "1.1.0", "importer": "directory", "imported": true, - "uuid": "82d14029-0ea6-4de6-b796-05339d2d19b1", + "uuid": "7eadb488-192c-4370-9e59-20f27929fba1", "files": [], "subMetas": {}, "userData": { diff --git a/assets/Scripts/Game/Player/PlayerUI/PlayerHealthUI.ts.meta b/assets/Scripts/Game/Player/PlayerUI/PlayerHealthUI.ts.meta index 18c4e6f..252b70c 100644 --- a/assets/Scripts/Game/Player/PlayerUI/PlayerHealthUI.ts.meta +++ b/assets/Scripts/Game/Player/PlayerUI/PlayerHealthUI.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "84a1c057-2ef8-4ead-8903-5753f36ac735", + "uuid": "def45aaf-cc88-4ec6-97ff-4d5b0beb015b", "files": [], "subMetas": {}, "userData": {} diff --git a/assets/Scripts/Game/Player/PlayerUI/PlayerUI.ts.meta b/assets/Scripts/Game/Player/PlayerUI/PlayerUI.ts.meta index 3efcc00..68df4a3 100644 --- a/assets/Scripts/Game/Player/PlayerUI/PlayerUI.ts.meta +++ b/assets/Scripts/Game/Player/PlayerUI/PlayerUI.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "634f676f-c335-42a2-85e8-f214e9ce5eb7", + "uuid": "6247f0de-45c1-4e74-89aa-388c217ce3a3", "files": [], "subMetas": {}, "userData": {} diff --git a/assets/Scripts/Game/Player/UnitHealth.ts.meta b/assets/Scripts/Game/Player/UnitHealth.ts.meta index cf31960..4e27c48 100644 --- a/assets/Scripts/Game/Player/UnitHealth.ts.meta +++ b/assets/Scripts/Game/Player/UnitHealth.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "8118806a-dc7c-4e94-84c2-b0a95be43209", + "uuid": "14972f1d-8009-4d39-8a6f-553ae1b3a011", "files": [], "subMetas": {}, "userData": {} diff --git a/assets/Scripts/Game/Player/UnitLevel.ts.meta b/assets/Scripts/Game/Player/UnitLevel.ts.meta index 000207a..652e1a3 100644 --- a/assets/Scripts/Game/Player/UnitLevel.ts.meta +++ b/assets/Scripts/Game/Player/UnitLevel.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "5eeabc4f-21b1-4983-b935-e44c12051766", + "uuid": "61e76d1e-15a8-42cc-990d-b9c7848ddab3", "files": [], "subMetas": {}, "userData": {} diff --git a/assets/Scripts/Game/Player/Weapon.meta b/assets/Scripts/Game/Player/Weapon.meta new file mode 100644 index 0000000..41ad0fb --- /dev/null +++ b/assets/Scripts/Game/Player/Weapon.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "b232195c-46e2-4508-9f71-5efb42ab490f", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Scripts/Game/Player/Weapon/UpgradableCollider.ts b/assets/Scripts/Game/Player/Weapon/UpgradableCollider.ts new file mode 100644 index 0000000..ea4f8f1 --- /dev/null +++ b/assets/Scripts/Game/Player/Weapon/UpgradableCollider.ts @@ -0,0 +1,43 @@ +import { BoxCollider2D, Collider2D, Component, Contact2DType, _decorator } from "cc"; +import { ISignal } from "../../../Services/EventSystem/ISignal"; +import { Signal } from "../../../Services/EventSystem/Signal"; + +const { ccclass, property } = _decorator; + +@ccclass("UpgradableCollider") +export class UpgradableCollider extends Component { + @property(BoxCollider2D) private colliders: BoxCollider2D[] = []; + private contactBeginEvent: Signal = new Signal(); + private currentUpgradeLevel = 0; + + public init(): void { + this.setUpgradeLevel(); + + for (const collider of this.colliders) { + collider.on(Contact2DType.BEGIN_CONTACT, this.onColliderContactBegin, this); + } + } + + public get ContactBeginEvent(): ISignal { + return this.contactBeginEvent; + } + + public upgrade(): void { + if (this.currentUpgradeLevel == this.colliders.length - 1) throw new Error("Already at max upgrade! " + this.currentUpgradeLevel); + + this.currentUpgradeLevel++; + this.setUpgradeLevel(); + } + + private setUpgradeLevel(): void { + for (const collider of this.colliders) { + collider.node.active = false; + } + + this.colliders[this.currentUpgradeLevel].node.active = true; + } + + private onColliderContactBegin(thisCollider: Collider2D, otherCollider: Collider2D): void { + this.contactBeginEvent.trigger(otherCollider); + } +} diff --git a/assets/Scripts/Game/Player/Weapon/UpgradableCollider.ts.meta b/assets/Scripts/Game/Player/Weapon/UpgradableCollider.ts.meta new file mode 100644 index 0000000..e81c292 --- /dev/null +++ b/assets/Scripts/Game/Player/Weapon/UpgradableCollider.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "bba49b00-3fe5-4042-85f3-7d1f017d75d3", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/Game/Weapon.ts b/assets/Scripts/Game/Player/Weapon/Weapon.ts similarity index 53% rename from assets/Scripts/Game/Weapon.ts rename to assets/Scripts/Game/Player/Weapon/Weapon.ts index 2c0804c..6ee5c92 100644 --- a/assets/Scripts/Game/Weapon.ts +++ b/assets/Scripts/Game/Player/Weapon/Weapon.ts @@ -1,22 +1,29 @@ -import { Animation, AnimationState, BoxCollider2D, Collider2D, Component, _decorator } from "cc"; -import { GameTimer } from "../Services/GameTimer"; +import { Animation, AnimationState, Component, _decorator } from "cc"; +import { GameTimer } from "../../../Services/GameTimer"; +import { WeaponSettings } from "../../Data/GameSettings"; + +import { UpgradableCollider } from "./UpgradableCollider"; const { ccclass, property } = _decorator; @ccclass("Weapon") export class Weapon extends Component { @property(Animation) private weaponAnimation: Animation; - @property(BoxCollider2D) private collider: BoxCollider2D; + @property(UpgradableCollider) private upgradableCollider: UpgradableCollider; private strikeTimer: GameTimer; private strikeState: AnimationState; + private damage: number; - public init(strikeDelay: number): void { - this.strikeTimer = new GameTimer(strikeDelay); + public init(settings: WeaponSettings): void { + this.strikeTimer = new GameTimer(settings.strikeDelay); + this.damage = settings.damage; this.node.active = false; this.weaponAnimation.on(Animation.EventType.FINISHED, this.endStrike, this); this.strikeState = this.weaponAnimation.getState(this.weaponAnimation.clips[0].name); this.strikeState.speed = 1; + + this.upgradableCollider.init(); } public gameTick(deltaTime: number): void { @@ -26,16 +33,20 @@ export class Weapon extends Component { } } - public get Collider(): Collider2D { - return this.collider; + public get Collider(): UpgradableCollider { + return this.upgradableCollider; } public get Damage(): number { - return 5; + return this.damage; } - public upgradeWeaponDamage(): void {} - public upgradeWeaponLength(): void {} + public upgradeWeaponDamage(): void { + this.damage++; + } + public upgradeWeaponLength(): void { + this.upgradableCollider.upgrade(); + } private strike(): void { this.node.active = true; diff --git a/assets/Scripts/Game/Weapon.ts.meta b/assets/Scripts/Game/Player/Weapon/Weapon.ts.meta similarity index 100% rename from assets/Scripts/Game/Weapon.ts.meta rename to assets/Scripts/Game/Player/Weapon/Weapon.ts.meta diff --git a/assets/Scripts/Game/UI/GameUI.ts b/assets/Scripts/Game/UI/GameUI.ts index 446b999..f29881f 100644 --- a/assets/Scripts/Game/UI/GameUI.ts +++ b/assets/Scripts/Game/UI/GameUI.ts @@ -1,6 +1,6 @@ import { Component, ProgressBar, _decorator } from "cc"; -import { Player } from "../Player/Player"; -import { UnitLevel } from "../Player/UnitLevel"; +import { Player } from "../Unit/Player/Player"; +import { UnitLevel } from "../Unit/Player/UnitLevel"; const { ccclass, property } = _decorator; @ccclass("GameUI") diff --git a/assets/Scripts/Game/UI/LevelUpWindow/LevelUpModalWindow.ts b/assets/Scripts/Game/UI/LevelUpWindow/LevelUpModalWindow.ts index b4d1e78..1401a43 100644 --- a/assets/Scripts/Game/UI/LevelUpWindow/LevelUpModalWindow.ts +++ b/assets/Scripts/Game/UI/LevelUpWindow/LevelUpModalWindow.ts @@ -31,7 +31,7 @@ export class LevelUpModalWindow extends ModalWindow } } - private chooseSkill(skill: LevelUpSkill): void { - this.dismiss(UpgradeType.WeaponDamage); + private chooseSkill(upgradeType: UpgradeType): void { + this.dismiss(upgradeType); } } diff --git a/assets/Scripts/Game/UI/LevelUpWindow/LevelUpSkill.ts b/assets/Scripts/Game/UI/LevelUpWindow/LevelUpSkill.ts index f341e0a..f7758c5 100644 --- a/assets/Scripts/Game/UI/LevelUpWindow/LevelUpSkill.ts +++ b/assets/Scripts/Game/UI/LevelUpWindow/LevelUpSkill.ts @@ -7,17 +7,20 @@ const { ccclass, property } = _decorator; @ccclass("LevelUpSkill") export class LevelUpSkill extends Component { @property(Label) private skillTitle: Label; - private chooseSkillEvent: Signal = new Signal(); + private chooseSkillEvent: Signal = new Signal(); + private skillType: UpgradeType; + public init(skillType: UpgradeType): void { + this.skillType = skillType; this.skillTitle.string = `Skill ${skillType}`; this.node.on(NodeEventType.MOUSE_DOWN, this.chooseSkill, this); } - public get ChooseSkillEvent(): ISignal { + public get ChooseSkillEvent(): ISignal { return this.chooseSkillEvent; } private chooseSkill(): void { - this.chooseSkillEvent.trigger(this); + this.chooseSkillEvent.trigger(this.skillType); } } diff --git a/assets/Scripts/Game/Upgrades/Upgrader.ts b/assets/Scripts/Game/Upgrades/Upgrader.ts index 9b24e3f..b8c76a5 100644 --- a/assets/Scripts/Game/Upgrades/Upgrader.ts +++ b/assets/Scripts/Game/Upgrades/Upgrader.ts @@ -1,4 +1,5 @@ -import { Player } from "../Player/Player"; +import { UpgradeSettings } from "../Data/GameSettings"; +import { Player } from "../Unit/Player/Player"; import { UpgradeType } from "./UpgradeType"; export class Upgrader { @@ -7,18 +8,20 @@ export class Upgrader { private typeToLevel: Map = new Map(); private typeToMaxLevel: Map = new Map(); - public constructor(player: Player) { + public constructor(player: Player, settings: UpgradeSettings) { this.player = player; - this.setTypeMaps(UpgradeType.WeaponLength, this.upgradeWeaponLength, 5); - this.setTypeMaps(UpgradeType.WeaponDamage, this.upgradeWeaponDamage, 5); + this.setTypeMaps(UpgradeType.WeaponLength, this.upgradeWeaponLength.bind(this), settings.maxWeaponLengthUpgrades); + this.setTypeMaps(UpgradeType.WeaponDamage, this.upgradeWeaponDamage, settings.maxWeaponDamageUpgrades); } public upgradeSkill(type: UpgradeType): void { if (!this.typeToAction.has(type)) throw new Error("Upgrade does not have " + type); - if (this.isMaxLevel(type)) throw new Error("Upgrade is already at max level" + type); + if (this.isMaxLevel(type)) throw new Error("Upgrade is already at max level " + type); this.typeToAction.get(type)(); + const level: number = this.typeToLevel.get(type); + this.typeToLevel.set(type, level + 1); } public getAvailableUpgrades(): Set {