public void MappedOnSpawnServer(IEnumerable <IServerSpawn> iServerSpawns) { foreach (var s in iServerSpawns) { s.OnSpawnServer(SpawnInfo.Mapped(((Component)s).gameObject)); } }
void OnRoundStart() { if (CustomNetworkManager.Instance._isServer) { // Execute server-side OnSpawn hooks for mapped objects var iServerSpawns = FindObjectsOfType <MonoBehaviour>().OfType <IServerSpawn>(); foreach (var s in iServerSpawns) { s.OnSpawnServer(SpawnInfo.Mapped(((Component)s).gameObject)); } } }
void OnRoundStart() { if (CustomNetworkManager.Instance._isServer) { var iServerSpawns = FindObjectsOfType <MonoBehaviour>().OfType <IServerSpawn>(); foreach (var s in iServerSpawns) { s.OnSpawnServer(SpawnInfo.Mapped(((Component)s).gameObject)); } Spawn._CallAllClientSpawnHooksInScene(); } }
public void MappedOnSpawnServer(IEnumerable <IServerSpawn> iServerSpawns) { foreach (var s in iServerSpawns) { try { s.OnSpawnServer(SpawnInfo.Mapped(((Component)s).gameObject)); } catch (Exception e) { Logger.LogErrorFormat("Exception message on map loading: {0}", Category.Server, e); } } }
private IEnumerator WaitToFireHooks() { //we have to wait to fire hooks until the root objects in the scene are active, //otherwise our attempt to find the hooks to call will always return 0. //TODO: Find a better way to do this, maybe there is a hook for this while (FindUtils.FindInterfaceImplementersInScene <IServerSpawn>().Count == 0) { yield return(WaitFor.Seconds(1)); } if (CustomNetworkManager.Instance._isServer) { //invoke all server + client side hooks on all objects that have them foreach (var serverSpawn in FindUtils.FindInterfaceImplementersInScene <IServerSpawn>()) { serverSpawn.OnSpawnServer(SpawnInfo.Mapped(((Component)serverSpawn).gameObject)); } Spawn._CallAllClientSpawnHooksInScene(); } else { Spawn._CallAllClientSpawnHooksInScene(); } }