1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System.Collections.Generic;
- using UnityEngine;
- namespace Mirror
- {
- [DisallowMultipleComponent]
- public abstract class InterestManagement : MonoBehaviour
- {
-
- void Awake()
- {
- if (NetworkServer.aoi == null)
- {
- NetworkServer.aoi = this;
- }
- else Debug.LogError($"Only one InterestManagement component allowed. {NetworkServer.aoi.GetType()} has been set up already.");
- if (NetworkClient.aoi == null)
- {
- NetworkClient.aoi = this;
- }
- else Debug.LogError($"Only one InterestManagement component allowed. {NetworkClient.aoi.GetType()} has been set up already.");
- }
-
-
-
-
-
- public abstract bool OnCheckObserver(NetworkIdentity identity, NetworkConnection newObserver);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public abstract void OnRebuildObservers(NetworkIdentity identity, HashSet<NetworkConnection> newObservers, bool initialize);
-
-
-
-
-
-
- protected void RebuildAll()
- {
- foreach (NetworkIdentity identity in NetworkIdentity.spawned.Values)
- {
- NetworkServer.RebuildObservers(identity, false);
- }
- }
-
-
-
-
-
-
-
-
- public virtual void SetHostVisibility(NetworkIdentity identity, bool visible)
- {
- foreach (Renderer rend in identity.GetComponentsInChildren<Renderer>())
- rend.enabled = visible;
- }
-
-
- public virtual void OnSpawned(NetworkIdentity identity) {}
-
-
- public virtual void OnDestroyed(NetworkIdentity identity) {}
- }
- }
|