修复主从交互bug

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-09-23 03:50:27 +08:00
parent ca64b708ac
commit b65b860b98
55 changed files with 233 additions and 119 deletions

View File

@@ -30,5 +30,11 @@ namespace Game.Logic.System
return LVector3.Down;
}
/// <summary>
/// [状态同步生命周期] 玩家离开服务器 不在游戏线程中执行
/// </summary>
public virtual void OnPlayerExitServer(int auth){}
}
}

View File

@@ -1,6 +1,5 @@
using DotRecast.Core.Collections;
using Game.Input;
using Game.JNGFrame.Logic.Entity;
using Game.JNGFrame.Logic.Entity.Contexts;
using Game.Logic.Entity.Nodes;
using JNGame.Math;
@@ -40,5 +39,20 @@ namespace Game.Logic.System.Logic
});
}
public override void OnPlayerExitServer(int auth)
{
base.OnPlayerExitServer(auth);
NodeContext.GetHostEntities().ForEach(child =>
{
if (child.Controller.Auth == auth)
{
child.DelayDestroy();
}
});
}
}
}