diff --git a/assets/script/game/skill/SMoveSystem.ts b/assets/script/game/skill/SMoveSystem.ts index 2ce2f406..dcf3ba2b 100644 --- a/assets/script/game/skill/SMoveSystem.ts +++ b/assets/script/game/skill/SMoveSystem.ts @@ -136,7 +136,11 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate // 检查移动完成 if (moveComp.isCompleted && moveComp.autoDestroy) { // 根据结束类型决定是否销毁 - if (moveComp.endType === EType.timeEnd || moveComp.endType === EType.collision) { + if ( + moveComp.endType === EType.distanceEnd || + moveComp.endType === EType.collision + ) { + skillView.close_collider(); entity.destroy(); } } @@ -229,4 +233,4 @@ export class SMoveHelper { moveComp.stopMove(); } } -} \ No newline at end of file +} diff --git a/assets/script/game/skill/STimeComp.ts b/assets/script/game/skill/STimeComp.ts new file mode 100644 index 00000000..71c49183 --- /dev/null +++ b/assets/script/game/skill/STimeComp.ts @@ -0,0 +1,25 @@ +import { Vec3, v3, Node } from "cc"; +import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; +import { RType, EType, SkillSet } from "../common/config/SkillSet"; +import { BoxSet } from "../common/config/GameSet"; +import { SkillView } from "./SkillView"; +import { smc } from "../common/SingletonModuleComp"; + +/** + * ==================== 技能移动数据组件 ==================== + * + * 用途: + * - 存储技能实体的移动相关数据 + * - 管理移动状态和参数 + * - 支持多种移动类型(线性、贝塞尔、固定位置等) + */ +@ecs.register('StimeDataComp') +export class StimeDataComp extends ecs.Comp { + /** 技能UUID */ + s_uuid: number = 0; + reset() { + + } + +} + diff --git a/assets/script/game/skill/STimeComp.ts.meta b/assets/script/game/skill/STimeComp.ts.meta new file mode 100644 index 00000000..f7598bb7 --- /dev/null +++ b/assets/script/game/skill/STimeComp.ts.meta @@ -0,0 +1 @@ +{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"f39d7998-2039-4411-9dd2-77db452d0a6d","files":[],"subMetas":{},"userData":{}} diff --git a/assets/script/game/skill/SkillView.ts b/assets/script/game/skill/SkillView.ts index edea13ce..6e342272 100644 --- a/assets/script/game/skill/SkillView.ts +++ b/assets/script/game/skill/SkillView.ts @@ -103,11 +103,7 @@ export class SkillView extends CCComp { // //动画帧事件 atk 触发 public atk(args:any){ this.attackFrameCount++; - - // 开启碰撞检测 - if(this.collider) { - this.pendingDisableCollider = false; - this.collider.enabled = true; + if (this.enable_collider_safely()) { mLogger.log(this.debugMode, 'SkillView', `[SkillView] [${this.SConf?.name}] 第${this.attackFrameCount}次攻击帧开启碰撞检测`); } @@ -175,6 +171,17 @@ export class SkillView extends CCComp { this.isDisposing = true; this.close_collider(); } + private enable_collider_safely(): boolean { + if (!this.collider || !this.collider.isValid) return false; + if (this.isDisposing) return false; + if (!this.node || !this.node.isValid || !this.node.activeInHierarchy) return false; + this.pendingDisableCollider = false; + this.collider.group = this.group; + this.collider.off(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this); + this.collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this); + this.collider.enabled = true; + return true; + } /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ reset() { // 清理碰撞体事件监听