fix(SACastSystem): 修复技能目标选择逻辑并添加默认值
当sDamageTargets未找到目标时,回退到使用sDefaultTargets获取默认目标 同时为createSkill方法的isWFuny参数添加默认值false
This commit is contained in:
@@ -193,7 +193,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
|||||||
/**
|
/**
|
||||||
* 创建技能实体
|
* 创建技能实体
|
||||||
*/
|
*/
|
||||||
private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],isWFuny:boolean) {
|
private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],isWFuny:boolean=false) {
|
||||||
// 检查节点有效性
|
// 检查节点有效性
|
||||||
if (!caster.node || !caster.node.isValid) {
|
if (!caster.node || !caster.node.isValid) {
|
||||||
console.warn("[SACastSystem] 施法者节点无效");
|
console.warn("[SACastSystem] 施法者节点无效");
|
||||||
@@ -229,7 +229,10 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
|||||||
// 简化版:选择最前方的敌人
|
// 简化版:选择最前方的敌人
|
||||||
let heroAttrs = caster.ent.get(HeroAttrsComp);
|
let heroAttrs = caster.ent.get(HeroAttrsComp);
|
||||||
if (!heroAttrs) return [];
|
if (!heroAttrs) return [];
|
||||||
let targets=this.sDefaultTargets(caster,heroAttrs.fac)
|
let targets=this.sDamageTargets(caster, config, maxTargets);
|
||||||
|
if (targets.length === 0) {
|
||||||
|
targets.push(...this.sDefaultTargets(caster, heroAttrs.fac));
|
||||||
|
}
|
||||||
return targets;
|
return targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user