From 1091b0399e94e241d5880e1cee2a7594043d7d86 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sat, 1 Nov 2025 23:10:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E7=A2=B0=E6=92=9E=E6=A3=80=E6=B5=8B=E5=92=8C=E8=8B=B1=E9=9B=84?= =?UTF-8?q?prefab=E9=85=8D=E7=BD=AE=E9=97=AE=E9=A2=98=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E7=A2=B0=E6=92=9E=E6=A3=80=E6=B5=8B=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=AD=A3=E7=A1=AE=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E4=BC=A4=E5=AE=B3=E5=B9=B6=E8=BF=87=E6=BB=A4=E5=90=8C?= =?UTF-8?q?=E7=BB=84=E7=A2=B0=E6=92=9E=20=E8=B0=83=E6=95=B4=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E8=8B=B1=E9=9B=84prefab=E7=9A=84=5Fenabled=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=92=8C=E7=A2=B0=E6=92=9E=E7=BB=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=8A=80=E8=83=BD=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E5=92=8C=E4=BC=A4?= =?UTF-8?q?=E5=AE=B3=E5=BA=94=E7=94=A8=E9=80=BB=E8=BE=91=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84prefab=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=92=8C=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/game/heros/ha1.prefab | 2 +- assets/resources/game/heros/hc1.prefab | 2 +- assets/resources/game/heros/hh1.prefab | 2 +- assets/resources/game/heros/hk1.prefab | 2 +- assets/resources/game/heros/hm1.prefab | 2 +- assets/resources/game/heros/hm2.prefab | 2 +- assets/resources/game/heros/hz1.prefab | 2 +- assets/resources/game/heros/mo1.prefab | 4 +- assets/resources/game/heros/mo2.prefab | 4 +- assets/resources/game/heros/mo3.prefab | 4 +- assets/resources/game/heros/mo4.prefab | 4 +- assets/resources/game/skill/atk/atk_s1.prefab | 41 +-------------- assets/resources/game/skill/atk/atk_s2.prefab | 41 +-------------- .../resources/game/skill/atk/b_arrow_1.prefab | 10 ++-- .../game/skill/atk/m_water_ball_1.prefab | 51 +++---------------- assets/script/game/hero/HeroViewComp.ts | 2 +- assets/script/game/hero/Mon.ts | 3 +- assets/script/game/hero/SACastSystem.ts | 2 + assets/script/game/skill/SkillView.ts | 24 +++------ 19 files changed, 40 insertions(+), 164 deletions(-) diff --git a/assets/resources/game/heros/ha1.prefab b/assets/resources/game/heros/ha1.prefab index a412360e..e114ec26 100644 --- a/assets/resources/game/heros/ha1.prefab +++ b/assets/resources/game/heros/ha1.prefab @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/hc1.prefab b/assets/resources/game/heros/hc1.prefab index 73748a46..9ab046b0 100644 --- a/assets/resources/game/heros/hc1.prefab +++ b/assets/resources/game/heros/hc1.prefab @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/hh1.prefab b/assets/resources/game/heros/hh1.prefab index f2f1e639..b732468b 100644 --- a/assets/resources/game/heros/hh1.prefab +++ b/assets/resources/game/heros/hh1.prefab @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/hk1.prefab b/assets/resources/game/heros/hk1.prefab index 2c05eb7e..1829e613 100644 --- a/assets/resources/game/heros/hk1.prefab +++ b/assets/resources/game/heros/hk1.prefab @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/hm1.prefab b/assets/resources/game/heros/hm1.prefab index 06f747d7..ada98b3a 100644 --- a/assets/resources/game/heros/hm1.prefab +++ b/assets/resources/game/heros/hm1.prefab @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/hm2.prefab b/assets/resources/game/heros/hm2.prefab index 2c848452..ce48660a 100644 --- a/assets/resources/game/heros/hm2.prefab +++ b/assets/resources/game/heros/hm2.prefab @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/hz1.prefab b/assets/resources/game/heros/hz1.prefab index 5c2b036b..f0c7f355 100644 --- a/assets/resources/game/heros/hz1.prefab +++ b/assets/resources/game/heros/hz1.prefab @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/mo1.prefab b/assets/resources/game/heros/mo1.prefab index 6c66cf10..589f6b35 100644 --- a/assets/resources/game/heros/mo1.prefab +++ b/assets/resources/game/heros/mo1.prefab @@ -961,7 +961,7 @@ "enabledContactListener": true, "bullet": false, "awakeOnLoad": true, - "_group": 4, + "_group": 2, "_type": 1, "_allowSleep": false, "_gravityScale": 1, @@ -988,7 +988,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/mo2.prefab b/assets/resources/game/heros/mo2.prefab index 2e3c9e8b..aac15bbd 100644 --- a/assets/resources/game/heros/mo2.prefab +++ b/assets/resources/game/heros/mo2.prefab @@ -964,7 +964,7 @@ "enabledContactListener": true, "bullet": false, "awakeOnLoad": true, - "_group": 4, + "_group": 2, "_type": 1, "_allowSleep": false, "_gravityScale": 1, @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/mo3.prefab b/assets/resources/game/heros/mo3.prefab index e58f0ac1..86bfaf97 100644 --- a/assets/resources/game/heros/mo3.prefab +++ b/assets/resources/game/heros/mo3.prefab @@ -964,7 +964,7 @@ "enabledContactListener": true, "bullet": false, "awakeOnLoad": true, - "_group": 4, + "_group": 2, "_type": 1, "_allowSleep": false, "_gravityScale": 1, @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/heros/mo4.prefab b/assets/resources/game/heros/mo4.prefab index 741d6832..5c891098 100644 --- a/assets/resources/game/heros/mo4.prefab +++ b/assets/resources/game/heros/mo4.prefab @@ -964,7 +964,7 @@ "enabledContactListener": true, "bullet": false, "awakeOnLoad": true, - "_group": 4, + "_group": 2, "_type": 1, "_allowSleep": false, "_gravityScale": 1, @@ -991,7 +991,7 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 62 }, diff --git a/assets/resources/game/skill/atk/atk_s1.prefab b/assets/resources/game/skill/atk/atk_s1.prefab index bac84beb..020a6ed9 100644 --- a/assets/resources/game/skill/atk/atk_s1.prefab +++ b/assets/resources/game/skill/atk/atk_s1.prefab @@ -32,13 +32,10 @@ }, { "__id__": 16 - }, - { - "__id__": 18 } ], "_prefab": { - "__id__": 20 + "__id__": 18 }, "_lpos": { "__type__": "cc.Vec3", @@ -353,48 +350,12 @@ }, "atk_x": 0, "atk_y": 0, - "runType": 2, - "endType": 0, "_id": "" }, { "__type__": "cc.CompPrefabInfo", "fileId": "35nW0iQNBH2bqkWAr3MVkQ" }, - { - "__type__": "f680dkagx9PmbfqtF463/Ua", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 1 - }, - "_enabled": true, - "__prefab": { - "__id__": 19 - }, - "speed": 600, - "controlPointSide": 1, - "controlPointOffset": 0.5, - "controlPointRandomness": 0.3, - "autoRotate": false, - "showTrajectory": false, - "trajectoryColor": { - "__type__": "cc.Color", - "r": 0, - "g": 255, - "b": 0, - "a": 255 - }, - "trajectoryWidth": 3, - "easing": "linear", - "rotationSmoothness": 0.6, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "defJ3noEdMUapDOKtsHbd+" - }, { "__type__": "cc.PrefabInfo", "root": { diff --git a/assets/resources/game/skill/atk/atk_s2.prefab b/assets/resources/game/skill/atk/atk_s2.prefab index 6ba52cc5..fb05cbde 100644 --- a/assets/resources/game/skill/atk/atk_s2.prefab +++ b/assets/resources/game/skill/atk/atk_s2.prefab @@ -32,13 +32,10 @@ }, { "__id__": 16 - }, - { - "__id__": 18 } ], "_prefab": { - "__id__": 20 + "__id__": 18 }, "_lpos": { "__type__": "cc.Vec3", @@ -353,48 +350,12 @@ }, "atk_x": 0, "atk_y": 0, - "runType": 2, - "endType": 0, "_id": "" }, { "__type__": "cc.CompPrefabInfo", "fileId": "60LInmZXxDtKu79AshRG9j" }, - { - "__type__": "f680dkagx9PmbfqtF463/Ua", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 1 - }, - "_enabled": true, - "__prefab": { - "__id__": 19 - }, - "speed": 600, - "controlPointSide": 1, - "controlPointOffset": 0.5, - "controlPointRandomness": 0.3, - "autoRotate": false, - "showTrajectory": false, - "trajectoryColor": { - "__type__": "cc.Color", - "r": 0, - "g": 255, - "b": 0, - "a": 255 - }, - "trajectoryWidth": 3, - "easing": "linear", - "rotationSmoothness": 0.6, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "65YLwe9t9EXo5kI3HQEGhs" - }, { "__type__": "cc.PrefabInfo", "root": { diff --git a/assets/resources/game/skill/atk/b_arrow_1.prefab b/assets/resources/game/skill/atk/b_arrow_1.prefab index 9364ed14..0191357c 100644 --- a/assets/resources/game/skill/atk/b_arrow_1.prefab +++ b/assets/resources/game/skill/atk/b_arrow_1.prefab @@ -276,8 +276,6 @@ }, "atk_x": 0, "atk_y": 0, - "runType": 2, - "endType": 0, "_id": "" }, { @@ -330,12 +328,12 @@ "__prefab": { "__id__": 17 }, - "enabledContactListener": false, + "enabledContactListener": true, "bullet": false, "awakeOnLoad": true, "_group": 1, - "_type": 2, - "_allowSleep": true, + "_type": 1, + "_allowSleep": false, "_gravityScale": 1, "_linearDamping": 0, "_angularDamping": 0, @@ -367,7 +365,7 @@ "tag": 0, "_group": 1, "_density": 1, - "_sensor": false, + "_sensor": true, "_friction": 0.2, "_restitution": 0, "_offset": { diff --git a/assets/resources/game/skill/atk/m_water_ball_1.prefab b/assets/resources/game/skill/atk/m_water_ball_1.prefab index 278d2a23..63c4d6d9 100644 --- a/assets/resources/game/skill/atk/m_water_ball_1.prefab +++ b/assets/resources/game/skill/atk/m_water_ball_1.prefab @@ -38,13 +38,10 @@ }, { "__id__": 16 - }, - { - "__id__": 18 } ], "_prefab": { - "__id__": 20 + "__id__": 18 }, "_lpos": { "__type__": "cc.Vec3", @@ -292,7 +289,7 @@ "fileId": "60LInmZXxDtKu79AshRG9j" }, { - "__type__": "f680dkagx9PmbfqtF463/Ua", + "__type__": "cc.RigidBody2D", "_name": "", "_objFlags": 0, "__editorExtras__": {}, @@ -303,46 +300,12 @@ "__prefab": { "__id__": 15 }, - "speed": 600, - "controlPointSide": 1, - "controlPointOffset": 0.5, - "controlPointRandomness": 0.3, - "autoRotate": false, - "showTrajectory": false, - "trajectoryColor": { - "__type__": "cc.Color", - "r": 0, - "g": 255, - "b": 0, - "a": 255 - }, - "trajectoryWidth": 3, - "easing": "linear", - "rotationSmoothness": 0.6, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "65YLwe9t9EXo5kI3HQEGhs" - }, - { - "__type__": "cc.RigidBody2D", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 1 - }, - "_enabled": true, - "__prefab": { - "__id__": 17 - }, - "enabledContactListener": false, + "enabledContactListener": true, "bullet": false, "awakeOnLoad": true, "_group": 1, - "_type": 2, - "_allowSleep": true, + "_type": 1, + "_allowSleep": false, "_gravityScale": 1, "_linearDamping": 0, "_angularDamping": 0, @@ -369,12 +332,12 @@ }, "_enabled": true, "__prefab": { - "__id__": 19 + "__id__": 17 }, "tag": 0, "_group": 1, "_density": 1, - "_sensor": false, + "_sensor": true, "_friction": 0.2, "_restitution": 0, "_offset": { diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 58f2f0cc..ea16fd4e 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -51,7 +51,7 @@ export class HeroViewComp extends CCComp { const collider = this.node.getComponent(BoxCollider2D); this.scheduleOnce(()=>{ if (collider) collider.enabled = true; // 先禁 - },1) + },0.1) // let anm = this.node.getChildByName("anm") // anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8); } diff --git a/assets/script/game/hero/Mon.ts b/assets/script/game/hero/Mon.ts index 578f6fd7..d79f6619 100644 --- a/assets/script/game/hero/Mon.ts +++ b/assets/script/game/hero/Mon.ts @@ -37,7 +37,6 @@ export class Monster extends ecs.Entity { /** 加载角色 */ load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,lv:number=1,monType:MonType=MonType.NORMAL, buffs: BuffConf[] = [],is_call=false) { scale=-1 - let box_group=BoxSet.MONSTER var scene = smc.map.MapView.scene; var path = "game/heros/"+HeroInfo[uuid].path; var prefab: Prefab = oops.res.get(path, Prefab)!; @@ -55,7 +54,7 @@ export class Monster extends ecs.Entity { let hero = HeroInfo[uuid]; // 共用英雄数据 // 设置 View 层属性(表现相关) view.scale = scale; - view.box_group = box_group; + view.box_group = BoxSet.MONSTER; // 设置 Model 层属性(数据相关) model.hero_uuid = uuid; diff --git a/assets/script/game/hero/SACastSystem.ts b/assets/script/game/hero/SACastSystem.ts index cec13dfb..29ef7a20 100644 --- a/assets/script/game/hero/SACastSystem.ts +++ b/assets/script/game/hero/SACastSystem.ts @@ -166,6 +166,8 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat // 这里可以调用 SkillConComp 的目标选择逻辑 // 暂时返回默认位置 + if (caster==null ) return + if(caster.ent == null) return const heroAttrs = caster.ent.get(HeroAttrsComp); const fac = heroAttrs?.fac ?? 0; const defaultX = fac === 0 ? 400 : -400; diff --git a/assets/script/game/skill/SkillView.ts b/assets/script/game/skill/SkillView.ts index 15112607..5cb7c7d4 100644 --- a/assets/script/game/skill/SkillView.ts +++ b/assets/script/game/skill/SkillView.ts @@ -38,7 +38,6 @@ export class SkillView extends CCComp { if(collider) { collider.group = this.group; collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this); - console.log(`[skillView] ${this.sData.caster.ent.get(HeroAttrsComp).hero_name}的 ${this.SConf.name} 碰撞组 ${this.group}`) } if(this.node.getComponent(Animation)){ let anim = this.node.getComponent(Animation); @@ -48,18 +47,16 @@ export class SkillView extends CCComp { } onBeginContact (seCol: Collider2D, oCol: Collider2D) { - console.log(`[skillView] ${this.sData.caster.ent.get(HeroAttrsComp).hero_name}的 ${this.SConf.name} 碰撞了 ${oCol.getComponent(HeroViewComp).ent.get(HeroAttrsComp).hero_name}`); + if(oCol.group==this.group) return + if (!this.SConf) return; if(this.SConf.EType!=EType.collision) return let target = oCol.getComponent(HeroViewComp) + if(target == null) return; let model=target.ent.get(HeroAttrsComp) + if(!model) return if(model.is_dead) return - if(oCol.group!=this.group){ - if(target == null) return; - if (!this.SConf) return; - if(this.SConf.EType==EType.collision){ - this.apply_damage(target) - } - } + // console.log(`[skillView] 碰撞5[${this.sData.caster.box_group}][${this.sData.caster.ent.get(HeroAttrsComp).hero_name}][${this.sData.caster.ent.eid}]的[${this.group}] [${this.SConf.name}]碰撞了 [${oCol.group}][ ${oCol.getComponent(HeroViewComp).ent.get(HeroAttrsComp).hero_name}][${oCol.getComponent(HeroViewComp).ent.eid}]`); + this.apply_damage(target) } onAnimationFinished(){ @@ -98,11 +95,9 @@ export class SkillView extends CCComp { const distanceB = Math.abs(this.node.position.x - b.node.position.x); return distanceA - distanceB; }); - // 限制目标数量 const maxTargets = Math.min(hitNum, IRTargets.length); const sTargets = IRTargets.slice(0, maxTargets); - sTargets.forEach(target => { this.apply_damage(target, false); }); @@ -120,7 +115,8 @@ export class SkillView extends CCComp { apply_damage(target:HeroViewComp,is_range:boolean=false){ if(target == null) return; if (!this.SConf) return; - + console.log(`[skillView] 伤害 [${this.group}][${this.sData.caster.ent.get(HeroAttrsComp).hero_name}][${this.sData.caster.ent.eid}]的 [${this.SConf.name}]对 [${target.box_group}][ ${target.ent.get(HeroAttrsComp).hero_name}][${target.ent.eid}]`); + // if(this.sData.hit_count > this.SConf.hit_num) return 不能超出 最大伤害数量 // 使用伤害队列系统处理伤害 DamageQueueHelper.addDamageToEntity( target.ent, @@ -128,12 +124,8 @@ export class SkillView extends CCComp { this.sData.caster, this.sData.s_uuid ); - - // console.log(`[SkillCom]: ${this.sData.caster.ent.get(HeroAttrsComp).hero_name}[${this.sData.caster.ent.get(HeroAttrsComp).fac}:${ this.sData.fac}:${target.ent.get(HeroAttrsComp).fac}] 对 ${target.ent.get(HeroAttrsComp).hero_name} 释放技能 ${this.SConf.name}`) - // 更新技能命中次数 this.sData.hit_count++ - // 检查技能是否应该销毁 if( this.sData.hit_count>=(this.SConf.hit+ this.sData.Attrs[Attrs.PUNCTURE])&&(this.SConf.DTType!=DTType.range)&&(this.SConf.EType!=EType.animationEnd)&&(this.SConf.EType!=EType.timeEnd)) this.ent.destroy// 技能命中次数 }