feat(game): 技能基础框架基本搭建完成,下步遇到再完善

- 调整了英雄角色top.prefab节点结构和组件关联,优化层级关系和属性值
- 修改pow、mpb等子节点的组件及位置,提升表现效果
- 更新技能atk_fires.prefab增加了ReadyLoop、SkillTime等新属性
- 调整攻击技能atk_s1.prefab的运行类型及相关时间与计数参数
- 修正atk_s1.prefab目标覆盖配置,完善prefab实例结构
- 精简atk_s_1.prefab的子节点引用,去除冗余id链接,简化资源结构
This commit is contained in:
2025-10-19 15:16:39 +08:00
parent 6d5c768a30
commit 6571eb2ef0
14 changed files with 661 additions and 402 deletions

View File

@@ -4,6 +4,7 @@ import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/m
import { HeroViewComp } from "../../hero/HeroViewComp";
import { SkillCom } from "../SkillCom";
import { AtkConCom } from "../../skill/AtkConCom";
import { SkillSet } from "../../common/config/SkillSet";
const { ccclass, property } = _decorator;
@@ -17,53 +18,7 @@ export class AtkComComp extends CCComp {
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
public atk(args:any){
let scom=this.node.getComponent(SkillCom)
let acom=this.node.getComponent(AtkConCom)
let skill=scom?scom:acom
let dis=this.node.getComponent(UITransform).width/2
let targetsInRange: HeroViewComp[] = []
// 收集范围内所有敌方目标
ecs.query(ecs.allOf(HeroViewComp)).some(e => {
const view = e.get(HeroViewComp);
if(view.fac!=skill.fac) {
const distance = Math.abs(skill.node.position.x - view.node.position.x);
if(distance <= dis) {
targetsInRange.push(view);
}
}
});
// 根据配置的hit_num决定攻击模式
const hitNum = skill.skillConfig?.hit_num || 0;
if(hitNum > 0) {
// 限制目标数量按距离排序选择最近的N个目标
if(targetsInRange.length > 0) {
// 按距离排序(从近到远)
targetsInRange.sort((a, b) => {
const distanceA = Math.abs(skill.node.position.x - a.node.position.x);
const distanceB = Math.abs(skill.node.position.x - b.node.position.x);
return distanceA - distanceB;
});
// 限制目标数量
const maxTargets = Math.min(hitNum, targetsInRange.length);
const selectedTargets = targetsInRange.slice(0, maxTargets);
selectedTargets.forEach(target => {
skill.single_damage(target, false);
});
}
} else {
// 范围伤害:对所有范围内目标造成伤害
if(targetsInRange.length > 0) {
targetsInRange.forEach(target => {
skill.single_damage(target, false);
});
}
}
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {