fix(hero): 修复大招播放结束后未取消层级置顶的问题

1. 新增isCastingMax标记跟踪大招播放状态,在释放大招时设置该标记
2. 在动画播放结束回调中,当大招动画播放完成时清除置顶标记
3. 调整渲染排序逻辑,将大招播放中的英雄置于渲染层级最下方
4. 在角色死亡和重置时同步重置置顶标记
This commit is contained in:
pan
2026-09-01 16:41:26 +08:00
parent 38cc214bd4
commit 4263997124
3 changed files with 18 additions and 2 deletions

View File

@@ -43,6 +43,8 @@ export class HeroViewComp extends CCComp {
lastBarUpdateTime: number = 0; // 最后一次血条/蓝条/护盾更新时间
// ==================== UI 节点引用 ====================
private topBar: HeroTopBarComp = null!;
/** 是否正在播放大招动画(用于渲染层级置顶,由 HeroAnmComp 播放结束时清除) */
public isCastingMax: boolean = false;
// ==================== 直接访问 HeroAttrsComp ====================
get model() {
@@ -356,6 +358,8 @@ export class HeroViewComp extends CCComp {
// 添加安全检查
if (!this.model) return;
this.isCastingMax = false;
// 防止重复触发
if (this.model.is_count_dead) return;
this.model.is_count_dead = true; // 防止重复触发,必须存在防止重复调用
@@ -438,6 +442,7 @@ export class HeroViewComp extends CCComp {
if (act === "") return;
switch (act) {
case "max":
this.isCastingMax = true;
this.as.max()
break
case "atk":
@@ -487,6 +492,7 @@ export class HeroViewComp extends CCComp {
}
}
reset() {
this.isCastingMax = false;
// 清理残留的定时器和缓动
this.unscheduleAllCallbacks();
Tween.stopAllByTarget(this.node);