From 211f48b6aae8ee704bca7aa46675737abb00d1cd Mon Sep 17 00:00:00 2001 From: walkpan Date: Sun, 15 Mar 2026 13:03:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=AF=E7=94=A8=E7=89=A9=E7=90=86?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E7=BB=98=E5=88=B6=E5=B9=B6=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E9=85=8D=E7=BD=AE=E4=B8=8E=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 启用PhysicsSystem2D的Aabb调试绘制以辅助碰撞检测 - 将射手英雄的技能由[6002,6100]更新为[6005,6006] - 为SMoveComp添加isHorizontal属性,强制水平移动时保持Y坐标不变 - 技能施放延迟优先使用技能配置的ready值,提高配置灵活性 - 将技能6001和6005的结束类型由animationEnd改为collision,使伤害触发更精确 --- assets/script/Main.ts | 2 +- assets/script/game/common/config/SkillSet.ts | 4 ++-- assets/script/game/common/config/heroSet.ts | 2 +- assets/script/game/hero/SCastSystem.ts | 7 ++++++- assets/script/game/skill/SMoveComp.ts | 4 ++++ assets/script/game/skill/SMoveSystem.ts | 6 ++++++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/assets/script/Main.ts b/assets/script/Main.ts index bb5c2a5b..eb8f5af2 100644 --- a/assets/script/Main.ts +++ b/assets/script/Main.ts @@ -12,7 +12,7 @@ const { ccclass, property } = _decorator; @ccclass('Main') export class Main extends Root { start() { - // PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb + PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb // |EPhysics2DDrawFlags.Pair // |EPhysics2DDrawFlags.CenterOfMass // |EPhysics2DDrawFlags.Joint diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index b76f73fd..09f202a8 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -213,7 +213,7 @@ export const SkillSet: Record = { 6001: { uuid:6001,name:"空挥",sp_name:"atk_s1",icon:"1026",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single, ap:100,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0, - ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd, + ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.collision, buffs:[],debuffs:[],info:"对前方目标造成100%攻击的伤害", }, 6002: { @@ -237,7 +237,7 @@ export const SkillSet: Record = { 6005: { uuid:6005,name:"蓝箭",sp_name:"arrow_blue",icon:"1135",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single, ap:100,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0, - ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.animationEnd, + ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision, buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害", }, 6006: { diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 7da9e3c2..de3433fc 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -156,7 +156,7 @@ export const HeroInfo: Record = { buff:[],info:"奥术法师"}, 5003:{uuid:5003,name:"射手",icon:"1001",path:"ha1", fac:FacSet.HERO, kind:2,as:1,ss:5, - type:HType.remote,lv:1,hp:180,ap:30,speed:140,skills:[6002,6100], + type:HType.remote,lv:1,hp:180,ap:30,speed:140,skills:[6005,6006], rangeType: SkillRange.Long, buff:[],info:"射手"}, diff --git a/assets/script/game/hero/SCastSystem.ts b/assets/script/game/hero/SCastSystem.ts index 699d7114..75441289 100644 --- a/assets/script/game/hero/SCastSystem.ts +++ b/assets/script/game/hero/SCastSystem.ts @@ -67,7 +67,12 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate if (targets.length === 0) return; heroView.playSkillEffect(s_uuid); const isMainSkill = s_uuid === heroAttrs.skill_id; - const delay = GameConst.Battle.SKILL_CAST_DELAY; + + // 优先使用技能配置的前摇时间,否则使用全局默认值 + // 注意:这里仍然是基于时间的延迟,受帧率波动影响。 + // 若需精确同步,建议在动画中添加帧事件并在 HeroViewComp 中监听。 + const delay = config.ready > 0 ? config.ready : GameConst.Battle.SKILL_CAST_DELAY; + heroView.scheduleOnce(() => { if (!heroView.node || !heroView.node.isValid || heroAttrs.is_dead) return; this.applyPrimaryEffect(entity, s_uuid, config, heroView, targets); diff --git a/assets/script/game/skill/SMoveComp.ts b/assets/script/game/skill/SMoveComp.ts index 94da3173..88ff0582 100644 --- a/assets/script/game/skill/SMoveComp.ts +++ b/assets/script/game/skill/SMoveComp.ts @@ -42,6 +42,9 @@ export class SMoveDataComp extends ecs.Comp { /** 结束类型 */ endType: EType = EType.collision; + /** 是否强制水平移动 */ + isHorizontal: boolean = true; + /** 攻击偏移X - 从视图层传递 */ atk_x: number = 0; @@ -77,6 +80,7 @@ export class SMoveDataComp extends ecs.Comp { this.s_uuid = 0; this.runType = RType.linear; this.endType = EType.collision; + this.isHorizontal = true; this.atk_x = 0; this.atk_y = 0; this.isMoving = false; diff --git a/assets/script/game/skill/SMoveSystem.ts b/assets/script/game/skill/SMoveSystem.ts index 9f590f98..2ce2f406 100644 --- a/assets/script/game/skill/SMoveSystem.ts +++ b/assets/script/game/skill/SMoveSystem.ts @@ -70,6 +70,12 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate node.position.y + moveComp.atk_y, node.position.z ); + + // 如果开启水平移动开关,强制目标Y等于起点Y + if (moveComp.isHorizontal) { + moveComp.targetPos.y = linearPos.y; + } + moveComp.rePos(linearPos); // 设置旋转角度