refactor(skill): 移除未使用的caster引用以简化技能数据

清理SDataCom中未使用的caster属性及相关代码,减少内存占用并提升代码清晰度。技能逻辑仅依赖casterEid进行实体识别,移除冗余引用可避免潜在循环引用问题。
This commit is contained in:
panw
2026-03-18 10:22:12 +08:00
parent d2fbac11cd
commit e059c97670
3 changed files with 2 additions and 8 deletions

View File

@@ -67,11 +67,10 @@ export class SkillView extends CCComp {
if (!this.node || !this.node.activeInHierarchy) return;
const targetView = oCol.getComponent(HeroViewComp);
if (this.debugMode) {
const casterName = this.sData.caster?.ent?.get(HeroAttrsComp)?.hero_name ?? '未知施法者';
const casterEid = this.sData.casterEid;
const targetName = targetView?.ent?.get(HeroAttrsComp)?.hero_name ?? '非英雄对象';
const targetEid = targetView?.ent?.eid ?? '未知EID';
mLogger.log(this.debugMode, 'SkillView', `[skillView] 碰撞1 [${this.sData.caster.box_group}][${casterName}][${casterEid}]的[${seCol.group}]:[${this.SConf.name}][${this.ent.eid}]碰撞了 [${oCol.group}]:[ ${targetName}][${targetEid}]`);
mLogger.log(this.debugMode, 'SkillView', `[skillView] 碰撞1 [${this.sData.group}][eid:${casterEid}]的[${seCol.group}]:[${this.SConf.name}][${this.ent.eid}]碰撞了 [${oCol.group}]:[${targetName}][${targetEid}]`);
}
if (oCol.group === seCol.group) return;
if (this.pendingDisableCollider) return;
@@ -130,9 +129,8 @@ export class SkillView extends CCComp {
if (!this.sData) return;
if (!this.SConf) return;
if (this.debugMode) {
const casterName = this.sData.caster?.ent?.get(HeroAttrsComp)?.hero_name ?? "未知施法者";
const targetName = target.ent.get(HeroAttrsComp)?.hero_name ?? "未知目标";
mLogger.log(this.debugMode, 'SkillView', `[skillView] 伤害 [${this.group}][${casterName}][${this.sData.casterEid}]的 [${this.SConf.name}]对 [${target.box_group}][ ${targetName}][${target.ent.eid}]`);
mLogger.log(this.debugMode, 'SkillView', `[skillView] 伤害 [${this.group}][eid:${this.sData.casterEid}]的 [${this.SConf.name}]对 [${target.box_group}][${targetName}][${target.ent.eid}]`);
}
// 使用伤害队列系统处理伤害
DamageQueueHelper.addDamageToEntity(