Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Cocos-GoldenMiner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
等吃饭
Cocos-GoldenMiner
Commits
52de0a2b
Commit
52de0a2b
authored
Apr 14, 2023
by
Friends233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
随机生成游戏舞台
parent
03f5a902
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
838 additions
and
667 deletions
+838
-667
Game.fire
assets/Scenes/Game.fire
+587
-646
GameConfig.ts
assets/Script/Config/GameConfig.ts
+21
-1
GameScene.ts
assets/Script/GameScene.ts
+79
-3
utils.ts
assets/Script/utils.ts
+44
-2
clipRation.anim
assets/resources/ani/clipRation.anim
+2
-2
computer.prefab
assets/resources/props/computer.prefab
+3
-3
propWrp.prefab
assets/resources/props/propWrp.prefab
+83
-0
propWrp.prefab.meta
assets/resources/props/propWrp.prefab.meta
+9
-0
safetyHat.prefab
assets/resources/props/safetyHat.prefab
+2
-2
star.prefab
assets/resources/props/star.prefab
+2
-2
tool.prefab
assets/resources/props/tool.prefab
+2
-2
vehicle.prefab
assets/resources/props/vehicle.prefab
+2
-2
wheatEar.prefab
assets/resources/props/wheatEar.prefab
+2
-2
No files found.
assets/Scenes/Game.fire
View file @
52de0a2b
...
...
@@ -17,7 +17,7 @@
"__id__": 2
}
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [],
"_prefab": null,
"_opacity": 255,
...
...
@@ -90,34 +90,34 @@
"__id__": 22
},
{
"__id__":
54
"__id__":
48
},
{
"__id__": 7
8
"__id__": 7
2
},
{
"__id__":
80
"__id__":
74
},
{
"__id__":
82
"__id__":
76
},
{
"__id__": 8
6
"__id__": 8
0
},
{
"__id__":
90
"__id__":
84
}
],
"_active": true,
"_components": [
{
"__id__":
93
"__id__":
87
},
{
"__id__":
94
"__id__":
88
},
{
"__id__":
95
"__id__":
89
}
],
"_prefab": null,
...
...
@@ -578,7 +578,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
33xWjqm+pPdaKs+GmXWKrt
"
"_id": "
46+FYCWLBDH67yjSbsmTPC
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -608,7 +608,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
feasAL3o5NHLwks0bUw916
"
"_id": "
1fxEwbW15H2rKu0GO4i76s
"
},
{
"__type__": "7c5ffhlHDpBpoDQ8wfKN7pu",
...
...
@@ -1043,23 +1043,45 @@
"__id__": 23
},
{
"__id__": 28
"__id__": 25
},
{
"__id__": 27
},
{
"__id__": 29
},
{
"__id__": 31
},
{
"__id__": 33
},
{
"__id__": 38
"__id__": 35
},
{
"__id__": 37
},
{
"__id__": 39
},
{
"__id__": 41
},
{
"__id__": 43
},
{
"__id__": 4
9
"__id__": 4
5
}
],
"_active": true,
"_components": [],
"_components": [
{
"__id__": 47
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
...
...
@@ -1071,8 +1093,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
750
,
"height":
4
30
"width":
846
,
"height":
5
30
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -1110,26 +1132,16 @@
},
{
"__type__": "cc.Node",
"_name": "
tool
",
"_name": "
propWrp
",
"_objFlags": 0,
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 24
},
{
"__id__": 25
},
{
"__id__": 26
}
],
"_components": [],
"_prefab": {
"__id__": 2
7
"__id__": 2
4
},
"_opacity": 255,
"_color": {
...
...
@@ -1141,8 +1153,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
116
,
"height": 1
39
"width":
294
,
"height": 1
73
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -1153,8 +1165,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-
10.3
6,
1
34.681
,
-
27
6,
1
78.5
,
0,
0,
0,
...
...
@@ -1176,70 +1188,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e68POgZ+dGYYYL/9inwJtC"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "de045763-871e-4d1a-8b91-ab61a2bf4477"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "0a4jwFpRxG56aQr41iaOC8"
},
{
"__type__": "cc.BoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
},
"_enabled": true,
"tag": 2,
"_offset": {
"__type__": "cc.Vec2",
"x": 0.8,
"y": -26.8
},
"_size": {
"__type__": "cc.Size",
"width": 93.4,
"height": 67.1
},
"_id": "d9qZp7ihREsKY5H7pWKNYV"
},
{
"__type__": "a4cebApRXhOpYXmhf5gIeC3",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
},
"_enabled": true,
"_id": "f5kJwpN+1OO4CumodtSAgS"
"_id": "7fVtKl32dGBZ7quZwkZJzn"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -1247,33 +1196,23 @@
"__id__": 23
},
"asset": {
"__uuid__": "
4a763498-db53-4a9f-9f07-4e93c757e18f
"
"__uuid__": "
5ac08756-721e-492f-893d-0bfa92750f89
"
},
"fileId": "",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "
vehicle
",
"_name": "
propWrp
",
"_objFlags": 0,
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 29
},
{
"__id__": 30
},
{
"__id__": 31
}
],
"_components": [],
"_prefab": {
"__id__":
32
"__id__":
26
},
"_opacity": 255,
"_color": {
...
...
@@ -1285,8 +1224,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
194
,
"height": 1
28
"width":
92.5
,
"height": 1
73
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -1297,8 +1236,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
248.696
,
-138.446
,
-59.75
,
178.5
,
0,
0,
0,
...
...
@@ -1320,121 +1259,102 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "f0zVXooMxB0qrLXhnc/4TX"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"_id": "a9JEDo8XtIlaERz6dwKwuL"
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "175283c1-0a28-41dd-9ca6-d0aa0aea1c1d"
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 25
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"asset": {
"__uuid__": "5ac08756-721e-492f-893d-0bfa92750f89"
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "21ZpN1nB5OaqZuUxEYaOWS"
"fileId": "",
"sync": false
},
{
"__type__": "cc.
PolygonCollider
",
"_name": "",
"__type__": "cc.
Node
",
"_name": "
propWrp
",
"_objFlags": 0,
"
node
": {
"__id__": 2
8
"
_parent
": {
"__id__": 2
2
},
"_enabled": true,
"tag": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 28
},
"points": [
{
"__type__": "cc.Vec2",
"x": -66.5,
"y": -45.9
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
{
"__type__": "cc.Vec2
",
"x": 90
,
"y": -44.7
"_contentSize":
{
"__type__": "cc.Size
",
"width": 92.5
,
"height": 173
},
{
"_anchorPoint":
{
"__type__": "cc.Vec2",
"x": 55.3
,
"y": 47.2
"x": 0.5
,
"y": 0.5
},
{
"__type__": "cc.Vec2",
"x": -83.5,
"y": 7.2
}
],
"_id": "b67snplX9Iq45Nod1lkbmP"
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
55.75,
178.5,
0,
0,
0,
0,
1,
1,
1,
1
]
},
{
"__type__": "a4cebApRXhOpYXmhf5gIeC3",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_enabled": true,
"_id": "f4UMZtFAZOZYZan+93Zfr3"
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "83/gFsuXtDdpz0KtEPIu66"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 2
8
"__id__": 2
7
},
"asset": {
"__uuid__": "
15581c31-7919-47ec-b7ca-075be4dc7af7
"
"__uuid__": "
5ac08756-721e-492f-893d-0bfa92750f89
"
},
"fileId": "",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "
wheatEar
",
"_name": "
propWrp
",
"_objFlags": 0,
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 34
},
{
"__id__": 35
},
{
"__id__": 36
}
],
"_components": [],
"_prefab": {
"__id__": 3
7
"__id__": 3
0
},
"_opacity": 255,
"_color": {
...
...
@@ -1446,7 +1366,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1
57
,
"width": 1
94
,
"height": 173
},
"_anchorPoint": {
...
...
@@ -1458,8 +1378,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-19.134
,
-92.2
5,
222
,
178.
5,
0,
0,
0,
...
...
@@ -1481,121 +1401,102 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
a6AaBFgMRAgqVyHQYgwZZJ
"
"_id": "
d4gg3bleNGhantPHqVMbNL
"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "316000b6-d447-469b-89bd-d2df2c92a600"
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 29
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"asset": {
"__uuid__": "5ac08756-721e-492f-893d-0bfa92750f89"
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "bd4VI8R/ZIy4OxOEgV8vAx"
"fileId": "",
"sync": false
},
{
"__type__": "cc.
PolygonCollider
",
"_name": "",
"__type__": "cc.
Node
",
"_name": "
propWrp
",
"_objFlags": 0,
"
node
": {
"__id__":
33
"
_parent
": {
"__id__":
22
},
"_enabled": true,
"tag": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 32
},
"points": [
{
"__type__": "cc.Vec2",
"x": -36.2,
"y": 74.9
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
{
"__type__": "cc.Vec2
",
"x": -51.5
,
"y": -30.5
"_contentSize":
{
"__type__": "cc.Size
",
"width": 194
,
"height": 173
},
{
"_anchorPoint":
{
"__type__": "cc.Vec2",
"x": -3
.5,
"y": -74.7
"x": 0
.5,
"y": 0.5
},
{
"__type__": "cc.Vec2",
"x": 35.4,
"y": -75
}
],
"_id": "6dFRsr9+dMCaNzMmuzS+PV"
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-326,
0.5,
0,
0,
0,
0,
1,
1,
1,
1
]
},
{
"__type__": "a4cebApRXhOpYXmhf5gIeC3",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_enabled": true,
"_id": "18hfPSrzxMaZwNNG5wTqAH"
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "7c/qYY5dlEZYvac8cYPphq"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 3
3
"__id__": 3
1
},
"asset": {
"__uuid__": "
31af85ff-d839-49b0-b337-f1f8adfbd454
"
"__uuid__": "
5ac08756-721e-492f-893d-0bfa92750f89
"
},
"fileId": "",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "
computer
",
"_name": "
propWrp
",
"_objFlags": 0,
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 39
},
{
"__id__": 40
},
{
"__id__": 41
}
],
"_components": [],
"_prefab": {
"__id__":
42
"__id__":
34
},
"_opacity": 255,
"_color": {
...
...
@@ -1607,8 +1508,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1
60
,
"height": 1
44
"width": 1
94
,
"height": 1
73
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -1619,8 +1520,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-
254.344
,
-121
.5,
-
109
,
0
.5,
0,
0,
0,
...
...
@@ -1642,124 +1543,173 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "47EskioZJNgaXxiLVu39pL"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 38
"_id": "e9U+jie2VDwpz44BsKQnPW"
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "bf4b837c-7380-4ccf-bcb4-7dd5f6798612"
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 33
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"asset": {
"__uuid__": "5ac08756-721e-492f-893d-0bfa92750f89"
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "8fU+xECY9LLrCeCiANS2kd"
"fileId": "",
"sync": false
},
{
"__type__": "cc.
PolygonCollider
",
"_name": "",
"__type__": "cc.
Node
",
"_name": "
propWrp
",
"_objFlags": 0,
"
node
": {
"__id__":
38
"
_parent
": {
"__id__":
22
},
"_enabled": true,
"tag": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 36
},
"points": [
{
"__type__": "cc.Vec2",
"x": -14.8,
"y": -61.3
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
{
"__type__": "cc.Vec2
",
"x": 74.7
,
"y": 7
"_contentSize":
{
"__type__": "cc.Size
",
"width": 194
,
"height": 173
},
{
"_anchorPoint":
{
"__type__": "cc.Vec2",
"x": 27.8
,
"y": 68.6
"x": 0.5
,
"y": 0.5
},
{
"__type__": "cc.Vec2",
"x": -50.8,
"y": 16.9
}
],
"_id": "e0gN8vhHZPMbP6YEBd6vhh"
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
108,
0.5,
0,
0,
0,
0,
1,
1,
1,
1
]
},
{
"__type__": "a4cebApRXhOpYXmhf5gIeC3",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 38
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_enabled": true,
"_id": "8bvyct3B5C4bTNHu6lmKep"
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "76VtxWBaxAAZvM6yDddUtu"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 3
8
"__id__": 3
5
},
"asset": {
"__uuid__": "
8c072823-2f64-4529-b9b5-facd14b6ab3d
"
"__uuid__": "
5ac08756-721e-492f-893d-0bfa92750f89
"
},
"fileId": "",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "
star
",
"_name": "
propWrp
",
"_objFlags": 0,
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 44
"_components": [
],
"_prefab":
{
"__id__": 38
},
{
"__id__": 45
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 194,
"height": 173
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
325,
0.5,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "f0DRo3VmlJ35fXrd9wD97g"
},
{
"__id__": 46
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 37
},
"asset": {
"__uuid__": "5ac08756-721e-492f-893d-0bfa92750f89"
},
"fileId": "",
"sync": false
},
{
"__id__": 47
}
],
"__type__": "cc.Node",
"_name": "propWrp",
"_objFlags": 0,
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 4
8
"__id__": 4
0
},
"_opacity": 255,
"_color": {
...
...
@@ -1771,8 +1721,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1
27
,
"height": 1
36
"width": 1
94
,
"height": 1
73
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -1783,8 +1733,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-
243.227
,
138.001
,
-
326
,
-177.5
,
0,
0,
0,
...
...
@@ -1806,116 +1756,149 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
1bgszQz7xGM7044CZJzPv1
"
"_id": "
75ZdjjWrtBArtKzttrokWq
"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 43
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b976b366-f7ae-47f1-9e5a-7128cd07872e"
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 39
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"asset": {
"__uuid__": "5ac08756-721e-492f-893d-0bfa92750f89"
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "bbSgOs3uVLnYXV44EaWtBQ"
"fileId": "",
"sync": false
},
{
"__type__": "cc.
PolygonCollider
",
"_name": "",
"__type__": "cc.
Node
",
"_name": "
propWrp
",
"_objFlags": 0,
"
node
": {
"__id__":
43
"
_parent
": {
"__id__":
22
},
"_enabled": true,
"tag": 1,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 42
},
"points": [
{
"__type__": "cc.Vec2",
"x": -36,
"y": 27.3
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
{
"__type__": "cc.Vec2
",
"x": -23.5
,
"y": -14.7
"_contentSize":
{
"__type__": "cc.Size
",
"width": 194
,
"height": 173
},
{
"_anchorPoint":
{
"__type__": "cc.Vec2",
"x": 21.2
,
"y": -1
5
"x": 0.5
,
"y": 0.
5
},
{
"__type__": "cc.Vec2",
"x": 25.5,
"y": 6.6
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-109,
-177.5,
0,
0,
0,
0,
1,
1,
1,
1
]
},
{
"__type__": "cc.Vec2",
"x": 32.5,
"y": 25.6
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
{
"__type__": "cc.Vec2",
"x": -0.2,
"y": 50.3
}
],
"_id": "34mWEBv4xPc4oe8DGw7Jx8"
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "0f85ofqKVH5qYbCtsbRJEF"
},
{
"__type__": "a4cebApRXhOpYXmhf5gIeC3",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 43
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 41
},
"_enabled": true,
"_id": "25f0ZecidJd6BgvsqsqTR9"
"asset": {
"__uuid__": "5ac08756-721e-492f-893d-0bfa92750f89"
},
"fileId": "",
"sync": false
},
{
"__type__": "cc.
Animation
",
"_name": "",
"__type__": "cc.
Node
",
"_name": "
propWrp
",
"_objFlags": 0,
"
node
": {
"__id__":
43
"
_parent
": {
"__id__":
22
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "e413b4d3-1bf8-4e31-9309-b9e191883421"
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 44
},
"_clips": [
{
"__uuid__": "e413b4d3-1bf8-4e31-9309-b9e191883421"
}
],
"playOnLoad": false,
"_id": "8aq3UFdQpPbb8aAYFE+LXG"
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 194,
"height": 173
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
108,
-177.5,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "74CQdG2IBABLgMulrye7pb"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -1923,33 +1906,23 @@
"__id__": 43
},
"asset": {
"__uuid__": "
f3c5277f-1310-41cc-9979-2912bb5d8546
"
"__uuid__": "
5ac08756-721e-492f-893d-0bfa92750f89
"
},
"fileId": "",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "
safetyHat
",
"_name": "
propWrp
",
"_objFlags": 0,
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 50
},
{
"__id__": 51
},
{
"__id__": 52
}
],
"_components": [],
"_prefab": {
"__id__":
53
"__id__":
46
},
"_opacity": 255,
"_color": {
...
...
@@ -1961,8 +1934,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1
17
,
"height": 1
02
"width": 1
94
,
"height": 1
73
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -1973,8 +1946,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
219.967
,
119.302
,
325
,
-177.5
,
0,
0,
0,
...
...
@@ -1996,98 +1969,50 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "61kE2nOgRInoXtrfniPLEH"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 49
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6bce924b-68c5-427a-bff2-1341e4393d26"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "efvEK1fDBLSaYiRNWhYZOS"
},
{
"__type__": "cc.PolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 49
},
"_enabled": true,
"tag": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"_id": "26L4g8OW1JkYSy07ss1zCc"
},
"points": [
{
"__type__": "cc.Vec2",
"x": 45.4,
"y": -42.7
},
{
"__type__": "cc.Vec2",
"x": 48.4,
"y": 18.3
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 45
},
{
"__type__": "cc.Vec2",
"x": 0.3,
"y": 50
"asset": {
"__uuid__": "5ac08756-721e-492f-893d-0bfa92750f89"
},
{
"__type__": "cc.Vec2",
"x": -53.8,
"y": 23.3
}
],
"_id": "08FLwqf2xF15vowIMYSNkb"
"fileId": "",
"sync": false
},
{
"__type__": "
a4cebApRXhOpYXmhf5gIeC3
",
"__type__": "
cc.Layout
",
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
49
"__id__":
22
},
"_enabled": true,
"_id": "2fsuE7PQFPuofSZQOfjiZD"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 49
"_layoutSize": {
"__type__": "cc.Size",
"width": 846,
"height": 530
},
"asset": {
"__uuid__": "a3f6c718-8c5a-4f33-ac29-e3c9ea001edf"
"_resize": 0,
"_N$layoutType": 3,
"_N$cellSize": {
"__type__": "cc.Size",
"width": 40,
"height": 40
},
"fileId": "",
"sync": false
"_N$startAxis": 0,
"_N$paddingLeft": 0,
"_N$paddingRight": 0,
"_N$paddingTop": 0,
"_N$paddingBottom": 0,
"_N$spacingX": 23,
"_N$spacingY": 5,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 0,
"_N$affectedByScale": false,
"_id": "e84fzlFTxGt6LJlYayjot/"
},
{
"__type__": "cc.Node",
...
...
@@ -2098,13 +2023,13 @@
},
"_children": [
{
"__id__":
55
"__id__":
49
}
],
"_active": true,
"_components": [
{
"__id__": 7
7
"__id__": 7
1
}
],
"_prefab": null,
...
...
@@ -2160,20 +2085,20 @@
"_name": "clipWrp",
"_objFlags": 0,
"_parent": {
"__id__":
54
"__id__":
48
},
"_children": [
{
"__id__": 5
6
"__id__": 5
0
},
{
"__id__": 6
7
"__id__": 6
1
}
],
"_active": true,
"_components": [
{
"__id__": 7
6
"__id__": 7
0
}
],
"_prefab": null,
...
...
@@ -2229,17 +2154,17 @@
"_name": "default",
"_objFlags": 0,
"_parent": {
"__id__":
55
"__id__":
49
},
"_children": [
{
"__id__": 5
7
"__id__": 5
1
}
],
"_active": true,
"_components": [
{
"__id__": 6
6
"__id__": 6
0
}
],
"_prefab": null,
...
...
@@ -2295,20 +2220,20 @@
"_name": "aniNode",
"_objFlags": 0,
"_parent": {
"__id__": 5
6
"__id__": 5
0
},
"_children": [
{
"__id__": 5
8
"__id__": 5
2
},
{
"__id__":
60
"__id__":
54
},
{
"__id__":
62
"__id__":
56
},
{
"__id__":
64
"__id__":
58
}
],
"_active": true,
...
...
@@ -2366,13 +2291,13 @@
"_name": "psd_186",
"_objFlags": 0,
"_parent": {
"__id__": 5
7
"__id__": 5
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 5
9
"__id__": 5
3
}
],
"_prefab": null,
...
...
@@ -2421,14 +2346,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
04lTlHCydBnrLKOAMo+cRN
"
"_id": "
3eJR6hVPpPcLNz859SOTME
"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
8
"__id__": 5
2
},
"_enabled": true,
"_materials": [
...
...
@@ -2451,20 +2376,20 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "9
eu0vrMP5JppzRzNxr4Flv
"
"_id": "9
5F1WiOu5PsJoh2JWm5bcX
"
},
{
"__type__": "cc.Node",
"_name": "psd_188",
"_objFlags": 0,
"_parent": {
"__id__": 5
7
"__id__": 5
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
61
"__id__":
55
}
],
"_prefab": null,
...
...
@@ -2513,14 +2438,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
fdk5z4sRdAWJ//GBA05F/M
"
"_id": "
7eHihDk+dKWqS5uDiN5JUJ
"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
60
"__id__":
54
},
"_enabled": true,
"_materials": [
...
...
@@ -2543,20 +2468,20 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
9eZr2uMthIxIOHOaWCMAKh
"
"_id": "
d2REWnsf9LHbic+HJfl1OK
"
},
{
"__type__": "cc.Node",
"_name": "psd_190",
"_objFlags": 0,
"_parent": {
"__id__": 5
7
"__id__": 5
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
63
"__id__":
57
}
],
"_prefab": null,
...
...
@@ -2605,14 +2530,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
78z/zfcRFNX4Rs4j2BJZVU
"
"_id": "
95k3k+oFVMYa4WHiH+mhSw
"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
62
"__id__":
56
},
"_enabled": true,
"_materials": [
...
...
@@ -2635,20 +2560,20 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
37RGQzxD5NHYUyRbJFyyf/
"
"_id": "
71whya1IRAOaTFK4TiGzQT
"
},
{
"__type__": "cc.Node",
"_name": "psd_192",
"_objFlags": 0,
"_parent": {
"__id__": 5
7
"__id__": 5
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
65
"__id__":
59
}
],
"_prefab": null,
...
...
@@ -2697,14 +2622,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
bbWDX09pFDebZgW6TrwuDC
"
"_id": "
d4L4O2OuRGXJP/lyvg3zhB
"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
64
"__id__":
58
},
"_enabled": true,
"_materials": [
...
...
@@ -2727,14 +2652,14 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
bc97r7cvFKgoSt35xxNrAN
"
"_id": "
9eeeNqEe1KJYu5TGSKOeMz
"
},
{
"__type__": "7c5ffhlHDpBpoDQ8wfKN7pu",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
6
"__id__": 5
0
},
"_enabled": true,
"_svga": {
...
...
@@ -2750,29 +2675,29 @@
"_name": "clip",
"_objFlags": 0,
"_parent": {
"__id__":
55
"__id__":
49
},
"_children": [
{
"__id__": 6
8
"__id__": 6
2
},
{
"__id__":
70
"__id__":
64
}
],
"_active": true,
"_components": [
{
"__id__":
72
"__id__":
66
},
{
"__id__":
73
"__id__":
67
},
{
"__id__":
74
"__id__":
68
},
{
"__id__":
75
"__id__":
69
}
],
"_prefab": null,
...
...
@@ -2828,13 +2753,13 @@
"_name": "con",
"_objFlags": 0,
"_parent": {
"__id__": 6
7
"__id__": 6
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
9
"__id__": 6
3
}
],
"_prefab": null,
...
...
@@ -2890,7 +2815,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
8
"__id__": 6
2
},
"_enabled": true,
"_materials": [
...
...
@@ -2920,13 +2845,13 @@
"_name": "line",
"_objFlags": 0,
"_parent": {
"__id__": 6
7
"__id__": 6
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
71
"__id__":
65
}
],
"_prefab": null,
...
...
@@ -2982,7 +2907,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
70
"__id__":
64
},
"_enabled": true,
"_materials": [
...
...
@@ -3014,7 +2939,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
7
"__id__": 6
1
},
"_enabled": true,
"_materials": [
...
...
@@ -3044,12 +2969,10 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
7
"__id__": 6
1
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "728720a9-5341-458b-8a29-451eb2e596ea"
},
"_defaultClip": null,
"_clips": [
{
"__uuid__": "4ab0d7a5-4856-4174-95a8-440505fb37c0"
...
...
@@ -3057,9 +2980,7 @@
{
"__uuid__": "7d156361-594e-49a9-b5f6-5982f013494b"
},
{
"__uuid__": "728720a9-5341-458b-8a29-451eb2e596ea"
}
null
],
"playOnLoad": true,
"_id": "986x+TFPNNRqDrqEiUJudn"
...
...
@@ -3069,7 +2990,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
7
"__id__": 6
1
},
"_enabled": true,
"_id": "55zJK3GdxMLrdN54aJ+Bmr"
...
...
@@ -3079,7 +3000,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
7
"__id__": 6
1
},
"_enabled": true,
"tag": 0,
...
...
@@ -3100,7 +3021,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
55
"__id__":
49
},
"_enabled": true,
"_defaultClip": {
...
...
@@ -3119,7 +3040,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
54
"__id__":
48
},
"_enabled": true,
"_materials": [
...
...
@@ -3145,7 +3066,7 @@
"_active": true,
"_components": [
{
"__id__": 7
9
"__id__": 7
3
}
],
"_prefab": null,
...
...
@@ -3201,7 +3122,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
8
"__id__": 7
2
},
"_enabled": true,
"_materials": [
...
...
@@ -3239,7 +3160,7 @@
"_active": true,
"_components": [
{
"__id__":
81
"__id__":
75
}
],
"_prefab": null,
...
...
@@ -3295,7 +3216,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
80
"__id__":
74
},
"_enabled": true,
"_materials": [
...
...
@@ -3332,13 +3253,13 @@
},
"_children": [
{
"__id__":
83
"__id__":
77
}
],
"_active": true,
"_components": [
{
"__id__":
85
"__id__":
79
}
],
"_prefab": null,
...
...
@@ -3394,13 +3315,13 @@
"_name": "cd",
"_objFlags": 0,
"_parent": {
"__id__":
82
"__id__":
76
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
84
"__id__":
78
}
],
"_prefab": null,
...
...
@@ -3456,7 +3377,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
83
"__id__":
77
},
"_enabled": true,
"_materials": [
...
...
@@ -3489,7 +3410,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
82
"__id__":
76
},
"_enabled": true,
"_materials": [
...
...
@@ -3525,13 +3446,13 @@
},
"_children": [
{
"__id__": 8
7
"__id__": 8
1
}
],
"_active": true,
"_components": [
{
"__id__": 8
9
"__id__": 8
3
}
],
"_prefab": null,
...
...
@@ -3587,13 +3508,13 @@
"_name": "starProc",
"_objFlags": 0,
"_parent": {
"__id__": 8
6
"__id__": 8
0
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
8
"__id__": 8
2
}
],
"_prefab": null,
...
...
@@ -3649,7 +3570,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
7
"__id__": 8
1
},
"_enabled": true,
"_materials": [
...
...
@@ -3682,7 +3603,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
6
"__id__": 8
0
},
"_enabled": true,
"_materials": [
...
...
@@ -3720,10 +3641,10 @@
"_active": true,
"_components": [
{
"__id__":
91
"__id__":
85
},
{
"__id__":
92
"__id__":
86
}
],
"_prefab": null,
...
...
@@ -3779,7 +3700,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
90
"__id__":
84
},
"_enabled": true,
"_materials": [
...
...
@@ -3811,7 +3732,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
90
"__id__":
84
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -3929,6 +3850,26 @@
"procItem": {
"__uuid__": "579f375a-1df7-440f-aded-3c14d59e021d"
},
"propItem": [
{
"__uuid__": "4a763498-db53-4a9f-9f07-4e93c757e18f"
},
{
"__uuid__": "15581c31-7919-47ec-b7ca-075be4dc7af7"
},
{
"__uuid__": "a3f6c718-8c5a-4f33-ac29-e3c9ea001edf"
},
{
"__uuid__": "8c072823-2f64-4529-b9b5-facd14b6ab3d"
},
{
"__uuid__": "31af85ff-d839-49b0-b337-f1f8adfbd454"
}
],
"bsetPropItem": {
"__uuid__": "f3c5277f-1310-41cc-9979-2912bb5d8546"
},
"_id": "5dAJmx6TZDLaYAfe+sHVw2"
}
]
\ No newline at end of file
assets/Script/Config/GameConfig.ts
View file @
52de0a2b
...
...
@@ -14,7 +14,7 @@ export const CUSTOM_EVENT = {
export
const
Config
=
{
/** 爪子能伸出去的长度 */
maxLong
:
5
44
,
maxLong
:
6
44
,
/** 摇晃速度 */
rotationSpeed
:
1
,
...
...
@@ -24,4 +24,24 @@ export const Config = {
/** 高级道具移动速度 */
bestPropSpeed
:
500
,
/** 每轮生成加分道具数量 */
bestPropsNum
:
3
,
/** 普通道具每种最多生成数量 */
propsNum
:
2
,
/** 道具分布图 4*3 */
propsMap
:
[
[
1
,
0
,
0
,
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
],
[
1
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
1
,
1
]
]
}
\ No newline at end of file
assets/Script/GameScene.ts
View file @
52de0a2b
...
...
@@ -6,7 +6,7 @@
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import
{
CUSTOM_EVENT
,
Config
,
LevelInfo
}
from
"./Config/GameConfig"
;
import
{
loadGameResources
,
numToChinese
,
set16ToRgb
}
from
"./utils"
;
import
{
getProbability
,
getRandomArrayElements
,
loadGameResources
,
numToChinese
,
randomNum
,
set16ToRgb
}
from
"./utils"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
// 爪子状态
...
...
@@ -25,6 +25,14 @@ export default class GameScene extends cc.Component {
@
property
(
cc
.
Prefab
)
procItem
:
cc
.
Prefab
=
null
/** 舞台道具 */
@
property
([
cc
.
Prefab
])
propItem
:
cc
.
Prefab
[]
=
[]
/** 加分道具 */
@
property
(
cc
.
Prefab
)
bsetPropItem
:
cc
.
Prefab
=
null
/** 当前关卡 0、1、2... */
actLevel
=
0
,
...
...
@@ -57,8 +65,11 @@ export default class GameScene extends cc.Component {
/** 抓取的目标 */
clipTarget
:
cc
.
Node
=
null
/** 场面上剩余加分道具数量 */
surplusStar
=
Config
.
bestPropsNum
protected
onLoad
():
void
{
loadGameResources
()
//
loadGameResources()
/** 开启碰撞检测 */
const
cm
=
cc
.
director
.
getCollisionManager
()
cm
.
enabled
=
true
...
...
@@ -70,12 +81,14 @@ export default class GameScene extends cc.Component {
this
.
resetConfig
()
this
.
refreshLevelInfo
()
this
.
refreshStageProps
()
this
.
addNodeEvent
()
}
/** 重置游戏设置 */
resetConfig
()
{
this
.
clipSpeed
=
Config
.
normalPropSpeed
this
.
surplusStar
=
Config
.
bestPropsNum
this
.
clip
.
getChildByName
(
'line'
).
height
=
Config
.
maxLong
const
rotationAni
=
cc
.
find
(
'clipMask/clipWrp'
,
this
.
node
)
.
getComponent
(
cc
.
Animation
)
...
...
@@ -115,7 +128,7 @@ export default class GameScene extends cc.Component {
this
.
clipState
=
state
switch
(
state
)
{
case
CLIP_STATE
.
DEFAULT
:
//
回
复旋转
//
恢
复旋转
ani
.
resume
()
// 显示默认动效
def
.
active
=
true
...
...
@@ -127,6 +140,10 @@ export default class GameScene extends cc.Component {
this
.
clipTarget
=
null
})
}
// 场面上没有剩余加分道具,刷新道具舞台
if
(
this
.
surplusStar
==
0
)
{
this
.
refreshStageProps
()
}
break
;
case
CLIP_STATE
.
PLAY
:
case
CLIP_STATE
.
STOP
:
...
...
@@ -199,6 +216,7 @@ export default class GameScene extends cc.Component {
setStarProc
()
{
const
proc
=
cc
.
find
(
'procBg/proc'
,
this
.
node
)
const
key
=
this
.
starNum
this
.
surplusStar
--
if
(
key
>=
this
.
levelObjectives
)
return
const
node
=
cc
.
instantiate
(
this
.
procItem
)
...
...
@@ -235,7 +253,65 @@ export default class GameScene extends cc.Component {
procBg
.
x
=
-
(
procBg
.
width
/
2
)
}
/** 刷新舞台道具 */
refreshStageProps
()
{
this
.
surplusStar
=
Config
.
bestPropsNum
const
gameStage
=
cc
.
find
(
'gameStage'
,
this
.
node
)
const
stageProps
:
cc
.
Node
[]
=
gameStage
.
children
const
mapIdx
=
Math
.
floor
(
randomNum
(
0
,
Config
.
propsMap
.
length
))
const
stageMap
:
number
[]
=
[...
Config
.
propsMap
[
mapIdx
]]
// 生成加分道具
for
(
let
i
=
0
;
i
<
Config
.
bestPropsNum
;
i
++
)
{
// 随机取
let
idx
=
Math
.
floor
(
randomNum
(
0
,
stageMap
.
length
))
// 找到第一个非空的位置
while
(
stageMap
[
idx
%
stageMap
.
length
]
!==
1
)
idx
++
// 放入加分道具
stageMap
[
idx
%
stageMap
.
length
]
=
2
}
// 随机道具池
let
propsRandom
=
[]
for
(
let
i
=
0
;
i
<
Config
.
propsNum
;
i
++
)
{
propsRandom
.
push
(...
this
.
propItem
)
}
// 剩余格子数量
const
emptyNum
=
stageMap
.
filter
(
_
=>
_
==
1
).
length
propsRandom
=
getRandomArrayElements
(
propsRandom
,
emptyNum
)
for
(
let
i
=
0
;
i
<
stageProps
.
length
;
i
++
)
{
const
node
=
stageProps
[
i
]
const
k
=
stageMap
[
i
]
// 随机旋转角度
const
angle
=
randomNum
(
0
,
90
).
toFixed
(
2
)
let
propNode
:
cc
.
Node
=
null
node
.
removeAllChildren
()
if
(
k
==
1
)
{
const
pre
=
cc
.
instantiate
(
propsRandom
.
pop
())
propNode
=
cc
.
instantiate
(
pre
)
}
else
if
(
k
==
2
)
{
// 加分道具
propNode
=
cc
.
instantiate
(
this
.
bsetPropItem
)
}
else
{
continue
;
}
if
(
propNode
)
{
propNode
.
angle
=
angle
>
45
?
angle
-
90
:
angle
propNode
.
setParent
(
node
)
}
}
/** 随机翻转地图 */
const
layout
=
gameStage
.
getComponent
(
cc
.
Layout
)
layout
.
horizontalDirection
=
getProbability
(
50
)
?
cc
.
Layout
.
HorizontalDirection
.
LEFT_TO_RIGHT
:
cc
.
Layout
.
HorizontalDirection
.
RIGHT_TO_LEFT
}
update
(
dt
:
number
):
void
{
if
(
this
.
isGameOver
)
return
// 锚点跟爪子之间的大致距离
const
offset
=
41
const
maxLong
=
Config
.
maxLong
-
offset
...
...
assets/Script/utils.ts
View file @
52de0a2b
...
...
@@ -37,9 +37,51 @@ export const numToChinese = (num) => {
export
const
loadGameResources
=
async
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
cc
.
resources
.
preloadDir
(
'images'
,
cc
.
SpriteFrame
,
(
err
,
res
)
=>
{
console
.
log
(
'111'
,
res
)
resolve
(
res
,
err
)
console
.
log
(
'111'
,
res
)
resolve
(
res
,
err
)
})
})
}
/**
* 获取区间随机数 [min,max)
* @export
* @param {*} min
* @param {*} max
* @return {*}
*/
export
function
randomNum
(
min
,
max
):
number
{
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
))
+
min
}
/**
* 从数组里随机取元素
* @param arr
* @param count
*/
export
function
getRandomArrayElements
(
arr
,
count
)
{
if
(
arr
.
length
<=
count
)
return
arr
;
let
shuffled
=
arr
.
slice
(
0
),
i
=
arr
.
length
,
min
=
i
-
count
,
temp
,
index
;
while
(
i
--
>
min
)
{
index
=
(
i
+
1
)
*
Math
.
random
()
>>
0
;
temp
=
shuffled
[
index
];
shuffled
[
index
]
=
shuffled
[
i
];
shuffled
[
i
]
=
temp
;
}
return
shuffled
.
slice
(
min
);
}
/**
* 获取概率
* @param pro 1-100
*/
export
function
getProbability
(
pro
)
{
const
randomAry
=
[
...
Array
(
100
-
pro
).
fill
(
false
),
...
Array
(
pro
).
fill
(
true
)
]
const
num
=
Math
.
floor
(
randomNum
(
0
,
99
))
return
randomAry
[
num
]
}
assets/resources/ani/clipRation.anim
View file @
52de0a2b
...
...
@@ -16,11 +16,11 @@
},
{
"frame": 1,
"value":
4
0
"value":
5
0
},
{
"frame": 3,
"value": -
4
0
"value": -
5
0
},
{
"frame": 3.966666666666667,
...
...
assets/resources/props/computer.prefab
View file @
52de0a2b
...
...
@@ -54,8 +54,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-254.344
,
-121.5
,
0
,
0
,
0,
0,
0,
...
...
@@ -63,7 +63,7 @@
1,
1,
1,
1
1
.2125
]
},
"_eulerAngles": {
...
...
assets/resources/props/propWrp.prefab
0 → 100644
View file @
52de0a2b
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "propWrp",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 2
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 194,
"height": 173
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
assets/resources/props/propWrp.prefab.meta
0 → 100644
View file @
52de0a2b
{
"ver": "1.3.2",
"uuid": "5ac08756-721e-492f-893d-0bfa92750f89",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
assets/resources/props/safetyHat.prefab
View file @
52de0a2b
...
...
@@ -54,8 +54,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
219.967
,
119.302
,
0
,
0
,
0,
0,
0,
...
...
assets/resources/props/star.prefab
View file @
52de0a2b
...
...
@@ -57,8 +57,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-243.227
,
138.001
,
0
,
0
,
0,
0,
0,
...
...
assets/resources/props/tool.prefab
View file @
52de0a2b
...
...
@@ -54,8 +54,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-10.36
,
134.681
,
0
,
0
,
0,
0,
0,
...
...
assets/resources/props/vehicle.prefab
View file @
52de0a2b
...
...
@@ -54,8 +54,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
248.696
,
-138.446
,
0
,
0
,
0,
0,
0,
...
...
assets/resources/props/wheatEar.prefab
View file @
52de0a2b
...
...
@@ -54,8 +54,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-19.134
,
-92.25
,
0
,
0
,
0,
0,
0,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment