feat(skill): 优化技能碰撞检测逻辑并添加攻击帧计数

- 在SkillView中缓存碰撞体引用并添加攻击帧计数器
- 实现攻击帧事件中动态开启碰撞检测
- 非持续碰撞类型技能在造成伤害后立即关闭碰撞检测
- 清理资源时取消所有定时器
- 调整技能预制体碰撞体位置和大小
- 注释掉Main.ts中的物理调试绘制代码
This commit is contained in:
2025-11-03 14:47:53 +08:00
parent 2d5653e0e4
commit 1a45e91f1a
3 changed files with 237 additions and 44 deletions

View File

@@ -20,28 +20,31 @@
"_children": [
{
"__id__": 2
},
{
"__id__": 8
}
],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 10
},
{
"__id__": 12
},
{
"__id__": 14
},
{
"__id__": 16
},
{
"__id__": 18
},
{
"__id__": 20
},
{
"__id__": 22
},
{
"__id__": 24
}
],
"_prefab": {
"__id__": 18
"__id__": 26
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -208,6 +211,181 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "T",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 11
},
{
"__id__": 13
}
],
"_prefab": {
"__id__": 15
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 40,
"y": -50,
"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": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 10
},
"_contentSize": {
"__type__": "cc.Size",
"width": 80,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8b9HY9QmBA5qB0sBawCFqZ"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": false,
"__prefab": {
"__id__": 12
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@46c83",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e0lXniMh9C77aUoKhV9TG0"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 14
},
"_alignFlags": 45,
"_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": 25,
"_originalHeight": 25,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "efBhSYnd1Kz6YztMYe2EVs"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "0b1uG2sstDMZRfqgTMWTrz",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -218,17 +396,17 @@
},
"_enabled": true,
"__prefab": {
"__id__": 9
"__id__": 17
},
"_contentSize": {
"__type__": "cc.Size",
"width": 200,
"height": 80
"width": 80,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0
"x": 0,
"y": 0.5
},
"_id": ""
},
@@ -246,7 +424,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 11
"__id__": 19
},
"playOnLoad": true,
"_clips": [
@@ -275,7 +453,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 13
"__id__": 21
},
"atk_x": 0,
"atk_y": 0,
@@ -295,7 +473,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 15
"__id__": 23
},
"enabledContactListener": true,
"bullet": false,
@@ -327,9 +505,9 @@
"node": {
"__id__": 1
},
"_enabled": true,
"_enabled": false,
"__prefab": {
"__id__": 17
"__id__": 25
},
"tag": 0,
"_group": 1,
@@ -339,13 +517,13 @@
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 40
"x": 40,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 200,
"height": 80
"width": 80,
"height": 100
},
"_id": ""
},