fix(hero): 修复大招播放结束后未取消层级置顶的问题
1. 新增isCastingMax标记跟踪大招播放状态,在释放大招时设置该标记 2. 在动画播放结束回调中,当大招动画播放完成时清除置顶标记 3. 调整渲染排序逻辑,将大招播放中的英雄置于渲染层级最下方 4. 在角色死亡和重置时同步重置置顶标记
This commit is contained in:
@@ -49,7 +49,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
private readonly renderSortInterval = 0.05;
|
||||
private lastRenderSortAt = 0;
|
||||
private heroViewMatcher: ecs.IMatcher | null = null;
|
||||
private readonly renderEntries: { node: Node; bossPriority: number; frontScore: number; spawnOrder: number; eid: number; laneScore: number }[] = [];
|
||||
private readonly renderEntries: { node: Node; bossPriority: number; frontScore: number; spawnOrder: number; eid: number; laneScore: number; isCastingMax: boolean }[] = [];
|
||||
private renderEntryCount = 0;
|
||||
|
||||
// ======================== 英雄编队排队 ========================
|
||||
@@ -407,7 +407,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
const entryIndex = this.renderEntryCount;
|
||||
let entry = this.renderEntries[entryIndex];
|
||||
if (!entry) {
|
||||
entry = { node: actorView.node, bossPriority: 0, frontScore: 0, spawnOrder: 0, eid: 0, laneScore: 0 };
|
||||
entry = { node: actorView.node, bossPriority: 0, frontScore: 0, spawnOrder: 0, eid: 0, laneScore: 0, isCastingMax: false };
|
||||
this.renderEntries.push(entry);
|
||||
}
|
||||
entry.node = actorView.node;
|
||||
@@ -415,11 +415,14 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
entry.frontScore = frontScore;
|
||||
entry.spawnOrder = spawnOrder;
|
||||
entry.eid = e.eid;
|
||||
entry.isCastingMax = actorView.isCastingMax;
|
||||
this.renderEntryCount += 1;
|
||||
});
|
||||
this.renderEntries.length = this.renderEntryCount;
|
||||
|
||||
this.renderEntries.sort((a, b) => {
|
||||
// 正在播放大招的英雄排在最后,siblingIndex 越大渲染层级越靠上
|
||||
if (a.isCastingMax !== b.isCastingMax) return a.isCastingMax ? 1 : -1;
|
||||
// Y轴靠下的(laneScore 较大)应该在后面,从而渲染在上面
|
||||
if (Math.abs(a.laneScore - b.laneScore) > 10) return a.laneScore - b.laneScore;
|
||||
if (a.frontScore !== b.frontScore) return a.frontScore - b.frontScore;
|
||||
|
||||
Reference in New Issue
Block a user