修复主从交互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

@@ -50,6 +50,8 @@ namespace JNGame.Sync.Entity
/// </summary>
public LVector3 Position => Transform.Position;
public bool IsDelayDestroy { get; private set; } = false;
public virtual void OnInit(IJNContext context,ulong id = 0)
{
Context = context;
@@ -127,12 +129,18 @@ namespace JNGame.Sync.Entity
public override void Destroy()
{
//清理缓存
Context.RemoveEntity(Id);
OnSyncDestroy();
RemoveAllComponents();
base.Destroy();
}
public void DelayDestroy()
{
IsDelayDestroy = true;
}
//生命周期
public virtual void OnSyncStart(){}
@@ -146,7 +154,11 @@ namespace JNGame.Sync.Entity
}
public virtual void OnSyncDestroy()
{}
{
_id = 0;
IsDelayDestroy = false;
}
}
}