为之后 一次技能 多次释放 提供基础
This commit is contained in:
@@ -42,22 +42,10 @@ 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.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.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), // 目标位置
|
||||
view
|
||||
);
|
||||
caster.get(HeroViewComp).playSkillEffect(config.uuid);
|
||||
console.log("技能:"+config.uuid+"=>"+targets[0]?.get(HeroViewComp).hero_name);
|
||||
this.doSkill(caster,config);
|
||||
}
|
||||
|
||||
if (config.TargetGroup === TargetGroup.Ally) {
|
||||
@@ -70,6 +58,21 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
}
|
||||
|
||||
}
|
||||
private doSkill(caster: ecs.Entity, config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
const view = caster.get(HeroViewComp);
|
||||
const skillEntity = ecs.getEntity<Skill>(Skill);
|
||||
const targets = this.selectEnemyTargets(caster, config);
|
||||
if (targets.length === 0) return;
|
||||
skillEntity.load(
|
||||
new Vec3(view.node.position.x, view.node.position.y+BoxSet.ATK_Y, 0), // 起始位置
|
||||
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), // 目标位置
|
||||
view
|
||||
);
|
||||
console.log("技能:"+config.uuid+"=>"+targets[0]?.get(HeroViewComp).hero_name);
|
||||
}
|
||||
|
||||
private selectEnemyTargets(caster: ecs.Entity, config: typeof SkillSet[keyof typeof SkillSet]): ecs.Entity[] {
|
||||
const casterView = caster.get(HeroViewComp);
|
||||
|
||||
Reference in New Issue
Block a user