mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-12-08 05:49:08 +00:00
修复主从交互bug
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user