feat: 为召唤和死亡触发技能添加动画效果
- 在 Hero、Monster 和 HeroAtkSystem 中分发技能触发事件时,增加 triggerType 参数以区分召唤和死亡 - 修改 SCastSystem 的 forceCastTriggerSkill 方法,根据 triggerType 播放对应的准备动画(黄色表示召唤,死亡动画表示死亡) - 调整 hnode.prefab 中按钮的布局和样式,移除特定精灵帧以使用默认样式
This commit is contained in:
@@ -148,7 +148,8 @@ export class Hero extends ecs.Entity {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: hero.call,
|
||||
heroAttrs: model,
|
||||
heroView: hv
|
||||
heroView: hv,
|
||||
triggerType: 'call'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,8 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: heroInfo.dead,
|
||||
heroAttrs: TAttrsComp,
|
||||
heroView: view
|
||||
heroView: view,
|
||||
triggerType: 'dead'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { HeroSpine } from "./HeroSpine";
|
||||
import { BoxSet, FacSet, FightSet, NumberFormatter, TooltipTypes } from "../common/config/GameSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { SkillSet,} from "../common/config/SkillSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { Tooltip } from "../skill/Tooltip";
|
||||
@@ -300,7 +301,11 @@ export class HeroViewComp extends CCComp {
|
||||
var path = "game/skill/ready/" + anm;
|
||||
this.spawnAnimEndFx(path, this.node, undefined);
|
||||
}
|
||||
|
||||
public playOther(anm: string = ""){
|
||||
if(anm==="") return;
|
||||
var path = "game/skill/ready/" + anm;
|
||||
this.spawnAnimEndFx(path, this.node.parent, undefined);
|
||||
}
|
||||
public playEnd(anm: string = ""){
|
||||
if(anm==="") return;
|
||||
var path = "game/skill/end/" + anm;
|
||||
@@ -417,9 +422,14 @@ export class HeroViewComp extends CCComp {
|
||||
this.realDeadTime = this.monDeadTime;
|
||||
}
|
||||
|
||||
// 播放死亡特效
|
||||
this.deaded();
|
||||
|
||||
// 如果角色带有死亡触发技能,则由 SCastSystem 播放 playReady("dead"),不播放原有的 deaded 特效
|
||||
const heroInfo = HeroInfo[this.model.hero_uuid];
|
||||
if (heroInfo && heroInfo.dead) {
|
||||
// SCastSystem will handle the "dead" ready animation
|
||||
} else {
|
||||
// 播放默认死亡特效
|
||||
this.deaded();
|
||||
}
|
||||
}
|
||||
realDead(){
|
||||
// 🔥 修复:添加model安全检查,防止实体销毁过程中的空指针异常
|
||||
|
||||
@@ -199,7 +199,8 @@ export class Monster extends ecs.Entity {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: hero.call,
|
||||
heroAttrs: model,
|
||||
heroView: view
|
||||
heroView: view,
|
||||
triggerType: 'call'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
oops.message.off(GameEvent.TriggerSkill, this.onTriggerSkill, this);
|
||||
}
|
||||
|
||||
private onTriggerSkill(event: string, args: { s_uuid: number, heroAttrs: HeroAttrsComp, heroView: HeroViewComp }) {
|
||||
private onTriggerSkill(event: string, args: { s_uuid: number, heroAttrs: HeroAttrsComp, heroView: HeroViewComp, triggerType?: string }) {
|
||||
if (!args || !args.s_uuid || !args.heroAttrs || !args.heroView) return;
|
||||
this.forceCastTriggerSkill(args.s_uuid, args.heroAttrs, args.heroView);
|
||||
this.forceCastTriggerSkill(args.s_uuid, args.heroAttrs, args.heroView, args.triggerType);
|
||||
}
|
||||
/** 空施法计划:用于“当前无可施法技能”时的统一返回 */
|
||||
private readonly emptyCastPlan = { skillId: 0, skillLv: 1, isFriendly: false, targetPos: null as Vec3 | null, targetEids: [] as number[] };
|
||||
@@ -95,7 +95,14 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
* 强制执行触发技能(召唤/死亡触发)
|
||||
* 忽略CD、状态、动画前摇,直接生效
|
||||
*/
|
||||
public forceCastTriggerSkill(s_uuid: number, heroAttrs: HeroAttrsComp, heroView: HeroViewComp) {
|
||||
public forceCastTriggerSkill(s_uuid: number, heroAttrs: HeroAttrsComp, heroView: HeroViewComp, triggerType?: string) {
|
||||
// 播放相应的触发动画
|
||||
if (triggerType === 'call') {
|
||||
heroView.playReady("yellow");
|
||||
} else if (triggerType === 'dead') {
|
||||
heroView.playReady("dead");
|
||||
}
|
||||
|
||||
// 如果是敌方攻击技能,必须在战斗中才能释放;友方增益/护盾则允许在非战斗中释放
|
||||
const config = SkillSet[s_uuid];
|
||||
if (!config) return;
|
||||
|
||||
Reference in New Issue
Block a user