feat: 添加主角实体引用并确保跨局重置

在 SingletonModuleComp 中添加 role 字段存储主角实体引用,并在 MissionComp 任务开始时重置引用,在 Hero 销毁时清理引用。避免跨局数据残留导致引用错误。
This commit is contained in:
panw
2026-02-02 16:56:05 +08:00
parent c349319f7b
commit d40cb26819
3 changed files with 12 additions and 0 deletions

View File

@@ -272,6 +272,9 @@ do_ad(){
this.revive_times = 1; // 每次任务开始重置复活次数
this.spawnedSpecialIndices.clear(); // 重置特殊刷怪记录
// 重置全局属性加成和主角引用 (确保新一局数据干净)
smc.role = null;
// 重置英雄数据,确保新一局是初始状态
smc.vmdata.hero = {
name:'',