添加2个游戏层,敌方精灵随机出现在3个层内
This commit is contained in:
@@ -45,6 +45,9 @@
|
|||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 89
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__id__": 91
|
"__id__": 91
|
||||||
},
|
},
|
||||||
@@ -54,9 +57,6 @@
|
|||||||
{
|
{
|
||||||
"__id__": 95
|
"__id__": 95
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__id__": 88
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__id__": 97
|
"__id__": 97
|
||||||
},
|
},
|
||||||
@@ -572,7 +572,7 @@
|
|||||||
"__expectedType__": "sp.SkeletonData"
|
"__expectedType__": "sp.SkeletonData"
|
||||||
},
|
},
|
||||||
"defaultSkin": "default",
|
"defaultSkin": "default",
|
||||||
"defaultAnimation": "<None>",
|
"defaultAnimation": "move",
|
||||||
"_premultipliedAlpha": false,
|
"_premultipliedAlpha": false,
|
||||||
"_timeScale": 1,
|
"_timeScale": 1,
|
||||||
"_preCacheMode": 1,
|
"_preCacheMode": 1,
|
||||||
@@ -1809,7 +1809,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "rang_box",
|
"_name": "range_box",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"_parent": {
|
"_parent": {
|
||||||
@@ -1832,7 +1832,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 90
|
"__id__": 88
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -1950,7 +1950,7 @@
|
|||||||
},
|
},
|
||||||
"_size": {
|
"_size": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 200,
|
"width": 160,
|
||||||
"height": 80
|
"height": 80
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
@@ -1971,39 +1971,11 @@
|
|||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 87
|
"__id__": 87
|
||||||
},
|
},
|
||||||
"Hero_node": {
|
|
||||||
"__id__": 88
|
|
||||||
},
|
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "64UkfVY1dKB79n553D1pj7"
|
"fileId": "2175joY25A3ZkpTMPMM3QI"
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "dc1b7IQTVxHfIHFfWu0u4I/",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"__editorExtras__": {},
|
|
||||||
"node": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"__prefab": {
|
|
||||||
"__id__": 89
|
|
||||||
},
|
|
||||||
"hitFlashMaterial": {
|
|
||||||
"__uuid__": "a8f34051-ccff-4050-b9d9-234f62977264",
|
|
||||||
"__expectedType__": "cc.Material"
|
|
||||||
},
|
|
||||||
"BoxRang": {
|
|
||||||
"__id__": 86
|
|
||||||
},
|
|
||||||
"_id": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.CompPrefabInfo",
|
|
||||||
"fileId": "88a6VdbQBB7YwXovYCN2Sy"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
@@ -2028,7 +2000,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": false,
|
"_enabled": false,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 92
|
"__id__": 90
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -2056,7 +2028,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 94
|
"__id__": 92
|
||||||
},
|
},
|
||||||
"_customMaterial": null,
|
"_customMaterial": null,
|
||||||
"_srcBlendFactor": 2,
|
"_srcBlendFactor": 2,
|
||||||
@@ -2098,7 +2070,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 96
|
"__id__": 94
|
||||||
},
|
},
|
||||||
"animator": {
|
"animator": {
|
||||||
"__id__": 24
|
"__id__": 24
|
||||||
@@ -2109,6 +2081,31 @@
|
|||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "6cDIo6gXFNnbPNuWVAqhBD"
|
"fileId": "6cDIo6gXFNnbPNuWVAqhBD"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "dc1b7IQTVxHfIHFfWu0u4I/",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 96
|
||||||
|
},
|
||||||
|
"hitFlashMaterial": {
|
||||||
|
"__uuid__": "a8f34051-ccff-4050-b9d9-234f62977264",
|
||||||
|
"__expectedType__": "cc.Material"
|
||||||
|
},
|
||||||
|
"BoxRang": {
|
||||||
|
"__id__": 79
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "88a6VdbQBB7YwXovYCN2Sy"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.RigidBody2D",
|
"__type__": "cc.RigidBody2D",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.50",
|
|
||||||
"importer": "prefab",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "63c02880-bda6-4370-bb22-46bf4f49bbfe",
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"syncNodeName": "own"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,17 +28,17 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 80
|
"__id__": 72
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 82
|
"__id__": 74
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 84
|
"__id__": 76
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 86
|
"__id__": 78
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -197,17 +197,17 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 73
|
"__id__": 65
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 75
|
"__id__": 67
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 77
|
"__id__": 69
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 79
|
"__id__": 71
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -258,16 +258,22 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 44
|
"__id__": 44
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 50
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 56
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 70
|
"__id__": 62
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 72
|
"__id__": 64
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -900,7 +906,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "EntityLayer",
|
"_name": "EntityLayer1",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"_parent": {
|
"_parent": {
|
||||||
@@ -974,7 +980,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "f91Y4OCX1NFKfSWOAvmdSa"
|
"fileId": "f4UHtJSdBGoJN5JNrTo0Cc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "6639ayo4DFKZYCU2OBZzyb+",
|
"__type__": "6639ayo4DFKZYCU2OBZzyb+",
|
||||||
@@ -992,7 +998,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "6fzmfjcbNPK6tOzQOKJfRV"
|
"fileId": "9cpgNjFL5L1Ig8YQrAcaO8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
@@ -1002,35 +1008,31 @@
|
|||||||
"asset": {
|
"asset": {
|
||||||
"__id__": 0
|
"__id__": 0
|
||||||
},
|
},
|
||||||
"fileId": "77ZGG4JjxGiol1pDVFrjGQ",
|
"fileId": "99wEvV2I5Pv6rwpPNwdrxE",
|
||||||
"instance": null,
|
"instance": null,
|
||||||
"targetOverrides": null,
|
"targetOverrides": null,
|
||||||
"nestedPrefabInstanceRoots": null
|
"nestedPrefabInstanceRoots": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "SkillLayer",
|
"_name": "EntityLayer",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"_parent": {
|
"_parent": {
|
||||||
"__id__": 7
|
"__id__": 7
|
||||||
},
|
},
|
||||||
"_children": [
|
"_children": [],
|
||||||
{
|
|
||||||
"__id__": 45
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 65
|
"__id__": 45
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 67
|
"__id__": 47
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 69
|
"__id__": 49
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -1061,273 +1063,6 @@
|
|||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": {
|
|
||||||
"__id__": 44
|
|
||||||
},
|
|
||||||
"_prefab": {
|
|
||||||
"__id__": 46
|
|
||||||
},
|
|
||||||
"__editorExtras__": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.PrefabInfo",
|
|
||||||
"root": {
|
|
||||||
"__id__": 45
|
|
||||||
},
|
|
||||||
"asset": {
|
|
||||||
"__uuid__": "63c02880-bda6-4370-bb22-46bf4f49bbfe",
|
|
||||||
"__expectedType__": "cc.Prefab"
|
|
||||||
},
|
|
||||||
"fileId": "fdklpBwCBM/qJ4WFlQF3kT",
|
|
||||||
"instance": {
|
|
||||||
"__id__": 47
|
|
||||||
},
|
|
||||||
"targetOverrides": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.PrefabInstance",
|
|
||||||
"fileId": "2fXaJzu7JM+6/jYrphb/fs",
|
|
||||||
"prefabRootNode": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"mountedChildren": [],
|
|
||||||
"mountedComponents": [],
|
|
||||||
"propertyOverrides": [
|
|
||||||
{
|
|
||||||
"__id__": 48
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 50
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 51
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 52
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 53
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 54
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 55
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 57
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 59
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 60
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 61
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 62
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 63
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 64
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"removedComponents": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 49
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_name"
|
|
||||||
],
|
|
||||||
"value": "own"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.TargetInfo",
|
|
||||||
"localID": [
|
|
||||||
"fdklpBwCBM/qJ4WFlQF3kT"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 49
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_lpos"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": -13.446,
|
|
||||||
"y": -13.431,
|
|
||||||
"z": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 49
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_lrot"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Quat",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0,
|
|
||||||
"w": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 49
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_euler"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 49
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_active"
|
|
||||||
],
|
|
||||||
"value": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 49
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_lscale"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 1,
|
|
||||||
"y": 1,
|
|
||||||
"z": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 56
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_group"
|
|
||||||
],
|
|
||||||
"value": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.TargetInfo",
|
|
||||||
"localID": [
|
|
||||||
"c8EJ1KQ3hNRbAw0cgsaNRx"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 58
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_group"
|
|
||||||
],
|
|
||||||
"value": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.TargetInfo",
|
|
||||||
"localID": [
|
|
||||||
"62fAGknj9OypOrug6f/FI6"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 58
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_sensor"
|
|
||||||
],
|
|
||||||
"value": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 56
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_type"
|
|
||||||
],
|
|
||||||
"value": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 58
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_density"
|
|
||||||
],
|
|
||||||
"value": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 58
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_offset"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 1.1,
|
|
||||||
"y": 35.9
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 58
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_size"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 57.5,
|
|
||||||
"height": 128
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 56
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_gravityScale"
|
|
||||||
],
|
|
||||||
"value": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__type__": "cc.UITransform",
|
"__type__": "cc.UITransform",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
@@ -1338,7 +1073,225 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 66
|
"__id__": 46
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 100,
|
||||||
|
"height": 100
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "f91Y4OCX1NFKfSWOAvmdSa"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "6639ayo4DFKZYCU2OBZzyb+",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 44
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 48
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "6fzmfjcbNPK6tOzQOKJfRV"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__id__": 0
|
||||||
|
},
|
||||||
|
"fileId": "77ZGG4JjxGiol1pDVFrjGQ",
|
||||||
|
"instance": null,
|
||||||
|
"targetOverrides": null,
|
||||||
|
"nestedPrefabInstanceRoots": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "EntityLayer2",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 7
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": true,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 51
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 53
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 55
|
||||||
|
},
|
||||||
|
"_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__": 50
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 52
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 100,
|
||||||
|
"height": 100
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "fcl9eWhS9K6ZtX9Z626PPp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "6639ayo4DFKZYCU2OBZzyb+",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 50
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 54
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "a2VlMB5DNOr4wbzGgH2lXk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__id__": 0
|
||||||
|
},
|
||||||
|
"fileId": "4fP7G4KUBB+56gZWSQoIpq",
|
||||||
|
"instance": null,
|
||||||
|
"targetOverrides": null,
|
||||||
|
"nestedPrefabInstanceRoots": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "SkillLayer",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 7
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": true,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 57
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 59
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 61
|
||||||
|
},
|
||||||
|
"_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__": 56
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 58
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1362,11 +1315,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 44
|
"__id__": 56
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 68
|
"__id__": 60
|
||||||
},
|
},
|
||||||
"light": {
|
"light": {
|
||||||
"__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8",
|
"__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8",
|
||||||
@@ -1401,7 +1354,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 71
|
"__id__": 63
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1442,7 +1395,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 74
|
"__id__": 66
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1470,7 +1423,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 76
|
"__id__": 68
|
||||||
},
|
},
|
||||||
"camera": {
|
"camera": {
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
@@ -1485,10 +1438,16 @@
|
|||||||
"__id__": 34
|
"__id__": 34
|
||||||
},
|
},
|
||||||
"entityLayer": {
|
"entityLayer": {
|
||||||
|
"__id__": 47
|
||||||
|
},
|
||||||
|
"entityLayer1": {
|
||||||
"__id__": 41
|
"__id__": 41
|
||||||
},
|
},
|
||||||
|
"entityLayer2": {
|
||||||
|
"__id__": 53
|
||||||
|
},
|
||||||
"SkillLayer": {
|
"SkillLayer": {
|
||||||
"__id__": 67
|
"__id__": 59
|
||||||
},
|
},
|
||||||
"isFollowPlayer": true,
|
"isFollowPlayer": true,
|
||||||
"_id": ""
|
"_id": ""
|
||||||
@@ -1507,7 +1466,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 78
|
"__id__": 70
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
@@ -1538,7 +1497,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 81
|
"__id__": 73
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1566,7 +1525,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 83
|
"__id__": 75
|
||||||
},
|
},
|
||||||
"_cameraComponent": {
|
"_cameraComponent": {
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
@@ -1588,7 +1547,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 85
|
"__id__": 77
|
||||||
},
|
},
|
||||||
"_alignFlags": 45,
|
"_alignFlags": 45,
|
||||||
"_target": null,
|
"_target": null,
|
||||||
@@ -1624,11 +1583,6 @@
|
|||||||
},
|
},
|
||||||
"fileId": "32qENLKwZHV5S2IyZfpNx2",
|
"fileId": "32qENLKwZHV5S2IyZfpNx2",
|
||||||
"instance": null,
|
"instance": null,
|
||||||
"targetOverrides": null,
|
"targetOverrides": null
|
||||||
"nestedPrefabInstanceRoots": [
|
|
||||||
{
|
|
||||||
"__id__": 45
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -29,7 +29,7 @@ export class MapMonsterComp extends CCComp {
|
|||||||
cur_mission:number = 1; //当前关卡方案
|
cur_mission:number = 1; //当前关卡方案
|
||||||
mission_list:any = []
|
mission_list:any = []
|
||||||
setp_timer: Timer = new Timer(0.5);
|
setp_timer: Timer = new Timer(0.5);
|
||||||
setp_num:number = 50;
|
setp_num:number = 5;
|
||||||
onLoad(){
|
onLoad(){
|
||||||
// 监听全局事件
|
// 监听全局事件
|
||||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||||
@@ -40,7 +40,7 @@ export class MapMonsterComp extends CCComp {
|
|||||||
let num =RandomManager.instance.getRandomByObjectList(MissionNum,1)
|
let num =RandomManager.instance.getRandomByObjectList(MissionNum,1)
|
||||||
this.cur_mission = num[0]
|
this.cur_mission = num[0]
|
||||||
this.mission_list = MonsetList[this.cur_mission]
|
this.mission_list = MonsetList[this.cur_mission]
|
||||||
console.log("当前关卡方案",this.cur_mission,this.mission_list)
|
// console.log("当前关卡方案",this.cur_mission,this.mission_list)
|
||||||
this.refresh_timer= new Timer(smc.vm_data.gold.cd);
|
this.refresh_timer= new Timer(smc.vm_data.gold.cd);
|
||||||
this.monster_refresh()
|
this.monster_refresh()
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ export class MapMonsterComp extends CCComp {
|
|||||||
this.monster_refresh()
|
this.monster_refresh()
|
||||||
}
|
}
|
||||||
if (this.refresh_timer.update(dt)) {
|
if (this.refresh_timer.update(dt)) {
|
||||||
this.setp_num = RandomManager.instance.getRandomInt(this.min_monster_num,this.max_monster_num,2)
|
// this.setp_num = RandomManager.instance.getRandomInt(this.min_monster_num,this.max_monster_num,2)
|
||||||
}
|
}
|
||||||
if (this.mission_up_timer.update(dt)) {
|
if (this.mission_up_timer.update(dt)) {
|
||||||
// 刷新怪物定时器
|
// 刷新怪物定时器
|
||||||
@@ -64,22 +64,36 @@ export class MapMonsterComp extends CCComp {
|
|||||||
if (this.setp_num <= 0){
|
if (this.setp_num <= 0){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log("当前波数",this.cur_count)
|
// console.log("当前波数",this.cur_count)
|
||||||
console.log("当前怪物池",this.mission_list[this.monster_level])
|
// console.log("当前怪物池",this.mission_list[this.monster_level])
|
||||||
let m:any = RandomManager.instance.getRandomByObjectList(this.mission_list[this.monster_level],1)
|
let m:any = RandomManager.instance.getRandomByObjectList(this.mission_list[this.monster_level],1)
|
||||||
console.log("刷怪",m)
|
// console.log("刷怪",m)
|
||||||
this.addMonster(m[0])
|
this.addMonster(m[0])
|
||||||
this.setp_num -= 1
|
this.setp_num -= 1
|
||||||
}
|
}
|
||||||
private addMonster(uuid:number=1101) {
|
private addMonster(uuid:number=1101) {
|
||||||
|
|
||||||
let monster = ecs.getEntity<Monster>(Monster);
|
let monster = ecs.getEntity<Monster>(Monster);
|
||||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||||
let scale = -1
|
let scale = -1
|
||||||
monster.load(pos,scale,uuid);
|
var scene = smc.map.MapView.scene;
|
||||||
|
let x = RandomManager.instance.getRandomInt(0,2, 2);
|
||||||
|
let monster_layer = scene.entityLayer!.node!
|
||||||
|
switch (x) {
|
||||||
|
case 1:
|
||||||
|
monster_layer = scene.entityLayer1!.node!;
|
||||||
|
pos.y=pos.y+5;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
monster_layer= scene.entityLayer2!.node!;
|
||||||
|
pos.y=pos.y-5;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
monster.load(pos,scale,uuid,monster_layer);
|
||||||
smc.monsters.splice(0,1)
|
smc.monsters.splice(0,1)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private on_do_add_monster(event: string, args: any) {
|
private on_do_add_monster(event: string, args: any) {
|
||||||
// this.addMonster(args.uuid)
|
// this.addMonster(args.uuid)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,11 @@ export class MapSkillComp extends CCComp {
|
|||||||
csk.load(pos,scale,uuid);
|
csk.load(pos,scale,uuid);
|
||||||
}
|
}
|
||||||
doMonsterLoad(){
|
doMonsterLoad(){
|
||||||
// const light = instantiate(this.light);
|
const light = instantiate(this.light);
|
||||||
// light.setPosition(300,-30,0);
|
light.setPosition(BoxSet.MONSTER_START,BoxSet.GAME_LINE);
|
||||||
// this.node.addChild(light);
|
this.node.addChild(light);
|
||||||
}
|
}
|
||||||
doHeroLoad(){
|
doHeroLoad(){
|
||||||
console.log(this.light)
|
|
||||||
const light = instantiate(this.light);
|
const light = instantiate(this.light);
|
||||||
light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
|
light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
|
||||||
this.node.addChild(light);
|
this.node.addChild(light);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { v3, Vec3, _decorator ,Prefab,instantiate,JsonAsset} from "cc";
|
|||||||
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
import { smc } from "../../common/SingletonModuleComp";
|
import { smc } from "../../common/SingletonModuleComp";
|
||||||
// import { Role } from "../../role/Role";
|
|
||||||
import { BoxSet } from "../../common/config/BoxSet";
|
import { BoxSet } from "../../common/config/BoxSet";
|
||||||
import { Hero } from "../../monster/Hero";
|
import { Hero } from "../../monster/Hero";
|
||||||
import { Monster } from "../../monster/Monster";
|
import { Monster } from "../../monster/Monster";
|
||||||
@@ -12,7 +11,6 @@ import { Timer } from "../../../../../extensions/oops-plugin-framework/assets/co
|
|||||||
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||||
import { CardSet } from "../../common/config/CardSet";
|
import { CardSet } from "../../common/config/CardSet";
|
||||||
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('MapViewComp')
|
@ccclass('MapViewComp')
|
||||||
@@ -42,6 +40,10 @@ export class MapViewComp extends CCComp {
|
|||||||
start() {
|
start() {
|
||||||
this.scene = this.getComponent(MapViewScene);
|
this.scene = this.getComponent(MapViewScene);
|
||||||
this.load_data()
|
this.load_data()
|
||||||
|
this.load_role()
|
||||||
|
}
|
||||||
|
load_role(){
|
||||||
|
|
||||||
}
|
}
|
||||||
load_data(){
|
load_data(){
|
||||||
// let heros = oops.res.get("config/game/heros")
|
// let heros = oops.res.get("config/game/heros")
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ export class MapViewScene extends Component {
|
|||||||
|
|
||||||
@property(EntityLayer)
|
@property(EntityLayer)
|
||||||
public entityLayer: EntityLayer | null = null;
|
public entityLayer: EntityLayer | null = null;
|
||||||
|
@property(EntityLayer)
|
||||||
|
public entityLayer1: EntityLayer | null = null;
|
||||||
|
@property(EntityLayer)
|
||||||
|
public entityLayer2: EntityLayer | null = null;
|
||||||
|
|
||||||
@property(SkillLayer)
|
@property(SkillLayer)
|
||||||
public SkillLayer: SkillLayer | null = null;
|
public SkillLayer: SkillLayer | null = null;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default class EntityLayer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected start(): void {
|
protected start(): void {
|
||||||
console.log("EntityLayer start")
|
console.log("EntityLayer start",this)
|
||||||
}
|
}
|
||||||
|
|
||||||
public clear() {
|
public clear() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { _decorator,Contact2DType,Collider2D ,IPhysics2DContact} from "cc";
|
import { _decorator,Contact2DType,Collider2D ,IPhysics2DContact,v3, v2} from "cc";
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
import { BoxSet } from "../common/config/BoxSet";
|
import { BoxSet } from "../common/config/BoxSet";
|
||||||
@@ -9,41 +9,46 @@ const { ccclass, property } = _decorator;
|
|||||||
@ccclass('BoxRangComp')
|
@ccclass('BoxRangComp')
|
||||||
@ecs.register('BoxRang', false)
|
@ecs.register('BoxRang', false)
|
||||||
export class BoxRangComp extends CCComp {
|
export class BoxRangComp extends CCComp {
|
||||||
@property(MonsterViewComp)
|
Hero_node: any=null!;
|
||||||
Hero_node:MonsterViewComp = null!;
|
MonsterViewComp:MonsterViewComp = null!;
|
||||||
|
|
||||||
box_group:number = BoxSet.DEFAULT;
|
box_group:number = BoxSet.DEFAULT;
|
||||||
box_tag:number = BoxSet.ATK_RANGE;
|
box_tag:number = BoxSet.ATK_RANGE;
|
||||||
|
offset_x:number = 0;
|
||||||
/** 视图层逻辑代码分离演示 */
|
/** 视图层逻辑代码分离演示 */
|
||||||
start() {
|
start() {
|
||||||
let collider = this.getComponent(Collider2D);
|
let collider = this.getComponent(Collider2D);
|
||||||
collider.group = this.box_group;
|
collider.group = this.box_group;
|
||||||
collider.tag = this.box_tag;
|
collider.tag = this.box_tag;
|
||||||
// console.log(collider,this.Hero_node);
|
collider.offset = v2(this.offset_x,45);
|
||||||
|
this.Hero_node = this.node.parent;
|
||||||
|
this.MonsterViewComp=this.Hero_node.getComponent(MonsterViewComp);
|
||||||
|
// console.log("range box",this.MonsterViewComp);
|
||||||
if (collider) {
|
if (collider) {
|
||||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||||
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
|
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
|
||||||
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
|
// collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
|
||||||
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||||
|
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE&&otherCollider.tag != BoxSet.SKILL_TAG){
|
||||||
}
|
// console.log("range box group: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
|
||||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
this.MonsterViewComp.is_atking = true;
|
||||||
|
|
||||||
}
|
|
||||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
|
||||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE){
|
|
||||||
this.Hero_node.is_atking = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
// onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||||
|
// // console.log("range box group: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| range box tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
// onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||||
reset() {
|
reset() {
|
||||||
this.node.destroy();
|
this.node.destroy();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export class CSkill extends ecs.Entity {
|
|||||||
/** 加载角色 */
|
/** 加载角色 */
|
||||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001) {
|
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001) {
|
||||||
// var path = "game/monster/"+prefab_path;
|
// var path = "game/monster/"+prefab_path;
|
||||||
console.log("load skill",this)
|
// console.log("load skill",this)
|
||||||
var path = "game/heros/skill";
|
var path = "game/heros/skill";
|
||||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||||
var node = instantiate(prefab);
|
var node = instantiate(prefab);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { MonsterSpine } from "./MonsterSpine";
|
|||||||
import { MonsterViewComp } from "./MonsterViewComp";
|
import { MonsterViewComp } from "./MonsterViewComp";
|
||||||
import { CardSet } from "../common/config/CardSet";
|
import { CardSet } from "../common/config/CardSet";
|
||||||
import { BoxSet } from "../common/config/BoxSet";
|
import { BoxSet } from "../common/config/BoxSet";
|
||||||
|
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||||
/** 角色实体 */
|
/** 角色实体 */
|
||||||
@ecs.register(`Monster`)
|
@ecs.register(`Monster`)
|
||||||
export class Monster extends ecs.Entity {
|
export class Monster extends ecs.Entity {
|
||||||
@@ -36,23 +37,19 @@ export class Monster extends ecs.Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 加载角色 */
|
/** 加载角色 */
|
||||||
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001) {
|
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!) {
|
||||||
// var path = "game/monster/"+prefab_path;
|
// var path = "game/monster/"+prefab_path;
|
||||||
var path = "game/heros/hero";
|
var path = "game/heros/hero";
|
||||||
|
|
||||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||||
var node = instantiate(prefab);
|
var node = instantiate(prefab);
|
||||||
var scene = smc.map.MapView.scene;
|
node.parent=layer
|
||||||
node.parent = scene.entityLayer!.node!;
|
// var as = node.getComponent(MonsterSpine);
|
||||||
var as = node.getComponent(MonsterSpine);
|
|
||||||
|
|
||||||
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
||||||
node.setPosition(pos)
|
node.setPosition(pos)
|
||||||
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
||||||
const url = 'game/heros/heros';
|
const url = 'game/heros/heros';
|
||||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||||
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||||
|
|
||||||
sprite.spriteFrame = atlas.getSpriteFrame(smc.heros[uuid].path);
|
sprite.spriteFrame = atlas.getSpriteFrame(smc.heros[uuid].path);
|
||||||
});
|
});
|
||||||
this.hero_init(uuid,node)
|
this.hero_init(uuid,node)
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ const { ccclass, property } = _decorator;
|
|||||||
@ccclass('MonsterViewComp') // 定义为 Cocos Creator 组件
|
@ccclass('MonsterViewComp') // 定义为 Cocos Creator 组件
|
||||||
@ecs.register('MonsterView', false) // 定义为 ECS 组件
|
@ecs.register('MonsterView', false) // 定义为 ECS 组件
|
||||||
export class MonsterViewComp extends CCComp {
|
export class MonsterViewComp extends CCComp {
|
||||||
|
|
||||||
@property(Material)
|
@property(Material)
|
||||||
hitFlashMaterial: Material;
|
hitFlashMaterial: Material;
|
||||||
orginalFlashMaterial: Material;
|
orginalFlashMaterial: Material;
|
||||||
sprite: Sprite;
|
sprite: Sprite;
|
||||||
@property(BoxRangComp)
|
|
||||||
BoxRang:BoxRangComp = null!;
|
@property(Node)
|
||||||
|
BoxRang:Node =null!
|
||||||
/** 角色动画 */
|
/** 角色动画 */
|
||||||
as: MonsterSpine = null!;
|
as: MonsterSpine = null!;
|
||||||
hero_uuid:number = 1001;
|
hero_uuid:number = 1001;
|
||||||
@@ -76,21 +76,25 @@ export class MonsterViewComp extends CCComp {
|
|||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.as = this.getComponent(MonsterSpine);
|
this.as = this.getComponent(MonsterSpine);
|
||||||
// PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb |
|
PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
|
||||||
// EPhysics2DDrawFlags.Pair |
|
// | EPhysics2DDrawFlags.Pair
|
||||||
// EPhysics2DDrawFlags.CenterOfMass |
|
// |EPhysics2DDrawFlags.CenterOfMass
|
||||||
// EPhysics2DDrawFlags.Joint |
|
// |EPhysics2DDrawFlags.Joint
|
||||||
// EPhysics2DDrawFlags.Shape;
|
// |EPhysics2DDrawFlags.Shape;
|
||||||
} /** 视图层逻辑代码分离演示 */
|
} /** 视图层逻辑代码分离演示 */
|
||||||
start () {
|
start () {
|
||||||
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||||
|
|
||||||
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||||
|
|
||||||
|
|
||||||
|
this.BoxRang = this.node.getChildByName("range_box");
|
||||||
|
this.BoxRang.getComponent(BoxRangComp).box_group = this.box_group;
|
||||||
|
this.BoxRang.getComponent(BoxRangComp).offset_x = this.scale*SkillSet[this.skill_uuid].dis-30;
|
||||||
|
// console.log("monseter ",this.BoxRang);
|
||||||
|
|
||||||
// 注册单个碰撞体的回调函数
|
// 注册单个碰撞体的回调函数
|
||||||
let collider = this.getComponent(Collider2D);
|
let collider = this.getComponent(Collider2D);
|
||||||
collider.group = this.box_group;
|
collider.group = this.box_group;
|
||||||
this.BoxRang.box_group = this.box_group;
|
|
||||||
// console.log(collider);
|
|
||||||
if (collider) {
|
if (collider) {
|
||||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||||
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
|
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
|
||||||
@@ -105,6 +109,7 @@ export class MonsterViewComp extends CCComp {
|
|||||||
|
|
||||||
}
|
}
|
||||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||||
|
|
||||||
if(otherCollider.tag==BoxSet.SKILL_TAG &&selfCollider.tag!=BoxSet.SKILL_TAG){
|
if(otherCollider.tag==BoxSet.SKILL_TAG &&selfCollider.tag!=BoxSet.SKILL_TAG){
|
||||||
if(selfCollider.group != otherCollider.group){
|
if(selfCollider.group != otherCollider.group){
|
||||||
let skill = otherCollider.node.getComponent(SkillCom)!;
|
let skill = otherCollider.node.getComponent(SkillCom)!;
|
||||||
@@ -135,17 +140,19 @@ export class MonsterViewComp extends CCComp {
|
|||||||
let self_pos=selfCollider.node.getPosition();
|
let self_pos=selfCollider.node.getPosition();
|
||||||
let other_pos=otherCollider.node.getPosition();
|
let other_pos=otherCollider.node.getPosition();
|
||||||
if(selfCollider.group == BoxSet.HERO){
|
if(selfCollider.group == BoxSet.HERO){
|
||||||
if(self_pos.x < other_pos.x&&Math.abs(self_pos.x-other_pos.x) <= 20){
|
if(self_pos.x < other_pos.x&&Math.abs(self_pos.x-other_pos.x) <= 20&&self_pos.y==other_pos.y){
|
||||||
this.stop_cd=0.1
|
this.stop_cd=0.1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(selfCollider.group == BoxSet.MONSTER){
|
if(selfCollider.group == BoxSet.MONSTER){
|
||||||
if(self_pos.x > other_pos.x&&Math.abs(self_pos.x-other_pos.x) <= 20){
|
if(self_pos.x > other_pos.x&&Math.abs(self_pos.x-other_pos.x) <= 20&&self_pos.y==other_pos.y){
|
||||||
this.stop_cd=0.1
|
this.stop_cd=0.1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
// console.log('monster onPostSolve'+selfCollider.group+"|"+otherCollider.group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -172,15 +179,6 @@ export class MonsterViewComp extends CCComp {
|
|||||||
this.in_destroy();
|
this.in_destroy();
|
||||||
this.in_stop(dt);
|
this.in_stop(dt);
|
||||||
this.in_act(dt);
|
this.in_act(dt);
|
||||||
switch (this.type) {
|
|
||||||
case 1:
|
|
||||||
this.as.walk();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
this.as.idle();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.move(dt);
|
this.move(dt);
|
||||||
// this.update_pos();
|
// this.update_pos();
|
||||||
|
|
||||||
@@ -213,7 +211,7 @@ export class MonsterViewComp extends CCComp {
|
|||||||
this.node.getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
|
this.node.getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
|
||||||
}
|
}
|
||||||
shoot(skill_uuid:number){
|
shoot(skill_uuid:number){
|
||||||
console.log("monster shoot");
|
// console.log("monster shoot");
|
||||||
let skill = ecs.getEntity<Skill>(Skill);
|
let skill = ecs.getEntity<Skill>(Skill);
|
||||||
let x=0
|
let x=0
|
||||||
let pos = v3(x,40)
|
let pos = v3(x,40)
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "ffdd5a80-e057-4f91-92af-a86e1b26cbc6",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"compressionType": {},
|
|
||||||
"isRemoteBundle": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
|
|
||||||
/*
|
|
||||||
* @Author: dgflash
|
|
||||||
* @Date: 2021-11-18 17:47:56
|
|
||||||
* @LastEditors: dgflash
|
|
||||||
* @LastEditTime: 2022-08-04 15:43:04
|
|
||||||
*/
|
|
||||||
import { instantiate, Node, Prefab, Vec3 } from "cc";
|
|
||||||
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
|
|
||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
||||||
import { UIID } from "../common/config/GameUIConfig";
|
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
|
||||||
import { RoleModelComp } from "./model/RoleModelComp";
|
|
||||||
import { RoleSpine } from "./view/RoleSpine";
|
|
||||||
import { RoleViewComp } from "./view/RoleViewComp";
|
|
||||||
|
|
||||||
/** 角色实体 */
|
|
||||||
@ecs.register(`Role`)
|
|
||||||
export class Role extends ecs.Entity {
|
|
||||||
// 数据层
|
|
||||||
RoleModel!: RoleModelComp;
|
|
||||||
// 视图层
|
|
||||||
RoleView!: RoleViewComp;
|
|
||||||
|
|
||||||
protected init() {
|
|
||||||
this.addComponents<ecs.Comp>(
|
|
||||||
RoleModelComp);
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy(): void {
|
|
||||||
this.remove(RoleViewComp);
|
|
||||||
super.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 加载角色 */
|
|
||||||
load(pos: Vec3 = Vec3.ZERO, isMonster: boolean = false,type:string = "monster",anim:string = "idle") {
|
|
||||||
console.log("load role type",type);
|
|
||||||
var path = "game/player/player";
|
|
||||||
|
|
||||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
|
||||||
var node = instantiate(prefab);
|
|
||||||
var scene = smc.map.MapView.scene;
|
|
||||||
node.parent = scene.entityLayer!.node!;
|
|
||||||
var as = node.getComponent(RoleSpine);
|
|
||||||
as.play(anim, true);
|
|
||||||
node.setPosition(pos)
|
|
||||||
|
|
||||||
var mv = node.getComponent(RoleViewComp)!;
|
|
||||||
this.add(mv);
|
|
||||||
|
|
||||||
if (isMonster) {
|
|
||||||
node.setScale(-1, 1, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "deb5a90b-5729-4a03-9f73-28ed96202f8a",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
/** 角色模块全局事件 */
|
|
||||||
export enum RoleEvent {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "a2e7abd7-21aa-4dfc-ab5c-6dd0dfba2a7c",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "8164d96e-0467-4bd2-9123-8a490de8c68f",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"compressionType": {},
|
|
||||||
"isRemoteBundle": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "5130ca90-66bd-4c87-8db9-f9f847396454",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "52966ec2-355b-4c89-a608-5d5f34ba8ae9",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"compressionType": {},
|
|
||||||
"isRemoteBundle": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "7bde0e45-7d4e-4cf5-b0ce-f8b6a5ca4d12",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"compressionType": {},
|
|
||||||
"isRemoteBundle": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "20fb6abb-3b0e-4361-8200-941b98891456",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"compressionType": {},
|
|
||||||
"isRemoteBundle": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "3fba28ee-42f7-4be0-a42d-776301b37fbc",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"compressionType": {},
|
|
||||||
"isRemoteBundle": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "2fc06e2a-6834-4ce6-9a7b-96eae66f0abe",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "d299c6b5-6424-4c27-ab35-013e8ad0c433",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "1ca33287-9c39-44a8-b8dd-c6e0c21dd8a7",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: dgflash
|
|
||||||
* @Date: 2022-01-26 14:14:34
|
|
||||||
* @LastEditors: dgflash
|
|
||||||
* @LastEditTime: 2022-01-27 15:49:36
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** 角色动作名 */
|
|
||||||
export enum RoleAnimatorType {
|
|
||||||
/** 待机 */
|
|
||||||
idle = "idle",
|
|
||||||
/** 攻击 */
|
|
||||||
act1 = "act1",
|
|
||||||
/** 受击 */
|
|
||||||
magic1 = "magic1",
|
|
||||||
/** 死亡 */
|
|
||||||
move = "move"
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "a8fd6149-fa4b-4b2c-83c0-c08b3813b9f7",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "5c21f8a7-8fd1-4845-a777-a2e03256526b",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "b53c6b75-188b-46ae-93a9-4c1ecd6009c8",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: dgflash
|
|
||||||
* @Date: 2021-11-18 15:56:01
|
|
||||||
* @LastEditors: dgflash
|
|
||||||
* @LastEditTime: 2022-08-17 13:43:25
|
|
||||||
*/
|
|
||||||
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色属性数据
|
|
||||||
*/
|
|
||||||
@ecs.register('RoleModel')
|
|
||||||
export class RoleModelComp extends ecs.Comp {
|
|
||||||
/** 角色编号 */
|
|
||||||
id: number = -1;
|
|
||||||
|
|
||||||
/** 角色名 */
|
|
||||||
name: string = "oops-framework";
|
|
||||||
|
|
||||||
/** 动画名资源 */
|
|
||||||
anim: string = "model1";
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
this.id = -1;
|
|
||||||
this.name = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "0b31330a-261d-4b13-a0d5-15d2727b1dbd",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "58956230-0127-4793-ad43-621ceedb7d25",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "25e1a634-f8fe-44ca-9650-0d287532b566",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "b6c9dfb2-45d4-485c-8d0e-55a7f98e324e",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"compressionType": {},
|
|
||||||
"isRemoteBundle": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "71fe316b-1691-4a24-b0b8-8c6e88938401",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: dgflash
|
|
||||||
* @Date: 2022-08-04 15:08:35
|
|
||||||
* @LastEditors: dgflash
|
|
||||||
* @LastEditTime: 2022-08-04 15:26:26
|
|
||||||
*/
|
|
||||||
import { Color, Component, EventTouch, sp, Vec3, _decorator } from "cc";
|
|
||||||
import { LayerUtil } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/LayerUtil";
|
|
||||||
import { smc } from "../../common/SingletonModuleComp";
|
|
||||||
import RoleSpineAnimator from "./RoleSpineAnimator";
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RPG SPINE角色模型
|
|
||||||
*/
|
|
||||||
@ccclass('RoleSpine')
|
|
||||||
export class RoleSpine extends Component {
|
|
||||||
@property({ type: RoleSpineAnimator, tooltip: '动画控制器' })
|
|
||||||
animator: RoleSpineAnimator = null!;
|
|
||||||
|
|
||||||
private spine!: sp.Skeleton;
|
|
||||||
|
|
||||||
onLoad() {
|
|
||||||
// 角色控制组件
|
|
||||||
|
|
||||||
this.initAnimator();
|
|
||||||
// this.setSkin("magic");
|
|
||||||
// this.animator.play("idle", true);
|
|
||||||
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 初始化动画 */
|
|
||||||
protected initAnimator() {
|
|
||||||
this.spine = this.animator.getComponent(sp.Skeleton)!;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
atk() {
|
|
||||||
this.spine.setAnimation(0, "atk", false);
|
|
||||||
}
|
|
||||||
magic(){
|
|
||||||
this.spine.setAnimation(0, "magic", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
setSkin(value: string): void {
|
|
||||||
console.log("RoleSpine setSkin", value);
|
|
||||||
this.spine.setSkin(value);
|
|
||||||
}
|
|
||||||
play(animName: string, loop: boolean): void {
|
|
||||||
this.spine.setAnimation(0, animName, loop);
|
|
||||||
}
|
|
||||||
setAlpha(value: number): void {
|
|
||||||
var color: Color = this.spine.color;
|
|
||||||
color.a = 255 * (value / 1);
|
|
||||||
this.spine.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onDestroy() {
|
|
||||||
this.node.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
walk() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
idle() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "9b5610bf-dad3-4695-bb64-92006701ea56",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: dgflash
|
|
||||||
* @Date: 2022-08-04 15:08:35
|
|
||||||
* @LastEditors: dgflash
|
|
||||||
* @LastEditTime: 2022-08-04 15:26:38
|
|
||||||
*/
|
|
||||||
import { sp, _decorator ,Component} from "cc";
|
|
||||||
import { smc } from "../../common/SingletonModuleComp";
|
|
||||||
|
|
||||||
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Spine状态机组件(主状态机),trackIndex为0
|
|
||||||
*/
|
|
||||||
@ccclass
|
|
||||||
@disallowMultiple
|
|
||||||
@requireComponent(sp.Skeleton)
|
|
||||||
export default class RoleSpineAnimator extends Component {
|
|
||||||
private animName: string = "move";
|
|
||||||
private loop: boolean = true;
|
|
||||||
private spine!: sp.Skeleton;
|
|
||||||
mixTime:number= 0.2;
|
|
||||||
|
|
||||||
protected onLoad(): void {
|
|
||||||
this.spine = this.getComponent(sp.Skeleton)!;
|
|
||||||
this.spine.setEndListener(trackEntry => {
|
|
||||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
|
||||||
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
|
|
||||||
if (animationName == "atk"||animationName == "magic") {
|
|
||||||
this.spine.setAnimation(0, "move", true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
start() {
|
|
||||||
this.spine = this.getComponent(sp.Skeleton)!;
|
|
||||||
this.playAnimation(this.animName, this.loop);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
lateUpdate(dt: number) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
play(animName: string, loop: boolean) {
|
|
||||||
if (animName) {
|
|
||||||
this.animName = animName;
|
|
||||||
this.loop = loop;
|
|
||||||
this.spine.setAnimation(0, this.animName, this.loop);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 播放动画
|
|
||||||
* @override
|
|
||||||
* @param animName 动画名
|
|
||||||
* @param loop 是否循环播放
|
|
||||||
*/
|
|
||||||
protected playAnimation(animName: string, loop: boolean) {
|
|
||||||
console.log("RoleSpineAnimator playAnimation");
|
|
||||||
if (animName) {
|
|
||||||
console.log("RoleSpineAnimator playAnimation animName", animName);
|
|
||||||
this.animName = animName;
|
|
||||||
this.loop = loop;
|
|
||||||
this.spine.setAnimation(0, this.animName, this.loop);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "eb846c27-0bd3-4d9c-8261-e6ed8ac379a3",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "6842e219-fc64-4f36-94ad-5874aa08735f",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "95fb600c-f0c6-4720-94da-b222ff2a3574",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "495b1f8f-d6a5-48bb-9a8c-4ed84361f127",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: dgflash
|
|
||||||
* @Date: 2021-11-18 17:42:59
|
|
||||||
* @LastEditors: dgflash
|
|
||||||
* @LastEditTime: 2022-08-17 12:36:18
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Vec3, _decorator ,v3,Collider2D,Contact2DType,IPhysics2DContact,Prefab,instantiate} from "cc";
|
|
||||||
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
||||||
import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
|
||||||
import { RoleSpine } from "./RoleSpine";
|
|
||||||
import { BoxSet } from "../../common/config/BoxSet";
|
|
||||||
import { smc } from "../../common/SingletonModuleComp";
|
|
||||||
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
|
||||||
import { Timer } from "../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
|
||||||
import { SkillCom } from "../../skills/SkillCom";
|
|
||||||
import { Skill } from "../../skills/Skill";
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
/** 角色显示组件 */
|
|
||||||
@ccclass('RoleViewComp') // 定义为 Cocos Creator 组件
|
|
||||||
@ecs.register('RoleView', false) // 定义为 ECS 组件
|
|
||||||
export class RoleViewComp extends CCComp {
|
|
||||||
as: RoleSpine = null!;
|
|
||||||
hero_uuid:string = 'h001';
|
|
||||||
hero_name : string = "hero";
|
|
||||||
level:number =1;
|
|
||||||
state: number = 1; /** 状态 1:move ,2: act 3: stop */
|
|
||||||
|
|
||||||
hp: number = 100; /** 血量 */
|
|
||||||
hp_max: number = 100; /** 最大血量 */
|
|
||||||
hp_speed: number = 0; //回复速度
|
|
||||||
|
|
||||||
power: number = 0; /**能量**/
|
|
||||||
power_max: number = 100; /** 能量最大值 */
|
|
||||||
power_speed: number = 1; //能量回复速度每0.1秒回复量
|
|
||||||
|
|
||||||
skill_name: string = "base"; //技能名称
|
|
||||||
max_skill_name: string = "base"; //大技能名称
|
|
||||||
|
|
||||||
atk: number = 2; /**攻击力 */
|
|
||||||
// atk_speed: number = 1;
|
|
||||||
atk_cd: number = 2; /**攻击速度 攻击间隔 */
|
|
||||||
atk_time: number = 0; /** 冷却时间 */
|
|
||||||
|
|
||||||
stop_cd: number = 0; /*停止倒计时*/
|
|
||||||
|
|
||||||
is_dead:boolean = false; //是否摧毁
|
|
||||||
shield:number = 0; //护盾量
|
|
||||||
shield_time:number = 0; //护盾持续时间
|
|
||||||
|
|
||||||
private timer:Timer = new Timer(0.1); //计时器
|
|
||||||
onLoad() {
|
|
||||||
this.as = this.getComponent(RoleSpine);
|
|
||||||
}
|
|
||||||
protected start(): void {
|
|
||||||
let collider = this.getComponent(Collider2D);
|
|
||||||
if (collider) {
|
|
||||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
|
||||||
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
|
|
||||||
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
|
||||||
}
|
|
||||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
|
||||||
// 只在两个碰撞体结束接触时被调用一次
|
|
||||||
}
|
|
||||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
|
||||||
if(otherCollider.group== BoxSet.HERO_SKILL || otherCollider.group== BoxSet.MONSTER_SKILL){
|
|
||||||
let skill = otherCollider.node.getComponent(SkillCom)!;
|
|
||||||
// console.log('onPostSolve',skill);
|
|
||||||
this.in_atked();
|
|
||||||
// this.hp_change(skill.atk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
update(dt: number){
|
|
||||||
if (this.timer.update(dt)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
this.in_act(dt);
|
|
||||||
|
|
||||||
}
|
|
||||||
in_act(dt: number) {
|
|
||||||
if(this.atk_time >= this.atk_cd){
|
|
||||||
this.atk_time = 0;
|
|
||||||
// console.log("atk_cd:"+this.atk_cd);
|
|
||||||
this.as.atk();
|
|
||||||
this.load_skill(this.skill_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.atk_time += dt;
|
|
||||||
}
|
|
||||||
load_skill(skill_name:string){
|
|
||||||
// let skill = ecs.getEntity<Skill>(Skill);
|
|
||||||
// let pos = v3(30,30)
|
|
||||||
// let speed =400
|
|
||||||
// let scale = 1
|
|
||||||
// let range = 720
|
|
||||||
// skill.load(pos,speed,range,scale,this.node,skill_name,this.atk);
|
|
||||||
}
|
|
||||||
in_atked() {
|
|
||||||
var path = "game/skills/atked";
|
|
||||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
|
||||||
var node = instantiate(prefab);
|
|
||||||
let pos = v3(0,30)
|
|
||||||
node.setPosition(pos)
|
|
||||||
node.parent = this.node;
|
|
||||||
}
|
|
||||||
reset() {
|
|
||||||
this.node.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "60726b1a-adbb-480c-97cb-2c4fbbe7228b",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: dgflash
|
|
||||||
* @Date: 2022-08-04 15:08:35
|
|
||||||
* @LastEditors: dgflash
|
|
||||||
* @LastEditTime: 2022-08-04 15:28:02
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Component, v3, _decorator } from "cc";
|
|
||||||
import { smc } from "../../common/SingletonModuleComp";
|
|
||||||
import MapRoadUtils from "../../map/view/map/road/MapRoadUtils";
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
@ccclass('RoleViewOwn')
|
|
||||||
export class RoleViewOwn extends Component {
|
|
||||||
|
|
||||||
onLoad() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private aStarToVec3(str: string) {
|
|
||||||
let array = str.split(",");
|
|
||||||
let x = parseInt(array[0]);
|
|
||||||
let y = parseInt(array[1]);
|
|
||||||
let p = MapRoadUtils.instance.getPixelByDerect(x, y);
|
|
||||||
return v3(p.x, p.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "dce416c5-4d4c-4ccd-b79f-ebdcf9bd0ddc",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: dgflash
|
|
||||||
* @Date: 2022-02-12 13:38:13
|
|
||||||
* @LastEditors: dgflash
|
|
||||||
* @LastEditTime: 2022-08-17 12:36:31
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { EventTouch, Vec3, _decorator } from 'cc';
|
|
||||||
import { ecs } from '../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS';
|
|
||||||
import { CCComp } from '../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp';
|
|
||||||
import { smc } from '../../common/SingletonModuleComp';
|
|
||||||
// import { Role } from '../Role';
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
@ccclass("RoleViewUIControllerComp")
|
|
||||||
@ecs.register('RoleViewUIController', false)
|
|
||||||
export class RoleViewUIControllerComp extends CCComp {
|
|
||||||
|
|
||||||
// private target: Role = null!;
|
|
||||||
|
|
||||||
start() {
|
|
||||||
// this.target = smc.own;
|
|
||||||
}
|
|
||||||
|
|
||||||
onDestroy() {
|
|
||||||
this.ent.remove(RoleViewUIControllerComp);
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
reset(): void {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "adad65c3-b462-4ea5-8d65-060a5f2de25d",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,250 +0,0 @@
|
|||||||
import { CCFloat, Component, Enum, error, EventTouch, macro, Node, UIOpacity, UITransform, Vec2, Vec3, _decorator } from "cc";
|
|
||||||
import { Vec3Util } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/Vec3Util";
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 方向类型
|
|
||||||
*/
|
|
||||||
export enum DirectionType {
|
|
||||||
FOUR,
|
|
||||||
EIGHT,
|
|
||||||
ALL,
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 速度类型
|
|
||||||
*/
|
|
||||||
export enum SpeedType {
|
|
||||||
Start,
|
|
||||||
STOP,
|
|
||||||
NORMAL,
|
|
||||||
FAST,
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 摇杆类型
|
|
||||||
*/
|
|
||||||
export enum JoystickType {
|
|
||||||
FIXED,
|
|
||||||
FOLLOW,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface JoystickDataType {
|
|
||||||
/** 速度类型 */
|
|
||||||
type: SpeedType;
|
|
||||||
|
|
||||||
/** 移动向量 */
|
|
||||||
vector: Vec3;
|
|
||||||
|
|
||||||
/** 角度 */
|
|
||||||
angle: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export type ControllerFunc = (event: EventTouch, data: JoystickDataType) => void;
|
|
||||||
|
|
||||||
/** 摇杆 */
|
|
||||||
@ccclass("RoleViewUIJoystick")
|
|
||||||
export class RoleViewUIJoystick extends Component {
|
|
||||||
@property({
|
|
||||||
type: Node,
|
|
||||||
tooltip: "摇杆操纵点",
|
|
||||||
})
|
|
||||||
dot: Node | null = null;
|
|
||||||
|
|
||||||
@property({
|
|
||||||
type: Node,
|
|
||||||
tooltip: "摇杆背景节点",
|
|
||||||
})
|
|
||||||
ring: Node | null = null;
|
|
||||||
|
|
||||||
@property({
|
|
||||||
type: Enum(JoystickType),
|
|
||||||
tooltip: "触摸类型",
|
|
||||||
})
|
|
||||||
joystickType = JoystickType.FIXED;
|
|
||||||
|
|
||||||
@property({
|
|
||||||
type: Enum(DirectionType),
|
|
||||||
tooltip: "方向类型",
|
|
||||||
})
|
|
||||||
directionType = DirectionType.ALL;
|
|
||||||
|
|
||||||
@property({
|
|
||||||
tooltip: "摇杆所在位置"
|
|
||||||
})
|
|
||||||
_stickPos = new Vec3();
|
|
||||||
|
|
||||||
@property({
|
|
||||||
tooltip: "触摸位置"
|
|
||||||
})
|
|
||||||
_touchLocation = new Vec2();
|
|
||||||
|
|
||||||
@property({
|
|
||||||
type: CCFloat,
|
|
||||||
tooltip: "摇杆背景半径"
|
|
||||||
})
|
|
||||||
radius = -1;
|
|
||||||
|
|
||||||
onController: ControllerFunc | null = null;
|
|
||||||
|
|
||||||
onLoad() {
|
|
||||||
if (!this.dot) {
|
|
||||||
error("Joystick Dot is null!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.ring) {
|
|
||||||
error("Joystick Ring is null!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 摇杆背景半径
|
|
||||||
if (this.radius == -1)
|
|
||||||
this.radius = this.ring.getComponent(UITransform)!.width / 2;
|
|
||||||
|
|
||||||
// 摇杆跟随跟随时默认隐藏界面
|
|
||||||
const uiOpacity = this.node.getComponent(UIOpacity);
|
|
||||||
if (this.joystickType === JoystickType.FOLLOW && uiOpacity) {
|
|
||||||
uiOpacity.opacity = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._initTouchEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 改变摇杆类型
|
|
||||||
* @param type
|
|
||||||
*/
|
|
||||||
setJoystickType(type: JoystickType) {
|
|
||||||
this.joystickType = type;
|
|
||||||
const uiOpacity = this.node.getComponent(UIOpacity);
|
|
||||||
if (uiOpacity) {
|
|
||||||
uiOpacity.opacity = type === JoystickType.FIXED ? 255 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化触摸事件
|
|
||||||
*/
|
|
||||||
private _initTouchEvent() {
|
|
||||||
this.node.on(Node.EventType.TOUCH_START, this._touchStartEvent, this);
|
|
||||||
this.node.on(Node.EventType.TOUCH_MOVE, this._touchMoveEvent, this);
|
|
||||||
this.node.on(Node.EventType.TOUCH_END, this._touchEndEvent, this);
|
|
||||||
this.node.on(Node.EventType.TOUCH_CANCEL, this._touchEndEvent, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 触摸开始回调函数
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
private _touchStartEvent(event: EventTouch) {
|
|
||||||
if (!this.ring || !this.dot) return;
|
|
||||||
|
|
||||||
if (this.onController) {
|
|
||||||
this.onController(event, {
|
|
||||||
type: SpeedType.Start,
|
|
||||||
vector: Vec3Util.zero,
|
|
||||||
angle: 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const location = event.getUILocation();
|
|
||||||
const touchPos = new Vec3(location.x, location.y);
|
|
||||||
|
|
||||||
if (this.joystickType === JoystickType.FIXED) {
|
|
||||||
this._stickPos = this.ring.getWorldPosition();
|
|
||||||
|
|
||||||
// 相对中心的向量
|
|
||||||
const moveVec = touchPos.subtract(this.ring.getWorldPosition());
|
|
||||||
// 触摸点与圆圈中心的距离
|
|
||||||
const distance = moveVec.length();
|
|
||||||
|
|
||||||
// 手指在圆圈内触摸,控杆跟随触摸点
|
|
||||||
if (this.radius > distance) {
|
|
||||||
this.dot.setPosition(moveVec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (this.joystickType === JoystickType.FOLLOW) {
|
|
||||||
// 记录摇杆位置,给 touch move 使用
|
|
||||||
this.node.getComponent(UIOpacity)!.opacity = 255;
|
|
||||||
this._stickPos = touchPos;
|
|
||||||
this._touchLocation = event.getUILocation();
|
|
||||||
// 更改摇杆的位置
|
|
||||||
|
|
||||||
this.ring.setWorldPosition(touchPos);
|
|
||||||
this.dot.setPosition(Vec3.ZERO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 触摸移动回调函数
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
private _touchMoveEvent(event: EventTouch) {
|
|
||||||
if (!this.dot || !this.ring) return;
|
|
||||||
|
|
||||||
// 如果 touch start 位置和 touch move 相同,禁止移动
|
|
||||||
if (this.joystickType === JoystickType.FOLLOW && this._touchLocation === event.getUILocation()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 以圆圈为锚点获取触摸坐标
|
|
||||||
const location = event.getUILocation();
|
|
||||||
const touchPos = new Vec3(location.x, location.y);
|
|
||||||
|
|
||||||
// 移动向量
|
|
||||||
const moveVec = touchPos.subtract(this.ring.getWorldPosition());
|
|
||||||
const distance = moveVec.length();
|
|
||||||
|
|
||||||
let speedType = SpeedType.NORMAL;
|
|
||||||
if (this.radius > distance) {
|
|
||||||
this.dot.setPosition(moveVec);
|
|
||||||
speedType = SpeedType.NORMAL;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// 控杆永远保持在圈内,并在圈内跟随触摸更新角度
|
|
||||||
this.dot.setPosition(moveVec.normalize().multiplyScalar(this.radius));
|
|
||||||
speedType = SpeedType.FAST;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 算出与(1,0)的夹角
|
|
||||||
let angle = this.covertToAngle(moveVec);
|
|
||||||
|
|
||||||
if (this.onController) {
|
|
||||||
this.onController(event, {
|
|
||||||
type: speedType,
|
|
||||||
vector: moveVec.normalize(),
|
|
||||||
angle
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 根据位置转化角度 */
|
|
||||||
private covertToAngle(pos: Vec3) {
|
|
||||||
let angle = Math.atan2(pos.y, pos.x);
|
|
||||||
return angle * macro.DEG;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 触摸结束回调函数
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
private _touchEndEvent(event: EventTouch) {
|
|
||||||
if (!this.dot || !this.ring) return;
|
|
||||||
|
|
||||||
this.dot.setPosition(new Vec3());
|
|
||||||
if (this.joystickType === JoystickType.FOLLOW) {
|
|
||||||
this.node.getComponent(UIOpacity)!.opacity = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.onController) {
|
|
||||||
this.onController(event, {
|
|
||||||
type: SpeedType.STOP,
|
|
||||||
vector: Vec3Util.zero,
|
|
||||||
angle: 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "472d9967-6ca2-4293-b18d-b056a5a82fec",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "b3bb384b-5a96-4e00-a5f8-29bd621bdf99",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"compressionType": {},
|
|
||||||
"isRemoteBundle": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
|||||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
import { BoxSet } from "../common/config/BoxSet";
|
import { BoxSet } from "../common/config/BoxSet";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
|
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ export class SkillCom extends CCComp {
|
|||||||
is_destroy:boolean = false;
|
is_destroy:boolean = false;
|
||||||
box_group:number = 0;
|
box_group:number = 0;
|
||||||
box_tag:number=0;
|
box_tag:number=0;
|
||||||
|
time:Timer = new Timer(0.01);
|
||||||
start() {
|
start() {
|
||||||
this.node.active=true
|
this.node.active=true
|
||||||
this.node.angle = this.angle;
|
this.node.angle = this.angle;
|
||||||
@@ -45,12 +47,10 @@ export class SkillCom extends CCComp {
|
|||||||
tween(this.node).to( 1,{ angle:this.angle,position: this.t_pos},
|
tween(this.node).to( 1,{ angle:this.angle,position: this.t_pos},
|
||||||
{
|
{
|
||||||
onUpdate: (target: Vec3, ratio: number) => { // onUpdate 接受当前缓动的进度
|
onUpdate: (target: Vec3, ratio: number) => { // onUpdate 接受当前缓动的进度
|
||||||
if(target.y <= 200 ){
|
// 将缓动系统计算出的结果赋予 node 的位置
|
||||||
this.toDestroy()
|
|
||||||
} // 将缓动系统计算出的结果赋予 node 的位置
|
|
||||||
},
|
},
|
||||||
onComplete: (target?: object) => {
|
onComplete: (target?: object) => {
|
||||||
this.toDestroy()
|
this.is_destroy=true
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
).start();
|
).start();
|
||||||
@@ -59,7 +59,7 @@ export class SkillCom extends CCComp {
|
|||||||
{ position: new Vec3(this.node.position.x+this.scale*this.dis,this.node.position.y) },
|
{ position: new Vec3(this.node.position.x+this.scale*this.dis,this.node.position.y) },
|
||||||
{
|
{
|
||||||
onComplete: (target?: object) => {
|
onComplete: (target?: object) => {
|
||||||
this.toDestroy()
|
this.is_destroy=true
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
).start();
|
).start();
|
||||||
@@ -68,10 +68,8 @@ export class SkillCom extends CCComp {
|
|||||||
}
|
}
|
||||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||||
if(otherCollider.group != selfCollider.group){
|
if(otherCollider.group != selfCollider.group){
|
||||||
console.log("skill end contact",selfCollider.group,otherCollider.group)
|
// console.log("skill end contact",selfCollider.group,otherCollider.group)
|
||||||
setTimeout(() => {
|
this.is_destroy=true
|
||||||
this.toDestroy()
|
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||||
@@ -104,24 +102,18 @@ export class SkillCom extends CCComp {
|
|||||||
update(deltaTime: number) {
|
update(deltaTime: number) {
|
||||||
// this.node.setScale(v3(this.scale,this.node.scale.y,this.node.scale.z))
|
// this.node.setScale(v3(this.scale,this.node.scale.y,this.node.scale.z))
|
||||||
// this.move(deltaTime)
|
// this.move(deltaTime)
|
||||||
|
this.toDestroy()
|
||||||
|
|
||||||
}
|
}
|
||||||
move(dt: number) {
|
move(dt: number) {
|
||||||
// this.node.setPosition(v3(this.node.position.x+dt*this.x_speed*this.scale,this.node.position.y+this.y_speed,this.node.position.z))
|
// this.node.setPosition(v3(this.node.position.x+dt*this.x_speed*this.scale,this.node.position.y+this.y_speed,this.node.position.z))
|
||||||
}
|
}
|
||||||
check_to_destroy(){
|
|
||||||
if(!this.is_destroy){
|
|
||||||
this.is_destroy = true;
|
|
||||||
this.toDestroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toDestroy() {
|
toDestroy() {
|
||||||
if(!this.is_destroy){
|
if(this.is_destroy){
|
||||||
this.is_destroy = true;
|
|
||||||
if(this.node.isValid) this.ent.destroy()
|
if(this.node.isValid) this.ent.destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||||
reset() {
|
reset() {
|
||||||
this.is_destroy=false
|
this.is_destroy=false
|
||||||
|
|||||||
Reference in New Issue
Block a user