技能碰撞改回物理碰撞

This commit is contained in:
panfudan
2025-03-30 16:59:40 +08:00
parent 67704725b2
commit 798a831227
85 changed files with 13428 additions and 7394 deletions

View File

@@ -43,34 +43,31 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
private castSkill(caster: ecs.Entity, skillId: number, config: typeof SkillSet[keyof typeof SkillSet]) {
const view = caster.get(HeroViewComp);
const skillEntity = ecs.getEntity<Skill>(Skill);
console.log(view.hero_name+"施放技能:"+config.uuid+"=>"+view.hero_name);
console.log(view.uuid+"=>"+view.hero_name+"施放技能:"+config.uuid);
if (config.TargetGroup === TargetGroup.Enemy) {
const targets = this.selectEnemyTargets(caster, config);
console.log("敌人 targets:"+targets);
if (targets.length === 0) return;
skillEntity.load(
new Vec3(view.node.position.x, view.node.position.y+BoxSet.ATK_Y, 0), // 起始位置
view.fac, // 阵营
view.box_group, // 阵营
view.node.parent, // 父节点
config.uuid, // 技能ID
new Vec3(targets[0]?.get(HeroViewComp).node.position.x, targets[0]?.get(HeroViewComp).node.position.y, 0), // 目标位置
targets[0]?.get(HeroViewComp),
view
);
targets.forEach(target => {
this.applySkillEffect(caster, target, config,skillEntity);
console.log("施放技能:"+config.uuid+"=>"+target.get(HeroViewComp).hero_name);
});
caster.get(HeroViewComp).playSkillEffect(config.uuid);
console.log("技能:"+config.uuid+"=>"+targets[0]?.get(HeroViewComp).hero_name);
}
if (config.TargetGroup === TargetGroup.Ally) {
const targets = this.selectAllyTargets(caster, config);
if (targets.length === 0) return;
targets.forEach(target => {
this.applySkillEffect(caster, target, config,skillEntity);
});
}
if (config.TargetGroup === TargetGroup.Self) {
this.applySkillEffect(caster, caster, config,skillEntity);
}
}
@@ -119,13 +116,6 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
return shuffled.slice(0, count);
}
/** 应用技能效果 */
private applySkillEffect(caster: ecs.Entity, target: ecs.Entity, config: typeof SkillSet[keyof typeof SkillSet],skillEntity:ecs.Entity) {
const casterView = caster.get(HeroViewComp);
// 播放技能特效
casterView.playSkillEffect(config.uuid);
}
public clear_timer() {
console.log("clear_timer");