feat: 支持游戏数值

This commit is contained in:
richarjiang
2025-09-22 17:34:28 +08:00
parent 954acfb725
commit 98742745eb
21 changed files with 1807 additions and 202 deletions

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "66458d1d-470f-4340-a5e8-25159090f854",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "112e8ffc-e1ef-4b1f-b7b8-f9392dcdb3fa",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "112e8ffc-e1ef-4b1f-b7b8-f9392dcdb3fa@6c48a",
"displayName": "10000",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "112e8ffc-e1ef-4b1f-b7b8-f9392dcdb3fa",
"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": "112e8ffc-e1ef-4b1f-b7b8-f9392dcdb3fa@f9941",
"displayName": "10000",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 7.5,
"offsetY": -4.5,
"trimX": 122,
"trimY": 73,
"width": 91,
"height": 103,
"rawWidth": 320,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-45.5,
-51.5,
0,
45.5,
-51.5,
0,
-45.5,
51.5,
0,
45.5,
51.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
122,
167,
213,
167,
122,
64,
213,
64
],
"nuv": [
0.38125,
0.26666666666666666,
0.665625,
0.26666666666666666,
0.38125,
0.6958333333333333,
0.665625,
0.6958333333333333
],
"minPos": [
-45.5,
-51.5,
0
],
"maxPos": [
45.5,
51.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "112e8ffc-e1ef-4b1f-b7b8-f9392dcdb3fa@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "112e8ffc-e1ef-4b1f-b7b8-f9392dcdb3fa@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "645e0930-b379-4fc7-aa4d-4695ca19ca3e",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "645e0930-b379-4fc7-aa4d-4695ca19ca3e@6c48a",
"displayName": "10001",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "645e0930-b379-4fc7-aa4d-4695ca19ca3e",
"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": "645e0930-b379-4fc7-aa4d-4695ca19ca3e@f9941",
"displayName": "10001",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 2,
"offsetY": -16.5,
"trimX": 117,
"trimY": 72,
"width": 90,
"height": 129,
"rawWidth": 320,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-45,
-64.5,
0,
45,
-64.5,
0,
-45,
64.5,
0,
45,
64.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
117,
168,
207,
168,
117,
39,
207,
39
],
"nuv": [
0.365625,
0.1625,
0.646875,
0.1625,
0.365625,
0.7,
0.646875,
0.7
],
"minPos": [
-45,
-64.5,
0
],
"maxPos": [
45,
64.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "645e0930-b379-4fc7-aa4d-4695ca19ca3e@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "645e0930-b379-4fc7-aa4d-4695ca19ca3e@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "58b65db2-723b-466e-bc42-8fe12dbd8662",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "58b65db2-723b-466e-bc42-8fe12dbd8662@6c48a",
"displayName": "10002",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "58b65db2-723b-466e-bc42-8fe12dbd8662",
"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": "58b65db2-723b-466e-bc42-8fe12dbd8662@f9941",
"displayName": "10002",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 4,
"offsetY": -25,
"trimX": 118,
"trimY": 86,
"width": 92,
"height": 118,
"rawWidth": 320,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-46,
-59,
0,
46,
-59,
0,
-46,
59,
0,
46,
59,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
118,
154,
210,
154,
118,
36,
210,
36
],
"nuv": [
0.36875,
0.15,
0.65625,
0.15,
0.36875,
0.6416666666666667,
0.65625,
0.6416666666666667
],
"minPos": [
-46,
-59,
0
],
"maxPos": [
46,
59,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "58b65db2-723b-466e-bc42-8fe12dbd8662@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "58b65db2-723b-466e-bc42-8fe12dbd8662@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "7c94451d-39f3-4f5b-9b99-49e2eb8b50a3",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "7c94451d-39f3-4f5b-9b99-49e2eb8b50a3@6c48a",
"displayName": "10003",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "7c94451d-39f3-4f5b-9b99-49e2eb8b50a3",
"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": "7c94451d-39f3-4f5b-9b99-49e2eb8b50a3@f9941",
"displayName": "10003",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 11,
"offsetY": -31.5,
"trimX": 119,
"trimY": 96,
"width": 104,
"height": 111,
"rawWidth": 320,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-52,
-55.5,
0,
52,
-55.5,
0,
-52,
55.5,
0,
52,
55.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
119,
144,
223,
144,
119,
33,
223,
33
],
"nuv": [
0.371875,
0.1375,
0.696875,
0.1375,
0.371875,
0.6,
0.696875,
0.6
],
"minPos": [
-52,
-55.5,
0
],
"maxPos": [
52,
55.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "7c94451d-39f3-4f5b-9b99-49e2eb8b50a3@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "7c94451d-39f3-4f5b-9b99-49e2eb8b50a3@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "8699ce65-c42b-42a9-b0bf-44ec5b7ba800",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "8699ce65-c42b-42a9-b0bf-44ec5b7ba800@6c48a",
"displayName": "10004",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "8699ce65-c42b-42a9-b0bf-44ec5b7ba800",
"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": "8699ce65-c42b-42a9-b0bf-44ec5b7ba800@f9941",
"displayName": "10004",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 17.5,
"offsetY": -43,
"trimX": 120,
"trimY": 111,
"width": 115,
"height": 104,
"rawWidth": 320,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-57.5,
-52,
0,
57.5,
-52,
0,
-57.5,
52,
0,
57.5,
52,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
120,
129,
235,
129,
120,
25,
235,
25
],
"nuv": [
0.375,
0.10416666666666667,
0.734375,
0.10416666666666667,
0.375,
0.5375,
0.734375,
0.5375
],
"minPos": [
-57.5,
-52,
0
],
"maxPos": [
57.5,
52,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "8699ce65-c42b-42a9-b0bf-44ec5b7ba800@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "8699ce65-c42b-42a9-b0bf-44ec5b7ba800@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "468705a1-c63a-45bb-adc0-7e3b0660495d",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "468705a1-c63a-45bb-adc0-7e3b0660495d@6c48a",
"displayName": "10005",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "468705a1-c63a-45bb-adc0-7e3b0660495d",
"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": "468705a1-c63a-45bb-adc0-7e3b0660495d@f9941",
"displayName": "10005",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 24,
"offsetY": -60,
"trimX": 119,
"trimY": 132,
"width": 130,
"height": 96,
"rawWidth": 320,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-65,
-48,
0,
65,
-48,
0,
-65,
48,
0,
65,
48,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
119,
108,
249,
108,
119,
12,
249,
12
],
"nuv": [
0.371875,
0.05,
0.778125,
0.05,
0.371875,
0.45,
0.778125,
0.45
],
"minPos": [
-65,
-48,
0
],
"maxPos": [
65,
48,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "468705a1-c63a-45bb-adc0-7e3b0660495d@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "468705a1-c63a-45bb-adc0-7e3b0660495d@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "8daa56f1-3ee7-41fb-921e-c970212c5f0e",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "8daa56f1-3ee7-41fb-921e-c970212c5f0e@6c48a",
"displayName": "10006",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "8daa56f1-3ee7-41fb-921e-c970212c5f0e",
"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": "8daa56f1-3ee7-41fb-921e-c970212c5f0e@f9941",
"displayName": "10006",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 26.5,
"offsetY": -65.5,
"trimX": 120,
"trimY": 149,
"width": 133,
"height": 73,
"rawWidth": 320,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-66.5,
-36.5,
0,
66.5,
-36.5,
0,
-66.5,
36.5,
0,
66.5,
36.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
120,
91,
253,
91,
120,
18,
253,
18
],
"nuv": [
0.375,
0.075,
0.790625,
0.075,
0.375,
0.37916666666666665,
0.790625,
0.37916666666666665
],
"minPos": [
-66.5,
-36.5,
0
],
"maxPos": [
66.5,
36.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "8daa56f1-3ee7-41fb-921e-c970212c5f0e@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "8daa56f1-3ee7-41fb-921e-c970212c5f0e@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "0a11f299-5e84-4e17-93de-90fb904c0b7c",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "0a11f299-5e84-4e17-93de-90fb904c0b7c@6c48a",
"displayName": "10007",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "0a11f299-5e84-4e17-93de-90fb904c0b7c",
"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": "0a11f299-5e84-4e17-93de-90fb904c0b7c@f9941",
"displayName": "10007",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 29.5,
"offsetY": -75,
"trimX": 120,
"trimY": 156,
"width": 139,
"height": 78,
"rawWidth": 320,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-69.5,
-39,
0,
69.5,
-39,
0,
-69.5,
39,
0,
69.5,
39,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
120,
84,
259,
84,
120,
6,
259,
6
],
"nuv": [
0.375,
0.025,
0.809375,
0.025,
0.375,
0.35,
0.809375,
0.35
],
"minPos": [
-69.5,
-39,
0
],
"maxPos": [
69.5,
39,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "0a11f299-5e84-4e17-93de-90fb904c0b7c@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "0a11f299-5e84-4e17-93de-90fb904c0b7c@6c48a"
}
}

View File

@@ -0,0 +1,113 @@
[
{
"__type__": "cc.AnimationClip",
"_name": "guai_1_die",
"_objFlags": 0,
"__editorExtras__": {
"embeddedPlayerGroups": []
},
"_native": "",
"sample": 60,
"speed": 1,
"wrapMode": 1,
"enableTrsBlending": false,
"_duration": 0.6,
"_hash": 500763545,
"_tracks": [
{
"__id__": 1
}
],
"_exoticAnimation": null,
"_events": [],
"_embeddedPlayers": [],
"_additiveSettings": {
"__id__": 6
},
"_auxiliaryCurveEntries": []
},
{
"__type__": "cc.animation.ObjectTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 2
},
"proxy": null
},
"_channel": {
"__id__": 4
}
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
{
"__id__": 3
},
"spriteFrame"
]
},
{
"__type__": "cc.animation.ComponentPath",
"component": "cc.Sprite"
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 5
}
},
{
"__type__": "cc.ObjectCurve",
"_times": [
0,
0.08333333333333333,
0.16666666666666666,
0.25,
0.3333333333333333,
0.4166666666666667,
0.5,
0.5833333333333334
],
"_values": [
{
"__uuid__": "112e8ffc-e1ef-4b1f-b7b8-f9392dcdb3fa@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "645e0930-b379-4fc7-aa4d-4695ca19ca3e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "58b65db2-723b-466e-bc42-8fe12dbd8662@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "7c94451d-39f3-4f5b-9b99-49e2eb8b50a3@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "8699ce65-c42b-42a9-b0bf-44ec5b7ba800@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "468705a1-c63a-45bb-adc0-7e3b0660495d@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "8daa56f1-3ee7-41fb-921e-c970212c5f0e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "0a11f299-5e84-4e17-93de-90fb904c0b7c@f9941",
"__expectedType__": "cc.SpriteFrame"
}
]
},
{
"__type__": "cc.AnimationClipAdditiveSettings",
"enabled": false,
"refClip": null
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "2.0.4",
"importer": "animation-clip",
"imported": true,
"uuid": "538a5504-bbb5-41a3-b7f8-b1b7041f7aac",
"files": [
".bin"
],
"subMetas": {},
"userData": {
"name": "guai_1_die"
}
}

View File

@@ -52,7 +52,7 @@
}, },
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 40 "__id__": 46
}, },
"_id": "58132e64-0171-4c7f-89be-a2984ca7de6b" "_id": "58132e64-0171-4c7f-89be-a2984ca7de6b"
}, },
@@ -69,10 +69,7 @@
"__id__": 3 "__id__": 3
}, },
{ {
"__id__": 12 "__id__": 15
},
{
"__id__": 22
}, },
{ {
"__id__": 25 "__id__": 25
@@ -83,6 +80,9 @@
{ {
"__id__": 31 "__id__": 31
}, },
{
"__id__": 34
},
{ {
"__id__": 6 "__id__": 6
} }
@@ -90,13 +90,13 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 37 "__id__": 43
}, },
{ {
"__id__": 38 "__id__": 44
}, },
{ {
"__id__": 39 "__id__": 45
} }
], ],
"_prefab": null, "_prefab": null,
@@ -256,23 +256,27 @@
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [
"_active": true,
"_components": [
{ {
"__id__": 7 "__id__": 7
}, }
{ ],
"__id__": 8 "_active": true,
}, "_components": [
{
"__id__": 9
},
{ {
"__id__": 10 "__id__": 10
}, },
{ {
"__id__": 11 "__id__": 11
},
{
"__id__": 12
},
{
"__id__": 13
},
{
"__id__": 14
} }
], ],
"_prefab": null, "_prefab": null,
@@ -305,6 +309,138 @@
}, },
"_id": "427Eu3altLCY5IWwO2+tVy" "_id": "427Eu3altLCY5IWwO2+tVy"
}, },
{
"__type__": "cc.Node",
"_name": "hp",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 6
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 74.024,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "ecC3GKT8RKJp+BT/ZByClA"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 37.369140625,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "963ckrHtRFxaNm7lV3WGay"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 104,
"b": 104,
"a": 255
},
"_string": "200",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_enableOutline": true,
"_outlineColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": "52qK+uInlOo79+KVljGtC7"
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -471,22 +607,22 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 13 "__id__": 16
}, },
{ {
"__id__": 16 "__id__": 19
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 19 "__id__": 22
}, },
{ {
"__id__": 20 "__id__": 23
}, },
{ {
"__id__": 21 "__id__": 24
} }
], ],
"_prefab": null, "_prefab": null,
@@ -525,116 +661,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 12 "__id__": 15
},
"_children": [],
"_active": true,
"_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
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "dcjO1Ab2tDIbg6VVr9YHdO"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 13
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 2560
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "8aW0b4lGxCVbal8zQBKbyB"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 13
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "361c5873-d797-420e-be65-81c5a8f91215@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": "37daNZffxGSq/F3WV+F0Y5"
},
{
"__type__": "cc.Node",
"_name": "WalkableLayer",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 12
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
@@ -674,7 +701,7 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "23cuMKDVtPs71LOAe7QMgZ" "_id": "dcjO1Ab2tDIbg6VVr9YHdO"
}, },
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
@@ -686,6 +713,115 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 2560
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "8aW0b4lGxCVbal8zQBKbyB"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 16
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "361c5873-d797-420e-be65-81c5a8f91215@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": "37daNZffxGSq/F3WV+F0Y5"
},
{
"__type__": "cc.Node",
"_name": "WalkableLayer",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 15
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 20
},
{
"__id__": 21
}
],
"_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
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "23cuMKDVtPs71LOAe7QMgZ"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 19
},
"_enabled": true,
"__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1056, "width": 1056,
@@ -704,7 +840,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 16 "__id__": 19
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -726,7 +862,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 12 "__id__": 15
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -748,7 +884,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 12 "__id__": 15
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -766,12 +902,12 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 12 "__id__": 15
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"tiledMap": { "tiledMap": {
"__id__": 20 "__id__": 23
}, },
"walkableLayerName": "WalkableLayer", "walkableLayerName": "WalkableLayer",
"tileSize": 32, "tileSize": 32,
@@ -789,10 +925,10 @@
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 23 "__id__": 26
}, },
{ {
"__id__": 24 "__id__": 27
} }
], ],
"_prefab": null, "_prefab": null,
@@ -831,7 +967,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 22 "__id__": 25
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -853,7 +989,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 22 "__id__": 25
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -898,10 +1034,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 26 "__id__": 29
}, },
{ {
"__id__": 27 "__id__": 30
} }
], ],
"_prefab": null, "_prefab": null,
@@ -940,7 +1076,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 25 "__id__": 28
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -962,7 +1098,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 25 "__id__": 28
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -973,7 +1109,7 @@
"__id__": 4 "__id__": 4
}, },
"pathfinder": { "pathfinder": {
"__id__": 21 "__id__": 24
}, },
"moveSpeed": 300, "moveSpeed": 300,
"mapWidth": 1080, "mapWidth": 1080,
@@ -992,10 +1128,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 29 "__id__": 32
}, },
{ {
"__id__": 30 "__id__": 33
} }
], ],
"_prefab": null, "_prefab": null,
@@ -1034,7 +1170,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 28 "__id__": 31
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -1056,12 +1192,12 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 28 "__id__": 31
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"tiledMap": { "tiledMap": {
"__id__": 20 "__id__": 23
}, },
"playerNode": { "playerNode": {
"__id__": 6 "__id__": 6
@@ -1076,23 +1212,27 @@
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [
{
"__id__": 35
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 32 "__id__": 38
}, },
{ {
"__id__": 33 "__id__": 39
}, },
{ {
"__id__": 34 "__id__": 40
}, },
{ {
"__id__": 35 "__id__": 41
}, },
{ {
"__id__": 36 "__id__": 42
} }
], ],
"_prefab": null, "_prefab": null,
@@ -1125,13 +1265,145 @@
}, },
"_id": "64hUbaFA1A0bML+FS/Y6vp" "_id": "64hUbaFA1A0bML+FS/Y6vp"
}, },
{
"__type__": "cc.Node",
"_name": "hp",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 34
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 36
},
{
"__id__": 37
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 74.024,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "b1vbMsx55Du5MRaM373Ng4"
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 31 "__id__": 35
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 37.369140625,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "321yIgVlFOb7Zz0gOVC7g1"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 35
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 104,
"b": 104,
"a": 255
},
"_string": "200",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_enableOutline": true,
"_outlineColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": "0dKht50epO0odvIcizJhWR"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 34
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -1153,7 +1425,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 31 "__id__": 34
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -1192,7 +1464,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 31 "__id__": 34
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -1205,6 +1477,10 @@
{ {
"__uuid__": "88fe4ee4-900d-44af-a405-32ff388218da", "__uuid__": "88fe4ee4-900d-44af-a405-32ff388218da",
"__expectedType__": "cc.AnimationClip" "__expectedType__": "cc.AnimationClip"
},
{
"__uuid__": "538a5504-bbb5-41a3-b7f8-b1b7041f7aac",
"__expectedType__": "cc.AnimationClip"
} }
], ],
"_defaultClip": { "_defaultClip": {
@@ -1219,7 +1495,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 31 "__id__": 34
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -1247,7 +1523,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 31 "__id__": 34
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -1340,29 +1616,29 @@
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.SceneGlobals",
"ambient": { "ambient": {
"__id__": 41
},
"shadows": {
"__id__": 42
},
"_skybox": {
"__id__": 43
},
"fog": {
"__id__": 44
},
"octree": {
"__id__": 45
},
"skin": {
"__id__": 46
},
"lightProbeInfo": {
"__id__": 47 "__id__": 47
}, },
"postSettings": { "shadows": {
"__id__": 48 "__id__": 48
}, },
"_skybox": {
"__id__": 49
},
"fog": {
"__id__": 50
},
"octree": {
"__id__": 51
},
"skin": {
"__id__": 52
},
"lightProbeInfo": {
"__id__": 53
},
"postSettings": {
"__id__": 54
},
"bakedWithStationaryMainLight": false, "bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false "bakedWithHighpLightmap": false
}, },

View File

@@ -1,4 +1,4 @@
import { _decorator, Component, Node, Vec3, input, Input, EventTouch, Camera, view, tween, Animation, Collider2D, Contact2DType } from 'cc'; import { _decorator, Component, Node, Vec3, input, Input, EventTouch, Camera, view, tween, Animation, Collider2D, Contact2DType, Label, Color } from 'cc';
import { TiledMapPathfinder } from './TiledMapPathfinder'; import { TiledMapPathfinder } from './TiledMapPathfinder';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -276,24 +276,146 @@ export class PlayerController extends Component {
onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D) { onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D) {
if (otherCollider.node.name.startsWith('guai_')) { if (otherCollider.node.name.startsWith('guai_')) {
this.isAttacking = true; this.handleAttack(otherCollider);
// 怪物攻击
const animation = otherCollider.node.getComponent(Animation);
if (animation) {
animation.play(`${otherCollider.node.name}_attack`);
}
// player 攻击
this.switchAnimation('attack');
this.scheduleOnce(() => {
animation.play(`${otherCollider.node.name}_stand`);
this.isAttacking = false;
this.switchAnimation('die');
}, 3);
} }
} }
/**
* 处理攻击逻辑
*/
private handleAttack(otherCollider: Collider2D) {
this.isAttacking = true;
console.log('开始攻击,怪物名称:', otherCollider.node.name);
// 获取玩家和怪物的生命值
const playerHpLabel = this.player.getChildByName('hp');
const monsterHpLabel = otherCollider.node.getChildByName('hp');
if (!playerHpLabel || !monsterHpLabel) {
console.warn('未找到生命值标签玩家hp:', playerHpLabel, '怪物hp:', monsterHpLabel);
this.isAttacking = false;
return;
}
// 获取生命值数值
const playerLabel = playerHpLabel.getComponent(Label);
const monsterLabel = monsterHpLabel.getComponent(Label);
if (!playerLabel || !monsterLabel) {
console.warn('未找到Label组件');
this.isAttacking = false;
return;
}
const playerHp = parseInt(playerLabel.string) || 0;
const monsterHp = parseInt(monsterLabel.string) || 0;
console.log('玩家生命值:', playerHp, '怪物生命值:', monsterHp);
// 播放攻击动画
const monsterAnimation = otherCollider.node.getComponent(Animation);
if (monsterAnimation) {
monsterAnimation.play(`${otherCollider.node.name}_attack`);
}
this.switchAnimation('attack');
// 2秒后判定攻击结果
this.scheduleOnce(() => {
// 比较生命值,判断输赢
console.log('判定攻击结果玩家HP:', playerHp, '怪物HP:', monsterHp);
if (playerHp >= monsterHp) {
// 玩家获胜
console.log('玩家获胜!更新玩家生命值为:', playerHp + monsterHp);
// 玩家生命值增加怪物生命值
const newPlayerHp = playerHp + monsterHp;
playerLabel.string = newPlayerHp.toString();
// 播放生命值标签的强调动画
this.playLabelEmphasisAnimation(playerLabel);
// 播放怪物死亡动画
if (monsterAnimation) {
monsterAnimation.play(`${otherCollider.node.name}_die`);
}
// 1秒后怪物消失
this.scheduleOnce(() => {
otherCollider.node.destroy();
console.log('怪物已消失');
}, 1);
this.switchAnimation('stand'); // 玩家站立
} else {
// 怪物获胜
console.log('怪物获胜玩家生命值变为0');
// 玩家生命值变为0
playerLabel.string = '0';
// 播放生命值标签的失败动画
this.playLabelFailAnimation(playerLabel);
// 玩家死亡动画
this.switchAnimation('die');
// 怪物站立动画
if (monsterAnimation) {
monsterAnimation.play(`${otherCollider.node.name}_stand`);
}
}
this.isAttacking = false;
}, 2);
}
/**
* 播放生命值标签强调动画(成功时)
*/
private playLabelEmphasisAnimation(label: Label) {
if (!label) return;
const originalScale = label.node.scale.clone();
const originalColor = label.color.clone();
// 创建强调动画序列
tween(label.node)
.to(0.1, { scale: new Vec3(originalScale.x * 1.2, originalScale.y * 1.2, originalScale.z) })
.to(0.1, { scale: originalScale })
.to(0.1, { scale: new Vec3(originalScale.x * 1.1, originalScale.y * 1.1, originalScale.z) })
.to(0.1, { scale: originalScale })
.start();
// 颜色闪烁效果
tween(label)
.to(0.1, { color: new Color(255, 255, 0) }) // 黄色
.to(0.1, { color: new Color(0, 255, 0) }) // 绿色
.to(0.1, { color: originalColor })
.start();
}
/**
* 播放生命值标签失败动画(失败时)
*/
private playLabelFailAnimation(label: Label) {
if (!label) return;
const originalScale = label.node.scale.clone();
const originalColor = label.color.clone();
// 创建失败动画序列 - 震动效果
tween(label.node)
.to(0.05, { position: new Vec3(label.node.position.x - 5, label.node.position.y, label.node.position.z) })
.to(0.05, { position: new Vec3(label.node.position.x + 5, label.node.position.y, label.node.position.z) })
.to(0.05, { position: new Vec3(label.node.position.x - 5, label.node.position.y, label.node.position.z) })
.to(0.05, { position: new Vec3(label.node.position.x + 5, label.node.position.y, label.node.position.z) })
.to(0.05, { position: label.node.position })
.start();
// 颜色变红效果
tween(label)
.to(0.1, { color: new Color(255, 0, 0) }) // 红色
.to(0.1, { color: new Color(128, 0, 0) }) // 暗红色
.to(0.1, { color: originalColor })
.start();
}
} }