战斗管理系统基础
This commit is contained in:
@@ -22,10 +22,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
const skills = e.get(HeroSkillsComp);
|
||||
|
||||
// 使用固定时间步长更新
|
||||
this.accumulator += this.dt;
|
||||
while (this.accumulator >= this.updateInterval) {
|
||||
this.accumulator -= this.updateInterval;
|
||||
|
||||
|
||||
// 只在攻击状态触发技能
|
||||
if (view.is_atking) {
|
||||
this.processSkills(e, skills);
|
||||
@@ -35,7 +32,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
skills.skills.forEach(skillId => {
|
||||
this.updateCooldown(skills, skillId);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** 处理所有技能逻辑 */
|
||||
@@ -79,11 +76,11 @@ 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 comp = caster.get(HeroSkillsComp);
|
||||
console.log(view.hero_name+"施放技能",config.uuid,comp,view)
|
||||
|
||||
console.log(view.hero_name+"施放技能:"+config.uuid+"=>"+view.hero_name)
|
||||
switch(config.CdType) {
|
||||
case CdType.SkillCD:
|
||||
view.as.max()
|
||||
|
||||
comp.cooldowns.set(skillId, config.cd); // 重置冷却时间
|
||||
break;
|
||||
case CdType.HeroCD:
|
||||
@@ -116,7 +113,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
const casterView = caster.get(HeroViewComp);
|
||||
const team = casterView.fac;
|
||||
const isEnemyTeam = team === 0 ? 1 : 0;
|
||||
|
||||
|
||||
// 第一阶段:基础目标筛选
|
||||
let candidates = ecs.query(ecs.allOf(HeroViewComp)).filter(e => {
|
||||
const view = e.get(HeroViewComp);
|
||||
@@ -210,6 +207,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
|
||||
// 播放技能特效
|
||||
caster.get(HeroViewComp).playSkillEffect(config.uuid);
|
||||
console.log(caster.get(HeroViewComp).hero_name+"技能反馈"+"=>"+req.target.get(HeroViewComp).hero_name+":"+req.baseValue)
|
||||
}
|
||||
|
||||
/** 应用负面状态 */
|
||||
|
||||
Reference in New Issue
Block a user