feat: Register and unregister BatchLOSSystem in EnemyBase lifecycle methods

This commit is contained in:
2026-06-02 16:23:14 +08:00
parent 06048c966a
commit 150440495d
2 changed files with 6 additions and 0 deletions

View File

@@ -644,10 +644,12 @@ namespace BaseGames.Enemies
protected virtual void OnEnable()
{
_onPlayerSpawned?.Subscribe(SetPlayerTransform).AddTo(_subs);
Core.ServiceLocator.GetOrDefault<AI.BatchLOSSystem>()?.Register(this);
}
protected virtual void OnDisable()
{
Core.ServiceLocator.GetOrDefault<AI.BatchLOSSystem>()?.Unregister(this);
_subs.Clear();
}