添加demo

This commit is contained in:
gongxh
2025-09-17 10:25:13 +08:00
parent d7fc1e49ae
commit b582a5d1da
29 changed files with 2125 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "9d91ce52-ffe8-43c0-a118-9ace6bd9cf45",
"files": [],
"subMetas": {},
"userData": {
"isBundle": true,
"bundleConfigID": "default",
"bundleName": "resources",
"priority": 8
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "1ea023b5-0ab6-4613-b157-3098b11c379b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,169 @@
{
"bt-tree1": [
{
"id": "1759472794685_3awlwerqg",
"className": "MemSelector",
"parameters": {},
"children": [
"1759472800995_k3q8rx02h",
"1759472799864_nait7thja",
"1759472798713_ay9jxznr4",
"1759472797759_gu3y8p1um"
]
},
{
"id": "1759472797759_gu3y8p1um",
"className": "Inverter",
"parameters": {},
"children": []
},
{
"id": "1759472798713_ay9jxznr4",
"className": "LimitTime",
"parameters": {
"_max": 1
},
"children": []
},
{
"id": "1759472799864_nait7thja",
"className": "LimitTicks",
"parameters": {
"_max": 1
},
"children": []
},
{
"id": "1759472800995_k3q8rx02h",
"className": "Repeat",
"parameters": {
"_max": 1
},
"children": []
}
],
"bt-tree2": [
{
"id": "1757930589538_qisfksbwz",
"className": "MemSequence",
"parameters": {},
"children": [
"1758005578560_0b1kuefo0",
"node_1757926547913_xilg11ei7",
"1757931183149_eeuq44vs0"
]
},
{
"id": "node_1757926547913_xilg11ei7",
"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",
"parameters": {},
"children": [
"1758005576340_c8xf5bdhp"
]
},
{
"id": "1758005575213_obgfw5q7p",
"className": "RandomSelector",
"parameters": {},
"children": [
"1758005577367_tw24xyxop"
]
},
{
"id": "1758005576340_c8xf5bdhp",
"className": "Sequence",
"parameters": {},
"children": []
},
{
"id": "1758005577367_tw24xyxop",
"className": "Parallel",
"parameters": {},
"children": []
},
{
"id": "1758005578560_0b1kuefo0",
"className": "ParallelAnySuccess",
"parameters": {},
"children": [
"1758005570308_u6yo43u3b",
"1758005572265_dl9lxnrki"
]
}
]
}

View File

@@ -0,0 +1,11 @@
{
"ver": "2.0.1",
"importer": "json",
"imported": true,
"uuid": "c8aeef5d-6d0e-4093-848e-7d8f1ca30261",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "6f3166a3-36ba-4512-bae8-889c2a7d7d98",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,687 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "GameEntry",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "GameEntry",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 15
},
"_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": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 16
},
"_id": "bef93422-3e63-4c0f-a5cf-d926e7360673"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
},
{
"__id__": 14
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 375,
"y": 667,
"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": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "beI88Z2HpFELqR4T5EMHpg"
},
{
"__type__": "cc.Node",
"_name": "Camera",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 4
},
{
"__id__": 7
}
],
"_active": true,
"_components": [
{
"__id__": 11
}
],
"_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": "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",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": null,
"_projection": 0,
"_priority": 1,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 667,
"_near": 0,
"_far": 2000,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": 1,
"_stencil": 0,
"_clearFlags": 0,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_aperture": 19,
"_shutter": 7,
"_iso": 0,
"_screenScale": 1,
"_visibility": 1107296259,
"_targetTexture": null,
"_postProcess": null,
"_usePostProcess": false,
"_cameraType": -1,
"_trackingType": 0,
"_id": "63WIch3o5BEYRlXzTT0oWc"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "d6rUX5yfhMlKoWX2bSbawx"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_cameraComponent": {
"__id__": 11
},
"_alignCanvasWithScreen": true,
"_id": "12O/ljcVlEqLmVm3U2gEOQ"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 18,
"_target": null,
"_left": 375,
"_right": 375,
"_top": 667,
"_bottom": 667,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "c5V1EV8IpMtrIvY1OE9t2u"
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"asset": null,
"fileId": "bef93422-3e63-4c0f-a5cf-d926e7360673",
"instance": null,
"targetOverrides": null
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 17
},
"shadows": {
"__id__": 18
},
"_skybox": {
"__id__": 19
},
"fog": {
"__id__": 20
},
"octree": {
"__id__": 21
},
"skin": {
"__id__": 22
},
"lightProbeInfo": {
"__id__": 23
},
"postSettings": {
"__id__": 24
},
"bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false
},
{
"__type__": "cc.AmbientInfo",
"_skyColorHDR": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0.520833125
},
"_skyColor": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0.520833125
},
"_skyIllumHDR": 20000,
"_skyIllum": 20000,
"_groundAlbedoHDR": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0
},
"_groundAlbedo": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0
},
"_skyColorLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 1
},
"_skyIllumLDR": 20000,
"_groundAlbedoLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
}
},
{
"__type__": "cc.ShadowsInfo",
"_enabled": false,
"_type": 0,
"_normal": {
"__type__": "cc.Vec3",
"x": 0,
"y": 1,
"z": 0
},
"_distance": 0,
"_planeBias": 1,
"_shadowColor": {
"__type__": "cc.Color",
"r": 76,
"g": 76,
"b": 76,
"a": 255
},
"_maxReceived": 4,
"_size": {
"__type__": "cc.Vec2",
"x": 512,
"y": 512
}
},
{
"__type__": "cc.SkyboxInfo",
"_envLightingType": 0,
"_envmapHDR": null,
"_envmap": null,
"_envmapLDR": null,
"_diffuseMapHDR": null,
"_diffuseMapLDR": null,
"_enabled": false,
"_useHDR": true,
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null,
"_rotationAngle": 0
},
{
"__type__": "cc.FogInfo",
"_type": 0,
"_fogColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_enabled": false,
"_fogDensity": 0.3,
"_fogStart": 0.5,
"_fogEnd": 300,
"_fogAtten": 5,
"_fogTop": 1.5,
"_fogRange": 1.2,
"_accurate": false
},
{
"__type__": "cc.OctreeInfo",
"_enabled": false,
"_minPos": {
"__type__": "cc.Vec3",
"x": -1024,
"y": -1024,
"z": -1024
},
"_maxPos": {
"__type__": "cc.Vec3",
"x": 1024,
"y": 1024,
"z": 1024
},
"_depth": 8
},
{
"__type__": "cc.SkinInfo",
"_enabled": false,
"_blurRadius": 0.01,
"_sssIntensity": 3
},
{
"__type__": "cc.LightProbeInfo",
"_giScale": 1,
"_giSamples": 1024,
"_bounces": 2,
"_reduceRinging": 0,
"_showProbe": true,
"_showWireframe": true,
"_showConvex": false,
"_data": null,
"_lightProbeSphereVolume": 1
},
{
"__type__": "cc.PostSettingsInfo",
"_toneMappingType": 0
}
]

View File

@@ -0,0 +1,11 @@
{
"ver": "1.1.50",
"importer": "scene",
"imported": true,
"uuid": "bef93422-3e63-4c0f-a5cf-d926e7360673",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "448b0525-daf3-4ad4-be4a-04a7e181f028",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,20 @@
import { _decorator, Component, Node } from 'cc';
import * as BT from "kunpocc-behaviortree";
const { ccclass, property, menu } = _decorator;
@ccclass("GameEntry")
@menu("kunpo/GameEntry")
export class GameEntry extends Component {
@property(Node)
private stage: Node = null;
@property(Node)
private touchNode: Node = null;
start(): void {
BT
}
protected update(dt: number): void {
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "e5804a9e-c17f-4df6-8a74-778687e2bec1",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,73 @@
interface Math {
/**
* 限制值
* @param value 当前值
* @param min 最小值
* @param max 最大值
*/
clampf(value: number, min: number, max: number): number;
/**
* 随机从 min 到 max 的整数(包含min和max)
* @param min
* @param max
*/
rand(min: number, max: number): number;
/**
* 随机从 min 到 max的数
* @param min
* @param max
*/
randRange(min: number, max: number): number;
/**
* 角度转弧度
* @param angle 角度
*/
rad(angle: number): number;
/**
* 弧度转角度
* @param radian 弧度
*/
deg(radian: number): number;
/**
* 数值平滑渐变
* @param num1
* @param num2
* @param elapsedTime
* @param responseTime
*/
smooth(num1: number, num2: number, elapsedTime: number, responseTime: number): number;
}
Math.clampf = function (value: number, min: number, max: number): number {
return Math.min(Math.max(value, min), max);
};
Math.rand = function (min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1) + min);
};
Math.randRange = function (min: number, max: number): number {
return Math.random() * (max - min) + min;
};
Math.rad = function (angle: number): number {
return (angle * Math.PI) / 180;
};
Math.deg = function (radian: number): number {
return (radian * 180) / Math.PI;
};
Math.smooth = function (num1: number, num2: number, elapsedTime: number, responseTime: number): number {
let out: number = num1;
if (elapsedTime > 0) {
out = out + (num2 - num1) * (elapsedTime / (elapsedTime + responseTime));
}
return out;
};

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "a336ce23-5d73-4280-b2e9-084389a3877e",
"files": [],
"subMetas": {},
"userData": {}
}