This commit is contained in:
2024-08-02 17:06:21 +08:00
parent 52cefb71b4
commit d5f2f65ee6
22 changed files with 920 additions and 75 deletions

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "88530240-b39e-452d-a175-83788b17c457",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,168 @@
[
{
"__type__": "cc.Prefab",
"_name": "light",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "light",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 4
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 8
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -301,
"y": -29,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": -0.7071067811865475,
"w": 0.7071067811865476
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.2,
"y": 0.1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -90
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 3
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f1FKXQuxFG0qNHxJY4OshW"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 5
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": {
"__uuid__": "a0c246fb-9509-40ae-a15e-b218606c8fc1",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "animation",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": 0,
"_cacheMode": 0,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "ffw6922tZJL4fSyvYt5MUd"
},
{
"__type__": "fc96045RcBBv4/4BKSsygw4",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f3c1oOkgBLsrgeRmk/LzGa"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "68CxWmrulFd5djF04hIqc+",
"instance": null,
"targetOverrides": null
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "683fa094-5032-4f8d-a8c6-63a962c9bdd5",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "light"
}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "*",
"imported": true,
"uuid": "54a5d974-d9c0-4086-8da0-d06546dc7355",
"files": [
".atlas",
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,11 @@
{
"ver": "1.2.6",
"importer": "spine-data",
"imported": true,
"uuid": "a0c246fb-9509-40ae-a15e-b218606c8fc1",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,42 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "fa07cc8f-039b-40c5-b437-4195c88cd342",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "fa07cc8f-039b-40c5-b437-4195c88cd342@6c48a",
"displayName": "ui_readgo",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "fa07cc8f-039b-40c5-b437-4195c88cd342",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "texture",
"fixAlphaTransparencyArtifacts": false,
"redirect": "fa07cc8f-039b-40c5-b437-4195c88cd342@6c48a"
}
}

View File

@@ -28,17 +28,17 @@
"_active": true,
"_components": [
{
"__id__": 70
"__id__": 88
},
{
"__id__": 72
"__id__": 90
},
{
"__id__": 74
"__id__": 92
}
],
"_prefab": {
"__id__": 76
"__id__": 94
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -197,17 +197,17 @@
"_active": true,
"_components": [
{
"__id__": 63
"__id__": 81
},
{
"__id__": 65
"__id__": 83
},
{
"__id__": 67
"__id__": 85
}
],
"_prefab": {
"__id__": 69
"__id__": 87
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -251,20 +251,23 @@
"__id__": 8
},
{
"__id__": 42
"__id__": 54
},
{
"__id__": 54
"__id__": 66
},
{
"__id__": 72
}
],
"_active": true,
"_components": [
{
"__id__": 60
"__id__": 78
}
],
"_prefab": {
"__id__": 62
"__id__": 80
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -311,14 +314,14 @@
"_active": true,
"_components": [
{
"__id__": 37
"__id__": 49
},
{
"__id__": 39
"__id__": 51
}
],
"_prefab": {
"__id__": 41
"__id__": 53
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -366,19 +369,25 @@
},
{
"__id__": 22
},
{
"__id__": 32
},
{
"__id__": 38
}
],
"_active": true,
"_components": [
{
"__id__": 32
"__id__": 44
},
{
"__id__": 34
"__id__": 46
}
],
"_prefab": {
"__id__": 36
"__id__": 48
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -865,12 +874,12 @@
"_offset": {
"__type__": "cc.Vec2",
"x": -1.1,
"y": -27.5
"y": -23.3
},
"_size": {
"__type__": "cc.Size",
"width": 1177.9,
"height": 830
"height": 838.2
},
"_id": ""
},
@@ -891,6 +900,278 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "hero_start",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 9
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 33
},
{
"__id__": 35
}
],
"_prefab": {
"__id__": 37
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -302.335,
"y": -98.022,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.6,
"y": 0.6,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 32
},
"_enabled": true,
"__prefab": {
"__id__": 34
},
"_contentSize": {
"__type__": "cc.Size",
"width": 213.7100067138672,
"height": 50.540000915527344
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.49997658096179276,
"y": 0.49525129072476076
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "bfDLB5FjJGoZeRJ+6ZnDRw"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 32
},
"_enabled": true,
"__prefab": {
"__id__": 36
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": {
"__uuid__": "790a7841-0c16-430a-aae3-54b392e8e255",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "move",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": 0,
"_cacheMode": 0,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "23lmIVbnxOQZ/D2L0zYMqM"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "deV2rRAxJBQr4J43Ifwca1",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "monster_start",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 9
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 39
},
{
"__id__": 41
}
],
"_prefab": {
"__id__": 43
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 299.971,
"y": -98.022,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.6,
"y": 0.6,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 38
},
"_enabled": true,
"__prefab": {
"__id__": 40
},
"_contentSize": {
"__type__": "cc.Size",
"width": 213.7100067138672,
"height": 50.540000915527344
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.49997658096179276,
"y": 0.49525129072476076
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a1BEvYEjVJKJXkGH1HdpGC"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 38
},
"_enabled": true,
"__prefab": {
"__id__": 42
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": {
"__uuid__": "790a7841-0c16-430a-aae3-54b392e8e255",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "move",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": 0,
"_cacheMode": 0,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a3HdE6I0NFBZJ/fpTSZMBi"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "5bWjNWeZBEUZ+bAtAkRvmm",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -901,7 +1182,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 33
"__id__": 45
},
"_contentSize": {
"__type__": "cc.Size",
@@ -929,7 +1210,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 35
"__id__": 47
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -987,7 +1268,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 38
"__id__": 50
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1015,10 +1296,10 @@
},
"_enabled": true,
"__prefab": {
"__id__": 40
"__id__": 52
},
"bgImg": {
"__id__": 34
"__id__": 46
},
"_id": ""
},
@@ -1049,17 +1330,17 @@
},
"_children": [
{
"__id__": 43
"__id__": 55
}
],
"_active": true,
"_components": [
{
"__id__": 51
"__id__": 63
}
],
"_prefab": {
"__id__": 53
"__id__": 65
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -1096,28 +1377,28 @@
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 42
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 44
"__id__": 56
},
{
"__id__": 46
"__id__": 58
},
{
"__id__": 48
"__id__": 60
}
],
"_prefab": {
"__id__": 50
"__id__": 62
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -186.807,
"y": -525.104,
"x": -191.8,
"y": 568.433,
"z": 0
},
"_lrot": {
@@ -1149,11 +1430,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 43
"__id__": 55
},
"_enabled": true,
"__prefab": {
"__id__": 45
"__id__": 57
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1177,11 +1458,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 43
"__id__": 55
},
"_enabled": true,
"__prefab": {
"__id__": 47
"__id__": 59
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -1245,11 +1526,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 43
"__id__": 55
},
"_enabled": true,
"__prefab": {
"__id__": 49
"__id__": 61
},
"templateMode": false,
"watchPath": "data.name",
@@ -1280,11 +1561,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 42
"__id__": 54
},
"_enabled": true,
"__prefab": {
"__id__": 52
"__id__": 64
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1327,14 +1608,14 @@
"_active": true,
"_components": [
{
"__id__": 55
"__id__": 67
},
{
"__id__": 57
"__id__": 69
}
],
"_prefab": {
"__id__": 59
"__id__": 71
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -1371,11 +1652,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 54
"__id__": 66
},
"_enabled": true,
"__prefab": {
"__id__": 56
"__id__": 68
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1399,11 +1680,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 54
"__id__": 66
},
"_enabled": true,
"__prefab": {
"__id__": 58
"__id__": 70
},
"_id": ""
},
@@ -1424,6 +1705,119 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "SkillLayer",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 73
},
{
"__id__": 75
}
],
"_prefab": {
"__id__": 77
},
"_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": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 72
},
"_enabled": true,
"__prefab": {
"__id__": 74
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "afIbjfU+lIia+oW2KuDLIw"
},
{
"__type__": "7852atKEgtMk512m0jDglmf",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 72
},
"_enabled": true,
"__prefab": {
"__id__": 76
},
"light": {
"__uuid__": "683fa094-5032-4f8d-a8c6-63a962c9bdd5",
"__expectedType__": "cc.Prefab"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "90iY8Wt31JQZ1WhSvASP55"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "35iAcUUYpE8akTtTCX1ITo",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -1434,7 +1828,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 61
"__id__": 79
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1475,7 +1869,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 64
"__id__": 82
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1503,7 +1897,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 66
"__id__": 84
},
"camera": {
"__id__": 3
@@ -1512,13 +1906,13 @@
"__id__": 7
},
"mapLayer": {
"__id__": 39
"__id__": 51
},
"floorLayer": {
"__id__": 42
"__id__": 54
},
"entityLayer": {
"__id__": 57
"__id__": 69
},
"isFollowPlayer": true,
"_id": ""
@@ -1537,7 +1931,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 68
"__id__": 86
},
"_id": ""
},
@@ -1568,7 +1962,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 71
"__id__": 89
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1596,7 +1990,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 73
"__id__": 91
},
"_cameraComponent": {
"__id__": 3
@@ -1618,7 +2012,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 75
"__id__": 93
},
"_alignFlags": 45,
"_target": null,

View File

@@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "*",
"imported": true,
"uuid": "35e882d6-57a2-4024-aa89-850db964c0b0",
"files": [
".atlas",
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,11 @@
{
"ver": "1.2.6",
"importer": "spine-data",
"imported": true,
"uuid": "790a7841-0c16-430a-aae3-54b392e8e255",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,42 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "40ad94fd-d875-4c6a-8742-c275de6bf6d5",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "40ad94fd-d875-4c6a-8742-c275de6bf6d5@6c48a",
"displayName": "skeleton",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "40ad94fd-d875-4c6a-8742-c275de6bf6d5",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "texture",
"fixAlphaTransparencyArtifacts": false,
"redirect": "40ad94fd-d875-4c6a-8742-c275de6bf6d5@6c48a"
}
}

View File

@@ -24,14 +24,14 @@ export class Main extends Root {
protected async run() {
smc.initialize = ecs.getEntity<Initialize>(Initialize);
smc.monsters = [
{prefab_path:'hero',name:'lang',speed:110},
// {prefab_path:'niu',name:'m2',speed:80},
{prefab_path:'lang',name:'迅狼',speed:110},
{prefab_path:'hero',name:'火猴',speed:110},
// {prefab_path:'niu',name:'m3',speed:40},
// {prefab_path:'niu',name:'m4',speed:80},
]
smc.heros = [
// {prefab_path:'niu',name:'war',speed:110},
{prefab_path:'hero',name:'hero',speed:60},
{prefab_path:'lang',name:'迅狼',speed:110},
{prefab_path:'hero',name:'火猴',speed:110},
// {prefab_path:'niu',name:'heath',speed:60},
// {prefab_path:'niu',name:'war',speed:60},
]

View File

@@ -15,5 +15,8 @@ export enum BoxSet {
BOX_WIDTH = 64,
BOX_HEIGHT = 64,
LETF_END = -400,
RIGHT_END = 400
RIGHT_END = 400,
HERO_START = -309,
MONSTER_START = 309,
GAME_LINE = -60,
}

View File

@@ -58,7 +58,7 @@ export class MapViewComp extends CCComp {
this.scene.node.active = true
if (smc.monsters.length>0){
let monster = ecs.getEntity<Monster>(Monster);
let pos:Vec3 = v3(BoxSet.RIGHT_END,-60)
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
let speed =smc.monsters[0].speed
let camp = -1
let prefab_path = smc.monsters[0].prefab_path
@@ -70,7 +70,7 @@ export class MapViewComp extends CCComp {
if(smc.heros.length>0) {
console.log("heros load")
let monster = ecs.getEntity<Monster>(Monster);
let pos = v3(BoxSet.LETF_END,-60)
let pos = v3(BoxSet.HERO_START,BoxSet.GAME_LINE)
let speed =smc.heros[0].speed
let camp = 1
let prefab_path = smc.heros[0].prefab_path

View File

@@ -0,0 +1,56 @@
/*
* @Author: dgflash
* @Date: 2022-08-04 15:22:33
* @LastEditors: dgflash
* @LastEditTime: 2023-05-12 18:04:45
*/
import { Component, Node, Prefab, _decorator ,instantiate} from 'cc';
import { Timer } from '../../../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer';
import {oops} from "../../../../../../../extensions/oops-plugin-framework/assets/core/Oops";
const { ccclass, property } = _decorator;
/**
* 物体层
* 注:
* 1、这里的深度排序如果有性能问题可考虑修改为非每帧排序
* 2、如果全3D世界显示角色相关显示对象则不需要2D深度排序只引用2D地图上的位置信息
*/
@ccclass('SkillLayer')
export default class SkillLayer extends Component {
private timer: Timer = new Timer(0.2);
@property(Prefab)
light: Prefab = null;
onLoad(){
// 监听全局事件
oops.message.on("monster_load", this.onMonsterLoaded, this);
oops.message.on("hero_load", this.onHeroLoaded, this);
}
onMonsterLoaded(){
const light = instantiate(this.light);
light.setPosition(300,-30,0);
this.node.addChild(light);
}
onHeroLoaded(){
const light = instantiate(this.light);
light.setPosition(-300,-30,0);
this.node.addChild(light);
}
update(dt: number) {
this.timer.update(dt)
// if (this.timer.update(dt))
// this.node.children.sort(this.zIndexSort);
}
// private zIndexSort(a: Node, b: Node) {
// let a_zIndex = a.getComponent(Charactor)!.zIndex;
// let b_zIndex = b.getComponent(Charactor)!.zIndex;
// return a_zIndex - b_zIndex;
// }
public clear() {
this.node.children.forEach(n => {
});
}
}

View File

@@ -0,0 +1 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"7852ab4a-120b-4c93-9d76-9b48c382599f","files":[],"subMetas":{},"userData":{"simulateGlobals":[]}}

View File

@@ -0,0 +1,23 @@
import { _decorator, Component, Node, sp } from 'cc';
const { ccclass, property ,} = _decorator;
@ccclass('light')
export class light extends Component {
private spine!: sp.Skeleton;
start() {
}
protected onLoad(): void {
this.spine = this.getComponent(sp.Skeleton)!;
this.spine.setCompleteListener(trackEntry => {
this.node.destroy()
});
}
update(deltaTime: number) {
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "fc960e39-45c0-41bf-8ff8-04a4acca0c38",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -37,7 +37,9 @@ export class Monster extends ecs.Entity {
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,camp:number = 1,prefab_path:string = "monster",name:string="hero") {
var path = "game/monster/"+prefab_path;
// var path = "game/monster/"+prefab_path;
var path = "game/monster/hero";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
@@ -47,7 +49,7 @@ export class Monster extends ecs.Entity {
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
node.setPosition(pos)
console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
const url = 'game/heros/hero/'+name+'/spriteFrame';
const url = 'game/heros/hero/'+prefab_path+'/spriteFrame';
resources.load(url, SpriteFrame, (err: any, spriteFrame) => {
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);

View File

@@ -61,6 +61,9 @@ export class MonsterSpine extends Component {
play(animName: string, loop: boolean): void {
this.spine.setAnimation(0, animName, loop);
}
atk() {
this.spine.setAnimation(0, "atk", false);
}
setAlpha(value: number): void {
var color: Color = this.spine.color;
color.a = 255 * (value / 1);

View File

@@ -23,7 +23,22 @@ export default class MonsterSpineAnimator extends Component {
// console.log("MonsterSpineAnimator start");
this.playAnimation(this.animName, this.loop);
}
mixTime:number= 0.2;
protected onLoad(): void {
this.spine = this.getComponent(sp.Skeleton)!;
// this.spine?.setMix('atk', 'move', this.mixTime);
// this.spine?.setMix('move','atk', this.mixTime);
this.spine.setEndListener(trackEntry => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
if (animationName == "atk") {
this.spine.setAnimation(0, "move", true);
}
});
}
lateUpdate(dt: number) {
//
}

View File

@@ -31,6 +31,11 @@ export class MonsterViewComp extends CCComp {
speed: number = 100;
/** 角色初始速度 */
ospeed: number = 100;
/**攻击速度 */
atk_speed: number = 2;
atk_cd: number = 0;
/** 状态 1move ,2: act 3: stop */
state: number = 1;
Tpos: Vec3 = v3(0,-60,0);
timer: number = 0;
@@ -52,9 +57,10 @@ export class MonsterViewComp extends CCComp {
case BoxSet.MONSTER:
switch (otherCollider.tag){
case BoxSet.HERO:
this.state = 2;
// console.log("im monster other is hero");
this.speed = 0;
this.timer = 1;
// this.speed = 0;
// this.timer = 1;
// console.log("speed:"+this.speed+" | timer:"+this.timer);
break;
case BoxSet.HERO_SKILL:
@@ -67,7 +73,7 @@ export class MonsterViewComp extends CCComp {
case BoxSet.HERO:
switch (otherCollider.tag){
case BoxSet.MONSTER:
this.state = 2;
break;
case BoxSet.HERO_SKILL:
@@ -119,7 +125,7 @@ export class MonsterViewComp extends CCComp {
this.in_destroy();
this.in_stop(dt);
this.in_act(dt);
switch (this.type) {
case 1:
this.as.walk();
@@ -133,9 +139,19 @@ export class MonsterViewComp extends CCComp {
this.update_pos();
}
move(dt: number){
this.node.setPosition(this.node.position.x+dt*this.speed*this.camp, this.node.position.y, this.node.position.z);
}
in_act(dt: number) {
if(this.atk_cd >= this.atk_speed){
this.atk_cd = 0;
this.as.atk();
}
if(this.state == 2){
this.atk_cd += dt;
}
}
/** 静止时间 */
in_stop (dt: number) {
if(this.timer > 0){