demo逻辑调整

This commit is contained in:
gongxh
2025-10-03 18:56:49 +08:00
parent 249022a300
commit b20cf3fd41
21 changed files with 5608 additions and 706 deletions

9
bt-demo/assets/res.meta Normal file
View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "de9afb2e-952c-4e0b-96df-cc676989bed9",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "d5a536b5-db1b-42ac-8654-5f6a81341c3a",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,286 @@
spineboy-pro.png
size: 1534,529
format: RGBA8888
filter: Linear,Linear
repeat: none
crosshair
rotate: false
xy: 449, 18
size: 89, 89
orig: 89, 89
offset: 0, 0
index: -1
eye-indifferent
rotate: false
xy: 695, 10
size: 93, 89
orig: 93, 89
offset: 0, 0
index: -1
eye-surprised
rotate: true
xy: 985, 178
size: 93, 89
orig: 93, 89
offset: 0, 0
index: -1
front-bracer
rotate: true
xy: 1407, 103
size: 58, 80
orig: 58, 80
offset: 0, 0
index: -1
front-fist-closed
rotate: true
xy: 1208, 203
size: 75, 82
orig: 75, 82
offset: 0, 0
index: -1
front-fist-open
rotate: false
xy: 989, 89
size: 86, 87
orig: 86, 87
offset: 0, 0
index: -1
front-foot
rotate: false
xy: 1077, 58
size: 126, 69
orig: 126, 69
offset: 0, 0
index: -1
front-shin
rotate: true
xy: 803, 89
size: 82, 184
orig: 82, 184
offset: 0, 0
index: -1
front-thigh
rotate: true
xy: 1062, 11
size: 45, 112
orig: 45, 112
offset: 0, 0
index: -1
front-upper-arm
rotate: true
xy: 1205, 33
size: 46, 97
orig: 46, 97
offset: 0, 0
index: -1
goggles
rotate: false
xy: 540, 101
size: 261, 166
orig: 261, 166
offset: 0, 0
index: -1
gun
rotate: false
xy: 1301, 324
size: 209, 203
orig: 210, 203
offset: 0, 0
index: -1
head
rotate: false
xy: 2, 75
size: 271, 298
orig: 271, 298
offset: 0, 0
index: -1
hoverboard-board
rotate: false
xy: 2, 375
size: 492, 152
orig: 492, 152
offset: 0, 0
index: -1
hoverboard-thruster
rotate: false
xy: 1472, 38
size: 60, 63
orig: 60, 64
offset: 0, 0
index: -1
hoverglow-small
rotate: false
xy: 2, 2
size: 258, 71
orig: 274, 75
offset: 7, 2
index: -1
mouth-grind
rotate: false
xy: 1203, 142
size: 93, 59
orig: 93, 59
offset: 0, 0
index: -1
mouth-oooo
rotate: false
xy: 1205, 81
size: 93, 59
orig: 93, 59
offset: 0, 0
index: -1
mouth-smile
rotate: false
xy: 1300, 98
size: 93, 59
orig: 93, 59
offset: 0, 0
index: -1
muzzle-glow
rotate: false
xy: 496, 485
size: 42, 42
orig: 50, 50
offset: 4, 4
index: -1
muzzle-ring
rotate: true
xy: 1301, 276
size: 46, 206
orig: 49, 209
offset: 1, 2
index: -1
muzzle01
rotate: false
xy: 1077, 129
size: 124, 74
orig: 133, 79
offset: 3, 2
index: -1
muzzle02
rotate: false
xy: 934, 12
size: 126, 75
orig: 135, 84
offset: 4, 5
index: -1
muzzle03
rotate: false
xy: 540, 6
size: 153, 93
orig: 166, 106
offset: 7, 7
index: -1
muzzle04
rotate: false
xy: 790, 5
size: 142, 82
orig: 149, 90
offset: 4, 4
index: -1
muzzle05
rotate: false
xy: 1076, 205
size: 130, 73
orig: 135, 75
offset: 2, 1
index: -1
neck
rotate: false
xy: 1489, 120
size: 35, 41
orig: 36, 41
offset: 0, 0
index: -1
portal-bg
rotate: false
xy: 275, 109
size: 263, 264
orig: 266, 266
offset: 2, 1
index: -1
portal-flare1
rotate: false
xy: 1407, 163
size: 103, 54
orig: 111, 60
offset: 4, 3
index: -1
portal-flare2
rotate: false
xy: 1407, 219
size: 107, 55
orig: 114, 61
offset: 4, 3
index: -1
portal-flare3
rotate: false
xy: 1298, 159
size: 107, 53
orig: 115, 59
offset: 5, 3
index: -1
portal-shade
rotate: false
xy: 540, 269
size: 258, 258
orig: 266, 266
offset: 4, 4
index: -1
portal-streaks1
rotate: false
xy: 800, 273
size: 249, 254
orig: 252, 256
offset: 1, 1
index: -1
portal-streaks2
rotate: false
xy: 1051, 280
size: 248, 247
orig: 250, 249
offset: 1, 1
index: -1
rear-bracer
rotate: true
xy: 1400, 46
size: 55, 70
orig: 56, 72
offset: 0, 2
index: -1
rear-foot
rotate: false
xy: 1292, 214
size: 113, 60
orig: 113, 60
offset: 0, 0
index: -1
rear-shin
rotate: true
xy: 275, 33
size: 74, 172
orig: 75, 178
offset: 1, 4
index: -1
rear-thigh
rotate: true
xy: 1304, 41
size: 55, 94
orig: 55, 94
offset: 0, 0
index: -1
rear-upper-arm
rotate: false
xy: 496, 396
size: 40, 87
orig: 40, 87
offset: 0, 0
index: -1
torso
rotate: true
xy: 803, 173
size: 98, 180
orig: 98, 180
offset: 0, 0
index: -1

View File

@@ -0,0 +1,12 @@
{
"ver": "1.0.0",
"importer": "*",
"imported": true,
"uuid": "e6a17488-4c37-468e-bf09-a613cf272d3e",
"files": [
".atlas",
".json"
],
"subMetas": {},
"userData": {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.2.7",
"importer": "spine-data",
"imported": true,
"uuid": "39a7d8cd-533a-479a-b909-9575bf720338",
"files": [
".json"
],
"subMetas": {},
"userData": {
"atlasUuid": "e6a17488-4c37-468e-bf09-a613cf272d3e"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 KiB

View File

@@ -0,0 +1,42 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "74f9105a-c38b-4f5b-b7f2-f59cc6374074",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "74f9105a-c38b-4f5b-b7f2-f59cc6374074@6c48a",
"displayName": "spineboy-pro",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "74f9105a-c38b-4f5b-b7f2-f59cc6374074",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "texture",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "74f9105a-c38b-4f5b-b7f2-f59cc6374074@6c48a"
}
}

View File

@@ -1,45 +1,132 @@
{ {
"bt-tree1": [ "bt-tree1": [
{ {
"id": "1759472794685_3awlwerqg", "id": "1759488688188_qejfcso50",
"className": "MemSelector", "className": "Selector",
"parameters": {}, "parameters": {},
"children": [ "children": [
"1759472800995_k3q8rx02h", "1759488707759_2bmdm1fqt",
"1759472799864_nait7thja", "1759488725107_v8u160t95",
"1759472798713_ay9jxznr4", "1759488737637_axpz9aqaz",
"1759472797759_gu3y8p1um" "1759482034741_cf3mqaqdj"
] ]
}, },
{ {
"id": "1759472797759_gu3y8p1um", "id": "1759479318405_bptb8ltcp",
"className": "Inverter",
"parameters": {},
"children": []
},
{
"id": "1759472798713_ay9jxznr4",
"className": "LimitTime", "className": "LimitTime",
"parameters": { "parameters": {
"_max": 1 "_max": 2
},
"children": [
"1758089736854_t55n54hkh"
]
},
{
"id": "1759479295671_jflit2ek8",
"className": "LimitTime",
"parameters": {
"_max": 2
},
"children": [
"1758089659917_vjumiu9hy"
]
},
{
"id": "1758089659917_vjumiu9hy",
"className": "BTAnimation",
"parameters": {
"_name": "walk",
"_loop": true
}, },
"children": [] "children": []
}, },
{ {
"id": "1759472799864_nait7thja", "id": "1758089736854_t55n54hkh",
"className": "LimitTicks", "className": "BTAnimation",
"parameters": { "parameters": {
"_max": 1 "_name": "run",
"_loop": true
}, },
"children": [] "children": []
}, },
{ {
"id": "1759472800995_k3q8rx02h", "id": "1758089757615_dp9tw9ka1",
"className": "Repeat", "className": "BTAnimation",
"parameters": { "parameters": {
"_max": 1 "_name": "jump",
"_loop": false
}, },
"children": [] "children": []
},
{
"id": "1759478407706_w30m4btux",
"className": "BTAnimation",
"parameters": {
"_name": "idle",
"_loop": true
},
"children": []
},
{
"id": "1759481172259_xou25wj2n",
"className": "BTConditionRandom",
"parameters": {
"_value": 0.3
},
"children": []
},
{
"id": "1759481282875_5orqavi5y",
"className": "BTConditionRandom",
"parameters": {
"_value": 0.4
},
"children": []
},
{
"id": "1759481307863_ja6q4q9bz",
"className": "BTConditionRandom",
"parameters": {
"_value": 0.3
},
"children": []
},
{
"id": "1759482034741_cf3mqaqdj",
"className": "LimitTime",
"parameters": {
"_max": 3
},
"children": [
"1759478407706_w30m4btux"
]
},
{
"id": "1759488707759_2bmdm1fqt",
"className": "Sequence",
"parameters": {},
"children": [
"1759481172259_xou25wj2n",
"1759479295671_jflit2ek8"
]
},
{
"id": "1759488725107_v8u160t95",
"className": "Sequence",
"parameters": {},
"children": [
"1759481282875_5orqavi5y",
"1759479318405_bptb8ltcp"
]
},
{
"id": "1759488737637_axpz9aqaz",
"className": "Sequence",
"parameters": {},
"children": [
"1759481307863_ja6q4q9bz",
"1758089757615_dp9tw9ka1"
]
} }
], ],
"bt-tree2": [ "bt-tree2": [
@@ -48,122 +135,14 @@
"className": "MemSequence", "className": "MemSequence",
"parameters": {}, "parameters": {},
"children": [ "children": [
"1758005578560_0b1kuefo0", "1758090634327_mf36nwkdt"
"node_1757926547913_xilg11ei7",
"1757931183149_eeuq44vs0"
] ]
}, },
{ {
"id": "node_1757926547913_xilg11ei7", "id": "1758090634327_mf36nwkdt",
"className": "MemSelector",
"parameters": {},
"children": [
"node_1757926550855_1hqcmi43w",
"node_1757926555912_18vbde5fp",
"1757930584200_cf9rez1qg",
"1757931171553_a3afal936"
]
},
{
"id": "node_1757926550855_1hqcmi43w",
"className": "WaitTicks",
"parameters": {
"_max": 2
},
"children": []
},
{
"id": "node_1757926555912_18vbde5fp",
"className": "WaitTime",
"parameters": {
"_max": 1
},
"children": []
},
{
"id": "1757930584200_cf9rez1qg",
"className": "Inverter",
"parameters": {},
"children": [
"1757930606484_dbsf9bsu2"
]
},
{
"id": "1757930606484_dbsf9bsu2",
"className": "WaitTicks",
"parameters": {
"_max": 0
},
"children": []
},
{
"id": "1757931171553_a3afal936",
"className": "WaitTicks",
"parameters": {
"_max": 0
},
"children": []
},
{
"id": "1757931183149_eeuq44vs0",
"className": "LimitTicks",
"parameters": {
"_max": 1
},
"children": []
},
{
"id": "1758005570308_u6yo43u3b",
"className": "MemSelector",
"parameters": {},
"children": [
"1758005574101_v4xhs2jo8"
]
},
{
"id": "1758005572265_dl9lxnrki",
"className": "MemSequence",
"parameters": {},
"children": [
"1758005575213_obgfw5q7p"
]
},
{
"id": "1758005574101_v4xhs2jo8",
"className": "Selector", "className": "Selector",
"parameters": {}, "parameters": {},
"children": [
"1758005576340_c8xf5bdhp"
]
},
{
"id": "1758005575213_obgfw5q7p",
"className": "RandomSelector",
"parameters": {},
"children": [
"1758005577367_tw24xyxop"
]
},
{
"id": "1758005576340_c8xf5bdhp",
"className": "Sequence",
"parameters": {},
"children": [] "children": []
},
{
"id": "1758005577367_tw24xyxop",
"className": "Parallel",
"parameters": {},
"children": []
},
{
"id": "1758005578560_0b1kuefo0",
"className": "ParallelAnySuccess",
"parameters": {},
"children": [
"1758005570308_u6yo43u3b",
"1758005572265_dl9lxnrki"
]
} }
] ]
} }

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "6b9b2da1-08c2-4c40-ab35-e7cb5bb30872",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,147 @@
[
{
"__type__": "cc.Prefab",
"_name": "spineboy",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "spineboy",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 4
}
],
"_prefab": {
"__id__": 6
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -1000
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.3,
"y": 0.3,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 3
},
"_contentSize": {
"__type__": "cc.Size",
"width": 419.8399963378906,
"height": 686.0800170898438
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.45412539378136013,
"y": 0.011660447470739235
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "dfVeZdqm9E15k7OBD615QP"
},
{
"__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__": "39a7d8cd-533a-479a-b909-9575bf720338",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "jump",
"_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": "deHPJ9jpdJZq/2PP1E2haI"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "fcg4LyhU9MpITaQy7lW8Ru",
"instance": null,
"targetOverrides": null
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "610db270-416d-42a9-a228-67b0fe1beee4",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "spineboy"
}
}

View File

@@ -23,7 +23,7 @@
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 15 "__id__": 22
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -54,7 +54,7 @@
}, },
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 16 "__id__": 25
}, },
"_id": "bef93422-3e63-4c0f-a5cf-d926e7360673" "_id": "bef93422-3e63-4c0f-a5cf-d926e7360673"
}, },
@@ -69,18 +69,24 @@
"_children": [ "_children": [
{ {
"__id__": 3 "__id__": 3
},
{
"__id__": 6
},
{
"__id__": 8
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 12 "__id__": 19
}, },
{ {
"__id__": 13 "__id__": 20
}, },
{ {
"__id__": 14 "__id__": 21
} }
], ],
"_prefab": null, "_prefab": null,
@@ -113,6 +119,93 @@
}, },
"_id": "beI88Z2HpFELqR4T5EMHpg" "_id": "beI88Z2HpFELqR4T5EMHpg"
}, },
{
"__type__": "cc.Node",
"_name": "entry",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
},
{
"__id__": 5
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 1000
},
"_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": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "6eSMYbFu9DJL1bKl9DnMo6"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "8ekQXh8+BP/6BzVmjL7OPr"
},
{
"__type__": "e5804qewX9N9op0d4aH4r7B",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": null,
"skeleton": null,
"btConfig": {
"__uuid__": "c8aeef5d-6d0e-4093-848e-7d8f1ca30261",
"__expectedType__": "cc.JsonAsset"
},
"_id": "69LhmWaZRIUpmYvdiN82Ha"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Camera", "_name": "Camera",
@@ -121,18 +214,11 @@
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [ "_children": [],
{
"__id__": 4
},
{
"__id__": 7
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 11 "__id__": 7
} }
], ],
"_prefab": null, "_prefab": null,
@@ -165,234 +251,13 @@
}, },
"_id": "ebFwiq8gBFaYpqYbdoDODe" "_id": "ebFwiq8gBFaYpqYbdoDODe"
}, },
{
"__type__": "cc.Node",
"_name": "touch",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 3
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 5
},
{
"__id__": 6
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -1000
},
"_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": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "77ynXZOUlAmZhaA9QBApfI"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 4
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 750,
"height": 1334
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "44ewOBJMBKwauq6v9Ikv2U"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 4
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 18,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 1.1368683772161603e-13,
"_bottom": 1.1368683772161603e-13,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 750,
"_originalHeight": 1334,
"_alignMode": 2,
"_lockFlags": 18,
"_id": "81c6EXUVxA0IMliXVVpGt0"
},
{
"__type__": "cc.Node",
"_name": "stage",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 3
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -1000
},
"_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": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "61IfeQ6J5Kpp0fCcAF/VJO"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "f2tzcWDiBNNKKrnPd07n/y"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 18,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 18,
"_id": "0f+BSXru9DValkOkklwcLG"
},
{
"__type__": "e5804qewX9N9op0d4aH4r7B",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"stage": {
"__id__": 7
},
"touchNode": {
"__id__": 4
},
"_id": "aef3WWUq5ARp6kYDQOuKMM"
},
{ {
"__type__": "cc.Camera", "__type__": "cc.Camera",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 3 "__id__": 6
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@@ -432,6 +297,149 @@
"_trackingType": 0, "_trackingType": 0,
"_id": "63WIch3o5BEYRlXzTT0oWc" "_id": "63WIch3o5BEYRlXzTT0oWc"
}, },
{
"__type__": "cc.Node",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_prefab": {
"__id__": 9
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 8
},
"asset": {
"__uuid__": "610db270-416d-42a9-a228-67b0fe1beee4",
"__expectedType__": "cc.Prefab"
},
"fileId": "fcg4LyhU9MpITaQy7lW8Ru",
"instance": {
"__id__": 10
},
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "2eYzhZYv5Mi5OETcYel3W3",
"prefabRootNode": null,
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 11
},
{
"__id__": 13
},
{
"__id__": 14
},
{
"__id__": 15
},
{
"__id__": 16
},
{
"__id__": 18
}
],
"removedComponents": []
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 12
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"fcg4LyhU9MpITaQy7lW8Ru"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 12
},
"propertyPath": [
"_name"
],
"value": "spineboy"
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 12
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 12
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 17
},
"propertyPath": [
"defaultAnimation"
],
"value": "idle"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"deHPJ9jpdJZq/2PP1E2haI"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 17
},
"propertyPath": [
"_premultipliedAlpha"
],
"value": true
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -465,7 +473,7 @@
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"_cameraComponent": { "_cameraComponent": {
"__id__": 11 "__id__": 7
}, },
"_alignCanvasWithScreen": true, "_alignCanvasWithScreen": true,
"_id": "12O/ljcVlEqLmVm3U2gEOQ" "_id": "12O/ljcVlEqLmVm3U2gEOQ"
@@ -506,33 +514,64 @@
"asset": null, "asset": null,
"fileId": "bef93422-3e63-4c0f-a5cf-d926e7360673", "fileId": "bef93422-3e63-4c0f-a5cf-d926e7360673",
"instance": null, "instance": null,
"targetOverrides": null "targetOverrides": [
{
"__id__": 23
}
],
"nestedPrefabInstanceRoots": [
{
"__id__": 8
}
]
},
{
"__type__": "cc.TargetOverrideInfo",
"source": {
"__id__": 5
},
"sourceInfo": null,
"propertyPath": [
"skeleton"
],
"target": {
"__id__": 8
},
"targetInfo": {
"__id__": 24
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"deHPJ9jpdJZq/2PP1E2haI"
]
}, },
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.SceneGlobals",
"ambient": { "ambient": {
"__id__": 17 "__id__": 26
}, },
"shadows": { "shadows": {
"__id__": 18 "__id__": 27
}, },
"_skybox": { "_skybox": {
"__id__": 19 "__id__": 28
}, },
"fog": { "fog": {
"__id__": 20 "__id__": 29
}, },
"octree": { "octree": {
"__id__": 21 "__id__": 30
}, },
"skin": { "skin": {
"__id__": 22 "__id__": 31
}, },
"lightProbeInfo": { "lightProbeInfo": {
"__id__": 23 "__id__": 32
}, },
"postSettings": { "postSettings": {
"__id__": 24 "__id__": 33
}, },
"bakedWithStationaryMainLight": false, "bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false "bakedWithHighpLightmap": false

View File

@@ -0,0 +1,72 @@
/**
* @Author: Gongxh
* @Date: 2025-09-17
* @Description: 定义一些行为节点
*/
import { sp } from "cc";
import { BT } from "./Header";
@BT.ActionNode("BTAnimation", { name: "播放动画", group: "动画", desc: "通过动画名播放动画,播放完成后返回成功" })
export class BTAnimation extends BT.LeafNode {
@BT.prop({ type: BT.ParamType.string, description: "动画名" })
private _name: string = "";
@BT.prop({ type: BT.ParamType.bool, description: "是否循环" })
private _loop: boolean = false;
private _complete: boolean = false;
protected open(): void {
super.open();
this._complete = false;
console.log("open", this._name, this._loop);
let skeleton = this.getEntity<sp.Skeleton>();
skeleton.setAnimation(0, this._name, this._loop);
if (!this._loop) {
skeleton.setCompleteListener(() => {
this._complete = true;
});
}
}
public tick(): BT.Status {
if (!this._loop && this._complete) {
return BT.Status.SUCCESS;
}
return BT.Status.RUNNING;
}
protected close(): void {
super.close();
console.log("close", this._name, this._loop);
}
}
/** 条件节点 */
@BT.ConditionNode("BTConditionRandom", { name: "随机条件节点", group: "基础条件节点", desc: "随机0-1的值大于设置值返回成功否则返回失败" })
export class BTConditionRandom extends BT.Condition {
@BT.prop({ type: BT.ParamType.float, description: "值", defaultValue: 0.5 })
private _value: number = 0.5;
public isEligible(): boolean {
return Math.random() > this._value;
}
}
/** 条件装饰节点 */
@BT.DecoratorNode("BTCondition", { name: "条件装饰节点", group: "基础装饰节点", desc: "随机0-1的值大于设置值返回成功否则返回失败" })
export class BTCondition extends BT.ConditionDecorator {
@BT.prop({ type: BT.ParamType.float, description: "值" })
private _value: number = 0.5;
public isEligible(): boolean {
return Math.random() > this._value;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "6c8cc47c-1976-432a-aa59-932cb74f41a2",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,20 +1,23 @@
import { _decorator, Component, Node } from 'cc'; import { _decorator, Component, JsonAsset, sp } from 'cc';
import * as BT from "kunpocc-behaviortree"; import { BT } from './Header';
const { ccclass, property, menu } = _decorator; const { ccclass, property, menu } = _decorator;
@ccclass("GameEntry") @ccclass("GameEntry")
@menu("kunpo/GameEntry") @menu("kunpo/GameEntry")
export class GameEntry extends Component { export class GameEntry extends Component {
@property(Node) @property(sp.Skeleton)
private stage: Node = null; private skeleton: sp.Skeleton = null;
@property(Node) @property(JsonAsset)
private touchNode: Node = null; private btConfig: JsonAsset = null;
private _tree: BT.BehaviorTree<sp.Skeleton> = null;
start(): void { start(): void {
BT console.log("btConfig", this.btConfig);
let btTree1: BT.INodeConfig[] = this.btConfig.json["bt-tree1"]
this._tree = BT.createBehaviorTree(btTree1, this.skeleton);
} }
protected update(dt: number): void { protected update(dt: number): void {
this._tree.tick(dt);
} }
} }

View File

@@ -0,0 +1,9 @@
/**
* @Author: Gongxh
* @Date: 2025-09-17
* @Description: 头文件
*/
import * as BT from "kunpocc-behaviortree";
export { BT };

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "17dd8d23-3e47-454a-9e47-69e371273e3b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -3,98 +3,298 @@
"description": "", "description": "",
"nodes": [ "nodes": [
{ {
"id": "1759472794685_3awlwerqg", "id": "1759488688188_qejfcso50",
"className": "MemSelector", "className": "Selector",
"name": "记忆选择节点", "name": "选择节点",
"position": { "position": {
"x": -60, "x": -60,
"y": -200 "y": -200
}, },
"parameters": {}, "parameters": {},
"children": [ "children": [
"1759472800995_k3q8rx02h", "1759488707759_2bmdm1fqt",
"1759472799864_nait7thja", "1759488725107_v8u160t95",
"1759472798713_ay9jxznr4", "1759488737637_axpz9aqaz",
"1759472797759_gu3y8p1um" "1759482034741_cf3mqaqdj"
] ],
"alias": "根节点"
}, },
{ {
"id": "1759472797759_gu3y8p1um", "id": "1759479318405_bptb8ltcp",
"className": "Inverter",
"name": "反转器",
"position": {
"x": 160,
"y": -80
},
"parameters": {},
"children": []
},
{
"id": "1759472798713_ay9jxznr4",
"className": "LimitTime", "className": "LimitTime",
"name": "时间限制器", "name": "时间限制器",
"position": { "position": {
"x": 20, "x": -40,
"y": -80 "y": 40
}, },
"parameters": { "parameters": {
"_max": 1 "_max": 2
},
"children": [
"1758089736854_t55n54hkh"
]
},
{
"id": "1759479295671_jflit2ek8",
"className": "LimitTime",
"name": "时间限制器",
"position": {
"x": -360,
"y": 40
},
"parameters": {
"_max": 2
},
"children": [
"1758089659917_vjumiu9hy"
]
},
{
"id": "1758089659917_vjumiu9hy",
"className": "BTAnimation",
"name": "播放动画",
"position": {
"x": -360,
"y": 160
},
"parameters": {
"_name": "walk",
"_loop": true
}, },
"children": [] "children": []
}, },
{ {
"id": "1759472799864_nait7thja", "id": "1758089736854_t55n54hkh",
"className": "LimitTicks", "className": "BTAnimation",
"name": "次数限制器", "name": "播放动画",
"position": {
"x": -40,
"y": 160
},
"parameters": {
"_name": "run",
"_loop": true
},
"children": []
},
{
"id": "1758089757615_dp9tw9ka1",
"className": "BTAnimation",
"name": "播放动画",
"position": {
"x": 260,
"y": 40
},
"parameters": {
"_name": "jump",
"_loop": false
},
"children": []
},
{
"id": "1759478407706_w30m4btux",
"className": "BTAnimation",
"name": "播放动画",
"position": {
"x": 420,
"y": 40
},
"parameters": {
"_name": "idle",
"_loop": true
},
"children": []
},
{
"id": "1759481172259_xou25wj2n",
"className": "BTConditionRandom",
"name": "随机条件节点",
"position": {
"x": -520,
"y": 40
},
"parameters": {
"_value": 0.3
},
"children": []
},
{
"id": "1759481282875_5orqavi5y",
"className": "BTConditionRandom",
"name": "随机条件节点",
"position": {
"x": -200,
"y": 40
},
"parameters": {
"_value": 0.4
},
"children": []
},
{
"id": "1759481307863_ja6q4q9bz",
"className": "BTConditionRandom",
"name": "随机条件节点",
"position": {
"x": 120,
"y": 40
},
"parameters": {
"_value": 0.3
},
"children": []
},
{
"id": "1759482034741_cf3mqaqdj",
"className": "LimitTime",
"name": "时间限制器",
"position": {
"x": 420,
"y": -80
},
"parameters": {
"_max": 3
},
"children": [
"1759478407706_w30m4btux"
],
"alias": "待机动画"
},
{
"id": "1759488707759_2bmdm1fqt",
"className": "Sequence",
"name": "顺序节点",
"position": {
"x": -440,
"y": -80
},
"parameters": {},
"children": [
"1759481172259_xou25wj2n",
"1759479295671_jflit2ek8"
],
"alias": "行走动画分支"
},
{
"id": "1759488725107_v8u160t95",
"className": "Sequence",
"name": "顺序节点",
"position": { "position": {
"x": -120, "x": -120,
"y": -80 "y": -80
}, },
"parameters": { "parameters": {},
"_max": 1 "children": [
}, "1759481282875_5orqavi5y",
"children": [] "1759479318405_bptb8ltcp"
],
"alias": "奔跑动画分支"
}, },
{ {
"id": "1759472800995_k3q8rx02h", "id": "1759488737637_axpz9aqaz",
"className": "Repeat", "className": "Sequence",
"name": "重复节点", "name": "顺序节点",
"position": { "position": {
"x": -260, "x": 180,
"y": -80 "y": -80
}, },
"parameters": { "parameters": {},
"_max": 1 "children": [
}, "1759481307863_ja6q4q9bz",
"children": [] "1758089757615_dp9tw9ka1"
],
"alias": "跳跃动画分支"
} }
], ],
"connections": [ "connections": [
{ {
"id": "conn_1759472802506_ojduz0zog", "id": "conn_1759479306749_wnwlz1638",
"sourceNodeId": "1759472794685_3awlwerqg", "sourceNodeId": "1759479295671_jflit2ek8",
"targetNodeId": "1759472800995_k3q8rx02h", "targetNodeId": "1758089659917_vjumiu9hy",
"sourcePointType": "child", "sourcePointType": "child",
"targetPointType": "parent" "targetPointType": "parent"
}, },
{ {
"id": "conn_1759472803849_dk7zwd0xt", "id": "conn_1759479325803_ln42r7198",
"sourceNodeId": "1759472794685_3awlwerqg", "sourceNodeId": "1759479318405_bptb8ltcp",
"targetNodeId": "1759472799864_nait7thja", "targetNodeId": "1758089736854_t55n54hkh",
"sourcePointType": "child", "sourcePointType": "child",
"targetPointType": "parent" "targetPointType": "parent"
}, },
{ {
"id": "conn_1759472807533_unxo9p2b0", "id": "conn_1759482041141_ok8gnqp0o",
"sourceNodeId": "1759472794685_3awlwerqg", "sourceNodeId": "1759482034741_cf3mqaqdj",
"targetNodeId": "1759472798713_ay9jxznr4", "targetNodeId": "1759478407706_w30m4btux",
"sourcePointType": "child", "sourcePointType": "child",
"targetPointType": "parent" "targetPointType": "parent"
}, },
{ {
"id": "conn_1759472809481_l9rcrno3b", "id": "conn_1759488698126_dou7vxvo0",
"sourceNodeId": "1759472794685_3awlwerqg", "sourceNodeId": "1759488688188_qejfcso50",
"targetNodeId": "1759472797759_gu3y8p1um", "targetNodeId": "1759482034741_cf3mqaqdj",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488712210_gn0eom3zv",
"sourceNodeId": "1759488688188_qejfcso50",
"targetNodeId": "1759488707759_2bmdm1fqt",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488719553_mag45k9dx",
"sourceNodeId": "1759488707759_2bmdm1fqt",
"targetNodeId": "1759481172259_xou25wj2n",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488720799_ksfwij12z",
"sourceNodeId": "1759488707759_2bmdm1fqt",
"targetNodeId": "1759479295671_jflit2ek8",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488728262_shaymep9m",
"sourceNodeId": "1759488688188_qejfcso50",
"targetNodeId": "1759488725107_v8u160t95",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488732106_yg23eiw3l",
"sourceNodeId": "1759488725107_v8u160t95",
"targetNodeId": "1759481282875_5orqavi5y",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488733833_08kf67zp1",
"sourceNodeId": "1759488725107_v8u160t95",
"targetNodeId": "1759479318405_bptb8ltcp",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488741448_2in7yz3v7",
"sourceNodeId": "1759488688188_qejfcso50",
"targetNodeId": "1759488737637_axpz9aqaz",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488742689_15z7fchvc",
"sourceNodeId": "1759488737637_axpz9aqaz",
"targetNodeId": "1759481307863_ja6q4q9bz",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1759488745870_5rllaj2oe",
"sourceNodeId": "1759488737637_axpz9aqaz",
"targetNodeId": "1758089757615_dp9tw9ka1",
"sourcePointType": "child", "sourcePointType": "child",
"targetPointType": "parent" "targetPointType": "parent"
} }

View File

@@ -8,294 +8,30 @@
"name": "记忆顺序节点", "name": "记忆顺序节点",
"position": { "position": {
"x": -60, "x": -60,
"y": -200 "y": -280
}, },
"parameters": {}, "parameters": {},
"children": [ "children": [
"1758005578560_0b1kuefo0", "1758090634327_mf36nwkdt"
"node_1757926547913_xilg11ei7",
"1757931183149_eeuq44vs0"
] ]
}, },
{ {
"id": "node_1757926547913_xilg11ei7", "id": "1758090634327_mf36nwkdt",
"className": "MemSelector", "className": "Selector",
"name": "记忆选择节点", "name": "选择节点",
"position": { "position": {
"x": 20, "x": 20,
"y": -80 "y": -80
}, },
"parameters": {}, "parameters": {},
"children": [
"node_1757926550855_1hqcmi43w",
"node_1757926555912_18vbde5fp",
"1757930584200_cf9rez1qg",
"1757931171553_a3afal936"
]
},
{
"id": "node_1757926550855_1hqcmi43w",
"className": "WaitTicks",
"name": "等待次数",
"position": {
"x": -220,
"y": 40
},
"parameters": {
"_max": 2
},
"children": [] "children": []
},
{
"id": "node_1757926555912_18vbde5fp",
"className": "WaitTime",
"name": "等待时间",
"position": {
"x": -60,
"y": 40
},
"parameters": {
"_max": 1
},
"children": []
},
{
"id": "1757930584200_cf9rez1qg",
"className": "Inverter",
"name": "反转器",
"position": {
"x": 100,
"y": 40
},
"parameters": {},
"children": [
"1757930606484_dbsf9bsu2"
]
},
{
"id": "1757930606484_dbsf9bsu2",
"className": "WaitTicks",
"name": "等待次数",
"position": {
"x": 100,
"y": 160
},
"parameters": {
"_max": 0
},
"children": []
},
{
"id": "1757931171553_a3afal936",
"className": "WaitTicks",
"name": "等待次数",
"position": {
"x": 260,
"y": 40
},
"parameters": {
"_max": 0
},
"children": []
},
{
"id": "1757931183149_eeuq44vs0",
"className": "LimitTicks",
"name": "次数限制器",
"position": {
"x": 420,
"y": -80
},
"parameters": {
"_max": 1
},
"children": []
},
{
"id": "1758005570308_u6yo43u3b",
"className": "MemSelector",
"name": "记忆选择节点",
"position": {
"x": -540,
"y": 40
},
"parameters": {},
"children": [
"1758005574101_v4xhs2jo8"
]
},
{
"id": "1758005572265_dl9lxnrki",
"className": "MemSequence",
"name": "记忆顺序节点",
"position": {
"x": -380,
"y": 40
},
"parameters": {},
"children": [
"1758005575213_obgfw5q7p"
]
},
{
"id": "1758005574101_v4xhs2jo8",
"className": "Selector",
"name": "选择节点",
"position": {
"x": -540,
"y": 160
},
"parameters": {},
"children": [
"1758005576340_c8xf5bdhp"
]
},
{
"id": "1758005575213_obgfw5q7p",
"className": "RandomSelector",
"name": "随机选择节点",
"position": {
"x": -380,
"y": 160
},
"parameters": {},
"children": [
"1758005577367_tw24xyxop"
]
},
{
"id": "1758005576340_c8xf5bdhp",
"className": "Sequence",
"name": "顺序节点",
"position": {
"x": -540,
"y": 280
},
"parameters": {},
"children": []
},
{
"id": "1758005577367_tw24xyxop",
"className": "Parallel",
"name": "并行节点",
"position": {
"x": -380,
"y": 280
},
"parameters": {},
"children": []
},
{
"id": "1758005578560_0b1kuefo0",
"className": "ParallelAnySuccess",
"name": "并行任意成功",
"position": {
"x": -460,
"y": -80
},
"parameters": {},
"children": [
"1758005570308_u6yo43u3b",
"1758005572265_dl9lxnrki"
]
} }
], ],
"connections": [ "connections": [
{ {
"id": "conn_1757926557710_7asuzelad", "id": "conn_1758090635620_zajj5r8g0",
"sourceNodeId": "node_1757926547913_xilg11ei7",
"targetNodeId": "node_1757926555912_18vbde5fp",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1757926560138_ragkonnfy",
"sourceNodeId": "node_1757926547913_xilg11ei7",
"targetNodeId": "node_1757926550855_1hqcmi43w",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1757930585861_b5oi5rm01",
"sourceNodeId": "node_1757926547913_xilg11ei7",
"targetNodeId": "1757930584200_cf9rez1qg",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1757930591546_aul6he8br",
"sourceNodeId": "1757930589538_qisfksbwz", "sourceNodeId": "1757930589538_qisfksbwz",
"targetNodeId": "node_1757926547913_xilg11ei7", "targetNodeId": "1758090634327_mf36nwkdt",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1757931173864_bvoj26wca",
"sourceNodeId": "node_1757926547913_xilg11ei7",
"targetNodeId": "1757931171553_a3afal936",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1757931198693_i0xwbcybx",
"sourceNodeId": "1757930589538_qisfksbwz",
"targetNodeId": "1757931183149_eeuq44vs0",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1757931631231_ecs9ql7x6",
"sourceNodeId": "1757930584200_cf9rez1qg",
"targetNodeId": "1757930606484_dbsf9bsu2",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1758005608025_lk647mty7",
"sourceNodeId": "1758005570308_u6yo43u3b",
"targetNodeId": "1758005574101_v4xhs2jo8",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1758005609490_i9jyzji9o",
"sourceNodeId": "1758005572265_dl9lxnrki",
"targetNodeId": "1758005575213_obgfw5q7p",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1758005610949_y0443s3om",
"sourceNodeId": "1758005575213_obgfw5q7p",
"targetNodeId": "1758005577367_tw24xyxop",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1758005614225_q84l7ry4u",
"sourceNodeId": "1758005578560_0b1kuefo0",
"targetNodeId": "1758005570308_u6yo43u3b",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1758005615813_q663l1nnl",
"sourceNodeId": "1758005578560_0b1kuefo0",
"targetNodeId": "1758005572265_dl9lxnrki",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1758005618014_6uj500l16",
"sourceNodeId": "1758005574101_v4xhs2jo8",
"targetNodeId": "1758005576340_c8xf5bdhp",
"sourcePointType": "child",
"targetPointType": "parent"
},
{
"id": "conn_1758009576474_gtfkqutb1",
"sourceNodeId": "1757930589538_qisfksbwz",
"targetNodeId": "1758005578560_0b1kuefo0",
"sourcePointType": "child", "sourcePointType": "child",
"targetPointType": "parent" "targetPointType": "parent"
} }

View File

@@ -81,6 +81,7 @@ export abstract class BTNode implements IBTNode {
// 执行完成时清理 // 执行完成时清理
if (status !== Status.RUNNING) { if (status !== Status.RUNNING) {
this._local.openNodes.delete(this); this._local.openNodes.delete(this);
this.close();
} }
return status; return status;
} }
@@ -90,7 +91,7 @@ export abstract class BTNode implements IBTNode {
* 子类重写此方法进行状态初始化 * 子类重写此方法进行状态初始化
*/ */
protected open(): void { } protected open(): void { }
protected close(): void { }
/** /**
* 清理子节点的打开状态 * 清理子节点的打开状态
* 一般用于装饰节点的非子节点关闭时, 用来清理子节点的打开状态 * 一般用于装饰节点的非子节点关闭时, 用来清理子节点的打开状态
@@ -99,6 +100,7 @@ export abstract class BTNode implements IBTNode {
const child = this.children[0]; const child = this.children[0];
if (child && this._local.openNodes.has(child)) { if (child && this._local.openNodes.has(child)) {
this._local.openNodes.delete(child); this._local.openNodes.delete(child);
(child as BTNode).close();
} }
} }