fix(技能): 修复瞬时技能碰撞检测关闭时机
移除基于 pendingClose 的延迟关闭逻辑,改为在攻击帧中立即调度关闭碰撞检测。 这避免了同一帧内对同一目标造成多次伤害的问题,并简化了时间类型技能的处理逻辑。
This commit is contained in:
@@ -9,7 +9,6 @@ export class StimeDataComp extends ecs.Comp {
|
||||
elapsedTime: number = 0;
|
||||
hitInterval: number = 0;
|
||||
hitElapsed: number = 0;
|
||||
pendingClose: boolean = false;
|
||||
|
||||
reset() {
|
||||
this.s_uuid = 0;
|
||||
@@ -17,7 +16,6 @@ export class StimeDataComp extends ecs.Comp {
|
||||
this.elapsedTime = 0;
|
||||
this.hitInterval = 0;
|
||||
this.hitElapsed = 0;
|
||||
this.pendingClose = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +33,6 @@ export class STimeSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
if (!timeComp || !skillView) return;
|
||||
const conf = SkillSet[timeComp.s_uuid];
|
||||
if (!conf || conf.EType !== EType.timeEnd) return;
|
||||
if (timeComp.pendingClose) {
|
||||
skillView.close_collider();
|
||||
timeComp.pendingClose = false;
|
||||
}
|
||||
if (timeComp.totalTime <= 0) {
|
||||
skillView.close_collider();
|
||||
entity.destroy();
|
||||
@@ -46,10 +40,9 @@ export class STimeSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
}
|
||||
timeComp.elapsedTime += this.dt;
|
||||
timeComp.hitElapsed += this.dt;
|
||||
if (timeComp.hitInterval > 0 && timeComp.hitElapsed >= timeComp.hitInterval && !timeComp.pendingClose) {
|
||||
if (timeComp.hitInterval > 0 && timeComp.hitElapsed >= timeComp.hitInterval) {
|
||||
timeComp.hitElapsed -= timeComp.hitInterval;
|
||||
skillView.atk(null);
|
||||
timeComp.pendingClose = true;
|
||||
}
|
||||
if (timeComp.elapsedTime >= timeComp.totalTime) {
|
||||
skillView.close_collider();
|
||||
|
||||
Reference in New Issue
Block a user