diff --git a/assets/Media/Images/background.png b/assets/Media/Images/background.png new file mode 100644 index 0000000..f8e1cf9 Binary files /dev/null and b/assets/Media/Images/background.png differ diff --git a/assets/Media/Images/background.png.meta b/assets/Media/Images/background.png.meta new file mode 100644 index 0000000..2b914df --- /dev/null +++ b/assets/Media/Images/background.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.25", + "importer": "image", + "imported": true, + "uuid": "b522fec0-43ad-4f82-b496-79b67de5690e", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "b522fec0-43ad-4f82-b496-79b67de5690e@6c48a", + "displayName": "background", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "b522fec0-43ad-4f82-b496-79b67de5690e", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "b522fec0-43ad-4f82-b496-79b67de5690e@f9941", + "displayName": "background", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 512, + "height": 512, + "rawWidth": 512, + "rawHeight": 512, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -256, + -256, + 0, + 256, + -256, + 0, + -256, + 256, + 0, + 256, + 256, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 512, + 512, + 512, + 0, + 0, + 512, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -256, + -256, + 0 + ], + "maxPos": [ + 256, + 256, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "b522fec0-43ad-4f82-b496-79b67de5690e@6c48a", + "atlasUuid": "" + }, + "ver": "1.0.11", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": true, + "hasAlpha": true, + "redirect": "b522fec0-43ad-4f82-b496-79b67de5690e@f9941" + } +} diff --git a/assets/Media/Prefabs/Game/Background.meta b/assets/Media/Prefabs/Game/Background.meta new file mode 100644 index 0000000..dae8700 --- /dev/null +++ b/assets/Media/Prefabs/Game/Background.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "a6ec454b-a1f1-4622-94ab-0d46de4b0f2b", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Media/Prefabs/Game/Background/background-001.prefab b/assets/Media/Prefabs/Game/Background/background-001.prefab new file mode 100644 index 0000000..cb758fd --- /dev/null +++ b/assets/Media/Prefabs/Game/Background/background-001.prefab @@ -0,0 +1,142 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "background-001", + "_objFlags": 0, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false, + "asyncLoadAssets": false + }, + { + "__type__": "cc.Node", + "_name": "background-001", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 2 + }, + { + "__id__": 4 + } + ], + "_prefab": { + "__id__": 6 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 512, + "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": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 3 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 512, + "height": 512 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a543e4ngZOuJDldEp7USz4" + }, + { + "__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": 58, + "g": 58, + "b": 58, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "b522fec0-43ad-4f82-b496-79b67de5690e@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": "c3TST28D1MAYYNOTjXCu9X" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "0fuih3dHdO06Ljv1VvbfLw" + } +] \ No newline at end of file diff --git a/assets/Media/Prefabs/Game/Background/background-001.prefab.meta b/assets/Media/Prefabs/Game/Background/background-001.prefab.meta new file mode 100644 index 0000000..74fac03 --- /dev/null +++ b/assets/Media/Prefabs/Game/Background/background-001.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.40", + "importer": "prefab", + "imported": true, + "uuid": "798cca4e-324e-4d93-a4b1-afa7ed68d159", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "background-001" + } +} diff --git a/assets/Scenes/Game.scene b/assets/Scenes/Game.scene index fe32ab1..77489d1 100644 --- a/assets/Scenes/Game.scene +++ b/assets/Scenes/Game.scene @@ -27,11 +27,11 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 130 + "__id__": 133 }, "autoReleaseAssets": false, "_globals": { - "__id__": 131 + "__id__": 134 }, "_id": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f" }, @@ -209,34 +209,37 @@ "__id__": 13 }, { - "__id__": 15 + "__id__": 16 }, { - "__id__": 17 + "__id__": 18 }, { - "__id__": 19 + "__id__": 20 }, { - "__id__": 69 + "__id__": 22 }, { - "__id__": 75 + "__id__": 72 + }, + { + "__id__": 78 } ], "_active": true, "_components": [ - { - "__id__": 126 - }, - { - "__id__": 127 - }, - { - "__id__": 128 - }, { "__id__": 129 + }, + { + "__id__": 130 + }, + { + "__id__": 131 + }, + { + "__id__": 132 } ], "_prefab": null, @@ -270,7 +273,7 @@ }, { "__type__": "cc.Node", - "_name": "HaloProjectileLauncher", + "_name": "Background", "_objFlags": 0, "_parent": { "__id__": 12 @@ -280,6 +283,90 @@ "_components": [ { "__id__": 14 + }, + { + "__id__": 15 + } + ], + "_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": "31W6+JD6xF/Z21G+tjYS+M" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 640, + "height": 960 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "0b62tZ3vJIeapZYnHNQGIr" + }, + { + "__type__": "26e600FC3xNlZNOihGlWfAd", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "__prefab": null, + "backgroundPrefabs": [ + { + "__uuid__": "798cca4e-324e-4d93-a4b1-afa7ed68d159", + "__expectedType__": "cc.Prefab" + } + ], + "_id": "4a2g/bSrtAEawOmGzr4EXu" + }, + { + "__type__": "cc.Node", + "_name": "HaloProjectileLauncher", + "_objFlags": 0, + "_parent": { + "__id__": 12 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 17 } ], "_prefab": null, @@ -316,7 +403,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 13 + "__id__": 16 }, "_enabled": true, "__prefab": null, @@ -337,7 +424,7 @@ "_active": true, "_components": [ { - "__id__": 16 + "__id__": 19 } ], "_prefab": null, @@ -374,7 +461,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 15 + "__id__": 18 }, "_enabled": true, "__prefab": null, @@ -395,7 +482,7 @@ "_active": true, "_components": [ { - "__id__": 18 + "__id__": 21 } ], "_prefab": null, @@ -432,7 +519,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 17 + "__id__": 20 }, "_enabled": true, "__prefab": null, @@ -451,25 +538,25 @@ }, "_children": [ { - "__id__": 20 + "__id__": 23 }, { - "__id__": 35 + "__id__": 38 } ], "_active": true, "_components": [ - { - "__id__": 65 - }, - { - "__id__": 66 - }, - { - "__id__": 67 - }, { "__id__": 68 + }, + { + "__id__": 69 + }, + { + "__id__": 70 + }, + { + "__id__": 71 } ], "_prefab": null, @@ -506,20 +593,20 @@ "_name": "PlayerUI", "_objFlags": 0, "_parent": { - "__id__": 19 + "__id__": 22 }, "_children": [ { - "__id__": 21 + "__id__": 24 } ], "_active": true, "_components": [ { - "__id__": 33 + "__id__": 36 }, { - "__id__": 34 + "__id__": 37 } ], "_prefab": null, @@ -556,23 +643,23 @@ "_name": "PlayerHealthUI", "_objFlags": 0, "_parent": { - "__id__": 20 + "__id__": 23 }, "_children": [ { - "__id__": 22 + "__id__": 25 }, { - "__id__": 25 + "__id__": 28 } ], "_active": true, "_components": [ { - "__id__": 31 + "__id__": 34 }, { - "__id__": 32 + "__id__": 35 } ], "_prefab": null, @@ -609,16 +696,16 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 21 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ { - "__id__": 23 + "__id__": 26 }, { - "__id__": 24 + "__id__": 27 } ], "_prefab": null, @@ -655,7 +742,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 22 + "__id__": 25 }, "_enabled": true, "__prefab": null, @@ -676,7 +763,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 22 + "__id__": 25 }, "_enabled": true, "__prefab": null, @@ -714,20 +801,20 @@ "_name": "HpBar", "_objFlags": 0, "_parent": { - "__id__": 21 + "__id__": 24 }, "_children": [ { - "__id__": 26 + "__id__": 29 } ], "_active": true, "_components": [ { - "__id__": 29 + "__id__": 32 }, { - "__id__": 30 + "__id__": 33 } ], "_prefab": null, @@ -764,16 +851,16 @@ "_name": "MovableBar", "_objFlags": 0, "_parent": { - "__id__": 25 + "__id__": 28 }, "_children": [], "_active": true, "_components": [ { - "__id__": 27 + "__id__": 30 }, { - "__id__": 28 + "__id__": 31 } ], "_prefab": null, @@ -810,7 +897,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 29 }, "_enabled": true, "__prefab": null, @@ -831,7 +918,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 29 }, "_enabled": true, "__prefab": null, @@ -869,7 +956,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 25 + "__id__": 28 }, "_enabled": true, "__prefab": null, @@ -890,12 +977,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 25 + "__id__": 28 }, "_enabled": true, "__prefab": null, "_barSprite": { - "__id__": 28 + "__id__": 31 }, "_mode": 0, "_totalLength": 80, @@ -908,7 +995,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 21 + "__id__": 24 }, "_enabled": true, "__prefab": null, @@ -929,12 +1016,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 21 + "__id__": 24 }, "_enabled": true, "__prefab": null, "healthBar": { - "__id__": 30 + "__id__": 33 }, "_id": "8doWxm45ZCKLqr0rVRHJa2" }, @@ -943,7 +1030,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 20 + "__id__": 23 }, "_enabled": true, "__prefab": null, @@ -964,12 +1051,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 20 + "__id__": 23 }, "_enabled": true, "__prefab": null, "healthUI": { - "__id__": 32 + "__id__": 35 }, "_id": "49hVDAypRMuoVp+F+IPkXM" }, @@ -978,17 +1065,17 @@ "_name": "Weapon", "_objFlags": 0, "_parent": { - "__id__": 19 + "__id__": 22 }, "_children": [ { - "__id__": 36 + "__id__": 39 } ], "_active": true, "_components": [ { - "__id__": 64 + "__id__": 67 } ], "_prefab": null, @@ -1025,38 +1112,38 @@ "_name": "AnimatedWeapon", "_objFlags": 0, "_parent": { - "__id__": 35 + "__id__": 38 }, "_children": [ { - "__id__": 37 + "__id__": 40 }, { - "__id__": 41 + "__id__": 44 }, { - "__id__": 45 + "__id__": 48 }, { - "__id__": 49 + "__id__": 52 }, { - "__id__": 53 + "__id__": 56 }, { - "__id__": 57 + "__id__": 60 } ], "_active": true, "_components": [ { - "__id__": 61 + "__id__": 64 }, { - "__id__": 62 + "__id__": 65 }, { - "__id__": 63 + "__id__": 66 } ], "_prefab": null, @@ -1093,19 +1180,19 @@ "_name": "WeaponCollider", "_objFlags": 0, "_parent": { - "__id__": 36 + "__id__": 39 }, "_children": [], "_active": true, "_components": [ { - "__id__": 38 + "__id__": 41 }, { - "__id__": 39 + "__id__": 42 }, { - "__id__": 40 + "__id__": 43 } ], "_prefab": null, @@ -1142,7 +1229,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 37 + "__id__": 40 }, "_enabled": true, "__prefab": null, @@ -1163,7 +1250,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 37 + "__id__": 40 }, "_enabled": true, "__prefab": null, @@ -1201,7 +1288,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 37 + "__id__": 40 }, "_enabled": true, "__prefab": null, @@ -1228,19 +1315,19 @@ "_name": "WeaponCollider-001", "_objFlags": 0, "_parent": { - "__id__": 36 + "__id__": 39 }, "_children": [], "_active": true, "_components": [ { - "__id__": 42 + "__id__": 45 }, { - "__id__": 43 + "__id__": 46 }, { - "__id__": 44 + "__id__": 47 } ], "_prefab": null, @@ -1277,7 +1364,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 41 + "__id__": 44 }, "_enabled": true, "__prefab": null, @@ -1298,7 +1385,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 41 + "__id__": 44 }, "_enabled": true, "__prefab": null, @@ -1336,7 +1423,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 41 + "__id__": 44 }, "_enabled": true, "__prefab": null, @@ -1363,19 +1450,19 @@ "_name": "WeaponCollider-002", "_objFlags": 0, "_parent": { - "__id__": 36 + "__id__": 39 }, "_children": [], "_active": true, "_components": [ { - "__id__": 46 + "__id__": 49 }, { - "__id__": 47 + "__id__": 50 }, { - "__id__": 48 + "__id__": 51 } ], "_prefab": null, @@ -1412,7 +1499,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 45 + "__id__": 48 }, "_enabled": true, "__prefab": null, @@ -1433,7 +1520,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 45 + "__id__": 48 }, "_enabled": true, "__prefab": null, @@ -1471,7 +1558,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 45 + "__id__": 48 }, "_enabled": true, "__prefab": null, @@ -1498,19 +1585,19 @@ "_name": "WeaponCollider-003", "_objFlags": 0, "_parent": { - "__id__": 36 + "__id__": 39 }, "_children": [], "_active": true, "_components": [ { - "__id__": 50 + "__id__": 53 }, { - "__id__": 51 + "__id__": 54 }, { - "__id__": 52 + "__id__": 55 } ], "_prefab": null, @@ -1547,7 +1634,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 49 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1568,7 +1655,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 49 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1606,7 +1693,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 49 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1633,19 +1720,19 @@ "_name": "WeaponCollider-004", "_objFlags": 0, "_parent": { - "__id__": 36 + "__id__": 39 }, "_children": [], "_active": true, "_components": [ { - "__id__": 54 + "__id__": 57 }, { - "__id__": 55 + "__id__": 58 }, { - "__id__": 56 + "__id__": 59 } ], "_prefab": null, @@ -1682,7 +1769,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -1703,7 +1790,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -1741,7 +1828,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -1768,19 +1855,19 @@ "_name": "WeaponCollider-005", "_objFlags": 0, "_parent": { - "__id__": 36 + "__id__": 39 }, "_children": [], "_active": true, "_components": [ { - "__id__": 58 + "__id__": 61 }, { - "__id__": 59 + "__id__": 62 }, { - "__id__": 60 + "__id__": 63 } ], "_prefab": null, @@ -1817,7 +1904,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 57 + "__id__": 60 }, "_enabled": true, "__prefab": null, @@ -1838,7 +1925,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 57 + "__id__": 60 }, "_enabled": true, "__prefab": null, @@ -1876,7 +1963,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 57 + "__id__": 60 }, "_enabled": true, "__prefab": null, @@ -1903,7 +1990,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 36 + "__id__": 39 }, "_enabled": true, "__prefab": null, @@ -1924,7 +2011,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 36 + "__id__": 39 }, "_enabled": true, "__prefab": null, @@ -1946,28 +2033,28 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 36 + "__id__": 39 }, "_enabled": true, "__prefab": null, "colliders": [ { - "__id__": 40 + "__id__": 43 }, { - "__id__": 44 + "__id__": 47 }, { - "__id__": 48 + "__id__": 51 }, { - "__id__": 52 + "__id__": 55 }, { - "__id__": 56 + "__id__": 59 }, { - "__id__": 60 + "__id__": 63 } ], "_id": "efTecDVf5IyZOD5/n+1DG7" @@ -1977,15 +2064,15 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 38 }, "_enabled": true, "__prefab": null, "weaponAnimation": { - "__id__": 62 + "__id__": 65 }, "upgradableCollider": { - "__id__": 63 + "__id__": 66 }, "_id": "femtdMmA5Ax5K78hjELCcD" }, @@ -1994,7 +2081,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 22 }, "_enabled": true, "__prefab": null, @@ -2015,7 +2102,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 22 }, "_enabled": true, "__prefab": null, @@ -2053,19 +2140,19 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 22 }, "_enabled": true, "__prefab": null, "speed": 100, "collider": { - "__id__": 68 + "__id__": 71 }, "playerUI": { - "__id__": 34 + "__id__": 37 }, "weapon": { - "__id__": 64 + "__id__": 67 }, "_id": "5aDEGDNWpIaL+U2iIxK4vA" }, @@ -2074,7 +2161,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 22 }, "_enabled": true, "__prefab": null, @@ -2105,16 +2192,16 @@ }, "_children": [ { - "__id__": 70 + "__id__": 73 }, { - "__id__": 72 + "__id__": 75 } ], "_active": true, "_components": [ { - "__id__": 74 + "__id__": 77 } ], "_prefab": null, @@ -2151,13 +2238,13 @@ "_name": "XPSpawner", "_objFlags": 0, "_parent": { - "__id__": 69 + "__id__": 72 }, "_children": [], "_active": true, "_components": [ { - "__id__": 71 + "__id__": 74 } ], "_prefab": null, @@ -2194,7 +2281,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 70 + "__id__": 73 }, "_enabled": true, "__prefab": null, @@ -2209,13 +2296,13 @@ "_name": "EnemySpawner", "_objFlags": 0, "_parent": { - "__id__": 69 + "__id__": 72 }, "_children": [], "_active": true, "_components": [ { - "__id__": 73 + "__id__": 76 } ], "_prefab": null, @@ -2252,7 +2339,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 72 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -2269,15 +2356,15 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 69 + "__id__": 72 }, "_enabled": true, "__prefab": null, "enemySpawner": { - "__id__": 73 + "__id__": 76 }, "xpSpawner": { - "__id__": 71 + "__id__": 74 }, "_id": "1ffjazmm5IkZwKInsSIULY" }, @@ -2290,13 +2377,10 @@ }, "_children": [ { - "__id__": 76 + "__id__": 79 }, { - "__id__": 99 - }, - { - "__id__": 113 + "__id__": 102 }, { "__id__": 116 @@ -2306,12 +2390,15 @@ }, { "__id__": 122 + }, + { + "__id__": 125 } ], "_active": true, "_components": [ { - "__id__": 125 + "__id__": 128 } ], "_prefab": null, @@ -2348,20 +2435,20 @@ "_name": "GameUI", "_objFlags": 0, "_parent": { - "__id__": 75 + "__id__": 78 }, "_children": [ { - "__id__": 77 + "__id__": 80 }, { - "__id__": 89 + "__id__": 92 } ], "_active": true, "_components": [ { - "__id__": 98 + "__id__": 101 } ], "_prefab": null, @@ -2398,20 +2485,20 @@ "_name": "TopUI", "_objFlags": 0, "_parent": { - "__id__": 76 + "__id__": 79 }, "_children": [ { - "__id__": 78 + "__id__": 81 } ], "_active": true, "_components": [ { - "__id__": 87 + "__id__": 90 }, { - "__id__": 88 + "__id__": 91 } ], "_prefab": null, @@ -2448,23 +2535,23 @@ "_name": "XpBar", "_objFlags": 0, "_parent": { - "__id__": 77 + "__id__": 80 }, "_children": [ { - "__id__": 79 + "__id__": 82 }, { - "__id__": 82 + "__id__": 85 } ], "_active": true, "_components": [ { - "__id__": 85 + "__id__": 88 }, { - "__id__": 86 + "__id__": 89 } ], "_prefab": null, @@ -2501,112 +2588,7 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 78 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 80 - }, - { - "__id__": 81 - } - ], - "_prefab": null, - "_lpos": { - "__type__": "cc.Vec3", - "x": -300, - "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": "e4JF72OIBCC5ucGza4GcsP" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 79 - }, - "_enabled": true, - "__prefab": null, - "_contentSize": { - "__type__": "cc.Size", - "width": 600, - "height": 16 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0.5 - }, - "_id": "2duT630xZNPr9+UsJ+JGvq" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 79 - }, - "_enabled": true, - "__prefab": null, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 207, - "g": 207, - "b": 207, - "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": "accSS/dStHUq2WXFMgN0oy" - }, - { - "__type__": "cc.Node", - "_name": "MovableBar", - "_objFlags": 0, - "_parent": { - "__id__": 78 + "__id__": 81 }, "_children": [], "_active": true, @@ -2645,7 +2627,7 @@ "y": 0, "z": 0 }, - "_id": "0dmdJ4cytHZaC5Nt7WklqK" + "_id": "e4JF72OIBCC5ucGza4GcsP" }, { "__type__": "cc.UITransform", @@ -2666,7 +2648,7 @@ "x": 0, "y": 0.5 }, - "_id": "93ubNu/2lIcq4CHNxuVKSV" + "_id": "2duT630xZNPr9+UsJ+JGvq" }, { "__type__": "cc.Sprite", @@ -2680,6 +2662,111 @@ "_customMaterial": null, "_srcBlendFactor": 2, "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 207, + "g": 207, + "b": 207, + "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": "accSS/dStHUq2WXFMgN0oy" + }, + { + "__type__": "cc.Node", + "_name": "MovableBar", + "_objFlags": 0, + "_parent": { + "__id__": 81 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 86 + }, + { + "__id__": 87 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -300, + "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": "0dmdJ4cytHZaC5Nt7WklqK" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 85 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 600, + "height": 16 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0.5 + }, + "_id": "93ubNu/2lIcq4CHNxuVKSV" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 85 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, "_color": { "__type__": "cc.Color", "r": 71, @@ -2711,7 +2798,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 78 + "__id__": 81 }, "_enabled": true, "__prefab": null, @@ -2732,12 +2819,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 78 + "__id__": 81 }, "_enabled": true, "__prefab": null, "_barSprite": { - "__id__": 84 + "__id__": 87 }, "_mode": 0, "_totalLength": 600, @@ -2750,7 +2837,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 77 + "__id__": 80 }, "_enabled": true, "__prefab": null, @@ -2771,7 +2858,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 77 + "__id__": 80 }, "_enabled": true, "__prefab": null, @@ -2800,17 +2887,17 @@ "_name": "UI", "_objFlags": 0, "_parent": { - "__id__": 76 + "__id__": 79 }, "_children": [ { - "__id__": 90 + "__id__": 93 } ], "_active": true, "_components": [ { - "__id__": 97 + "__id__": 100 } ], "_prefab": null, @@ -2847,23 +2934,23 @@ "_name": "VirtualJoystic", "_objFlags": 0, "_parent": { - "__id__": 89 + "__id__": 92 }, "_children": [ { - "__id__": 91 + "__id__": 94 } ], "_active": true, "_components": [ { - "__id__": 94 + "__id__": 97 }, { - "__id__": 95 + "__id__": 98 }, { - "__id__": 96 + "__id__": 99 } ], "_prefab": null, @@ -2900,16 +2987,16 @@ "_name": "Knob", "_objFlags": 0, "_parent": { - "__id__": 90 + "__id__": 93 }, "_children": [], "_active": true, "_components": [ { - "__id__": 92 + "__id__": 95 }, { - "__id__": 93 + "__id__": 96 } ], "_prefab": null, @@ -2946,7 +3033,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 91 + "__id__": 94 }, "_enabled": true, "__prefab": null, @@ -2967,7 +3054,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 91 + "__id__": 94 }, "_enabled": true, "__prefab": null, @@ -3005,7 +3092,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 90 + "__id__": 93 }, "_enabled": true, "__prefab": null, @@ -3026,7 +3113,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 90 + "__id__": 93 }, "_enabled": true, "__prefab": null, @@ -3064,13 +3151,13 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 90 + "__id__": 93 }, "_enabled": true, "__prefab": null, "maxDistance": 50, "knob": { - "__id__": 91 + "__id__": 94 }, "_id": "50ceZG62tGlYXvZWEvSDKl" }, @@ -3079,7 +3166,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 89 + "__id__": 92 }, "_enabled": true, "__prefab": null, @@ -3100,12 +3187,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 76 + "__id__": 79 }, "_enabled": true, "__prefab": null, "xpBar": { - "__id__": 86 + "__id__": 89 }, "_id": "bau/7eItRFrKKoAZZb/uYL" }, @@ -3114,20 +3201,20 @@ "_name": "ModalWindowManager", "_objFlags": 0, "_parent": { - "__id__": 75 + "__id__": 78 }, "_children": [ { - "__id__": 100 + "__id__": 103 } ], "_active": true, "_components": [ { - "__id__": 111 + "__id__": 114 }, { - "__id__": 112 + "__id__": 115 } ], "_prefab": null, @@ -3163,17 +3250,17 @@ "__type__": "cc.Node", "_objFlags": 0, "_parent": { - "__id__": 99 + "__id__": 102 }, "_prefab": { - "__id__": 101 + "__id__": 104 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 100 + "__id__": 103 }, "asset": { "__uuid__": "663674aa-da1c-44b0-8049-49db9b020973", @@ -3181,11 +3268,11 @@ }, "fileId": "32U/bJCUBDlaQxxGFNXZTu", "instance": { - "__id__": 102 + "__id__": 105 }, "targetOverrides": [ { - "__id__": 109 + "__id__": 112 } ] }, @@ -3195,20 +3282,20 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 103 - }, - { - "__id__": 105 - }, { "__id__": 106 }, { - "__id__": 107 + "__id__": 108 }, { - "__id__": 108 + "__id__": 109 + }, + { + "__id__": 110 + }, + { + "__id__": 111 } ], "removedComponents": [] @@ -3216,7 +3303,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 104 + "__id__": 107 }, "propertyPath": [ "_name" @@ -3232,7 +3319,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 104 + "__id__": 107 }, "propertyPath": [ "_lpos" @@ -3247,7 +3334,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 104 + "__id__": 107 }, "propertyPath": [ "_lrot" @@ -3263,7 +3350,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 104 + "__id__": 107 }, "propertyPath": [ "_euler" @@ -3278,7 +3365,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 104 + "__id__": 107 }, "propertyPath": [ "_active" @@ -3295,7 +3382,7 @@ ], "target": null, "targetInfo": { - "__id__": 110 + "__id__": 113 } }, { @@ -3309,7 +3396,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 99 + "__id__": 102 }, "_enabled": true, "__prefab": null, @@ -3330,7 +3417,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 99 + "__id__": 102 }, "_enabled": true, "__prefab": null, @@ -3347,16 +3434,16 @@ "_name": "Sprite", "_objFlags": 0, "_parent": { - "__id__": 75 + "__id__": 78 }, "_children": [], "_active": true, "_components": [ { - "__id__": 114 + "__id__": 117 }, { - "__id__": 115 + "__id__": 118 } ], "_prefab": null, @@ -3393,7 +3480,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 113 + "__id__": 116 }, "_enabled": true, "__prefab": null, @@ -3414,7 +3501,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 113 + "__id__": 116 }, "_enabled": true, "__prefab": null, @@ -3452,16 +3539,16 @@ "_name": "Sprite-001", "_objFlags": 0, "_parent": { - "__id__": 75 + "__id__": 78 }, "_children": [], "_active": true, "_components": [ { - "__id__": 117 + "__id__": 120 }, { - "__id__": 118 + "__id__": 121 } ], "_prefab": null, @@ -3498,7 +3585,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 116 + "__id__": 119 }, "_enabled": true, "__prefab": null, @@ -3519,7 +3606,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 116 + "__id__": 119 }, "_enabled": true, "__prefab": null, @@ -3557,16 +3644,16 @@ "_name": "Sprite-002", "_objFlags": 0, "_parent": { - "__id__": 75 + "__id__": 78 }, "_children": [], "_active": true, "_components": [ { - "__id__": 120 + "__id__": 123 }, { - "__id__": 121 + "__id__": 124 } ], "_prefab": null, @@ -3603,7 +3690,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 119 + "__id__": 122 }, "_enabled": true, "__prefab": null, @@ -3624,7 +3711,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 119 + "__id__": 122 }, "_enabled": true, "__prefab": null, @@ -3662,16 +3749,16 @@ "_name": "Sprite-003", "_objFlags": 0, "_parent": { - "__id__": 75 + "__id__": 78 }, "_children": [], "_active": true, "_components": [ { - "__id__": 123 + "__id__": 126 }, { - "__id__": 124 + "__id__": 127 } ], "_prefab": null, @@ -3708,7 +3795,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 122 + "__id__": 125 }, "_enabled": true, "__prefab": null, @@ -3729,7 +3816,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 122 + "__id__": 125 }, "_enabled": true, "__prefab": null, @@ -3767,7 +3854,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 75 + "__id__": 78 }, "_enabled": true, "__prefab": null, @@ -3836,7 +3923,7 @@ "_enabled": true, "__prefab": null, "_cameraComponent": { - "__id__": 125 + "__id__": 128 }, "_alignCanvasWithScreen": true, "_id": "12O/ljcVlEqLmVm3U2gEOQ" @@ -3880,31 +3967,34 @@ "_enabled": true, "__prefab": null, "virtualJoystic": { - "__id__": 96 + "__id__": 99 }, "player": { - "__id__": 67 + "__id__": 70 }, "haloProjectileLauncherComponent": { - "__id__": 14 + "__id__": 17 }, "horizontalProjectileLauncherComponent": { - "__id__": 16 + "__id__": 19 }, "diagonalProjectileLauncherComponent": { - "__id__": 18 + "__id__": 21 }, "enemyManager": { - "__id__": 74 + "__id__": 77 }, "camera": { - "__id__": 125 + "__id__": 128 }, "gameUI": { - "__id__": 98 + "__id__": 101 + }, + "background": { + "__id__": 15 }, "modalWindowManager": { - "__id__": 112 + "__id__": 115 }, "settingsAsset": { "__uuid__": "6828fb79-0a56-437e-b718-9f43bf234fbc", @@ -3920,26 +4010,26 @@ "__id__": 2 }, { - "__id__": 100 + "__id__": 103 } ] }, { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 132 - }, - "shadows": { - "__id__": 133 - }, - "_skybox": { - "__id__": 134 - }, - "fog": { "__id__": 135 }, - "octree": { + "shadows": { "__id__": 136 + }, + "_skybox": { + "__id__": 137 + }, + "fog": { + "__id__": 138 + }, + "octree": { + "__id__": 139 } }, { diff --git a/assets/Scripts/Game/Background.meta b/assets/Scripts/Game/Background.meta new file mode 100644 index 0000000..d0cc68f --- /dev/null +++ b/assets/Scripts/Game/Background.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "cc51d327-9e82-4916-98ef-95612253838b", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Scripts/Game/Background/Background.ts b/assets/Scripts/Game/Background/Background.ts new file mode 100644 index 0000000..878b442 --- /dev/null +++ b/assets/Scripts/Game/Background/Background.ts @@ -0,0 +1,114 @@ +import { _decorator, Component, Node, Prefab, instantiate, randomRangeInt, Vec3 } from "cc"; +import { SCREEN_HALF_HEIGHT, SCREEN_HALF_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH } from "../Data/GameConstants"; +const { ccclass, property } = _decorator; + +@ccclass("Background") +export class Background extends Component { + @property(Prefab) private backgroundPrefabs: Prefab[] = []; + + private targetNode: Node; + private instancedBackgrounds: Node[][] = []; + + private rows = 3; + private columns = 3; + private nodeSize = 512; + + private playerGridPosX = 0; + private playerGridPosY = 0; + + public init(targetNode: Node): void { + this.targetNode = targetNode; + + for (let i = 0; i < this.rows; i++) { + const rowNodes: Node[] = []; + for (let u = 0; u < this.columns; u++) { + const randomIndex = randomRangeInt(0, this.backgroundPrefabs.length); + const backgroundNode = instantiate(this.backgroundPrefabs[randomIndex]); + backgroundNode.setParent(this.node); + + const x = u * this.nodeSize - this.nodeSize + SCREEN_HALF_WIDTH; + const y = i * this.nodeSize - this.nodeSize + SCREEN_HALF_HEIGHT; + backgroundNode.setWorldPosition(new Vec3(x, y, 0)); + + rowNodes.push(backgroundNode); + } + + this.instancedBackgrounds.push(rowNodes); + } + } + + public gameTick(): void { + this.tryTileX(); + this.tryTileY(); + } + + private tryTileX(): void { + const playerGridPosX = Math.round((this.targetNode.worldPosition.x - SCREEN_HALF_WIDTH) / this.nodeSize); + + if (playerGridPosX < this.playerGridPosX) { + // move the last column to the left + const columnIndex = this.columns - 1; + for (let i = 0; i < this.rows; i++) { + const instancedNode = this.instancedBackgrounds[i][columnIndex]; + const newPosition: Vec3 = instancedNode.worldPosition; + newPosition.x -= this.columns * this.nodeSize; + + instancedNode.setWorldPosition(newPosition); + + this.instancedBackgrounds[i].splice(columnIndex, 1); + this.instancedBackgrounds[i].unshift(instancedNode); + } + } else if (this.playerGridPosX < playerGridPosX) { + // move the first column to the right + for (let i = 0; i < this.rows; i++) { + const instancedNode = this.instancedBackgrounds[i][0]; + const newPosition: Vec3 = instancedNode.worldPosition; + newPosition.x += this.columns * this.nodeSize; + + instancedNode.setWorldPosition(newPosition); + + this.instancedBackgrounds[i].splice(0, 1); + this.instancedBackgrounds[i].push(instancedNode); + } + } + + this.playerGridPosX = playerGridPosX; + } + + private tryTileY(): void { + const playerGridPosY = Math.round((this.targetNode.worldPosition.y - SCREEN_HALF_HEIGHT) / this.nodeSize); + + if (playerGridPosY < this.playerGridPosY) { + // move the last row down + const rowIndex = this.rows - 1; + const nodesInRow: Node[] = []; + for (let i = 0; i < this.columns; i++) { + const instancedNode = this.instancedBackgrounds[rowIndex][i]; + const newPosition: Vec3 = instancedNode.worldPosition; + newPosition.y -= this.rows * this.nodeSize; + + instancedNode.setWorldPosition(newPosition); + nodesInRow.push(instancedNode); + } + + this.instancedBackgrounds.splice(rowIndex, 1); + this.instancedBackgrounds.unshift(nodesInRow); + } else if (this.playerGridPosY < playerGridPosY) { + // move the first row up + const nodesInRow: Node[] = []; + for (let i = 0; i < this.columns; i++) { + const instancedNode = this.instancedBackgrounds[0][i]; + const newPosition: Vec3 = instancedNode.worldPosition; + newPosition.y += this.rows * this.nodeSize; + + instancedNode.setWorldPosition(newPosition); + nodesInRow.push(instancedNode); + } + + this.instancedBackgrounds.splice(0, 1); + this.instancedBackgrounds.push(nodesInRow); + } + + this.playerGridPosY = playerGridPosY; + } +} diff --git a/assets/Scripts/Game/Background/Background.ts.meta b/assets/Scripts/Game/Background/Background.ts.meta new file mode 100644 index 0000000..4caf3a0 --- /dev/null +++ b/assets/Scripts/Game/Background/Background.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "26e60d05-0b7c-4d95-934e-8a11a559f01d", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/Game/Data/GameConstants.ts b/assets/Scripts/Game/Data/GameConstants.ts new file mode 100644 index 0000000..3fbafc7 --- /dev/null +++ b/assets/Scripts/Game/Data/GameConstants.ts @@ -0,0 +1,5 @@ +export const SCREEN_WIDTH = 640; +export const SCREEN_HEIGHT = 960; + +export const SCREEN_HALF_WIDTH = SCREEN_WIDTH / 2; +export const SCREEN_HALF_HEIGHT = SCREEN_HEIGHT / 2; diff --git a/assets/Scripts/Game/Data/GameConstants.ts.meta b/assets/Scripts/Game/Data/GameConstants.ts.meta new file mode 100644 index 0000000..21cc438 --- /dev/null +++ b/assets/Scripts/Game/Data/GameConstants.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "6224412b-af18-4cec-a04b-ed291f866e83", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/Game/Game.ts b/assets/Scripts/Game/Game.ts index 0470b34..c377460 100644 --- a/assets/Scripts/Game/Game.ts +++ b/assets/Scripts/Game/Game.ts @@ -1,6 +1,7 @@ import { Camera, Component, JsonAsset, KeyCode, Vec2, _decorator } from "cc"; import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager"; import { delay } from "../Services/Utils/AsyncUtils"; +import { Background } from "./Background/Background"; import { PlayerCollisionSystem } from "./Collision/PlayerCollisionSystem"; import { PlayerProjectileCollisionSystem } from "./Collision/PlayerProjectileCollisionSystem"; import { WeaponCollisionSystem } from "./Collision/WeaponCollisionSystem"; @@ -30,6 +31,7 @@ export class Game extends Component { @property(EnemyManager) private enemyManager: EnemyManager; @property(Camera) private camera: Camera; @property(GameUI) private gameUI: GameUI; + @property(Background) private background: Background; @property(ModalWindowManager) private modalWindowManager: ModalWindowManager; @property(JsonAsset) private settingsAsset: JsonAsset; @@ -98,6 +100,7 @@ export class Game extends Component { new GameModalLauncher(this.modalWindowManager, this.player, this.gamePauser, upgrader); this.gameUI.init(this.player); + this.background.init(this.player.node); this.gamePauser.resume(); // while not dead @@ -116,6 +119,7 @@ export class Game extends Component { this.haloProjectileLauncher.gameTick(deltaTime); this.horizontalProjectileLauncher.gameTick(deltaTime); this.diagonalProjectileLauncher.gameTick(deltaTime); + this.background.gameTick(); this.camera.node.worldPosition = this.player.node.worldPosition; }