public void OnUpdatedNetworkState(ENetworkState newNetworkState, AbstractBEventDispatcher bEventDispatcher) { if (ARE_EQUAL(BEventDispatcher, bEventDispatcher)) { NetworkState = newNetworkState; BEventsCollection.NETWORK_NetworkStateUpdated.Invoke(new BEHandle <ENetworkState>(NetworkState)); } }
private void RemoveBEventDispatcher(AbstractBEventDispatcher bEventDispatcher) { switch (bEventDispatcher.GetBEventDispatcherType()) { case BEventDispatcherType.MIRROR: NetworkManager mirrorNetworkManager = FindObjectOfType <NetworkManager>(); if (mirrorNetworkManager != null) { Destroy(mirrorNetworkManager.gameObject); } break; } // Destroy Dispatcher Component Destroy(bEventDispatcher); }
public void SetBEventDispatcher(BEventDispatcherType bEventDispatcherMode) { // Disconnect if (NetworkState != ENetworkState.NOT_CONNECTED) { Disconnect(); } // Remove existing Dispatcher AbstractBEventDispatcher bEventDispatcher = FindObjectOfType <AbstractBEventDispatcher>(); if (bEventDispatcher) { RemoveBEventDispatcher(bEventDispatcher); } // Add new Dispatcher if (AddBeventDispatcher(bEventDispatcherMode)) { BEventsCollection.NETWORK_NewBEventDispatcherSet.Invoke(new BEHandle <AbstractBEventDispatcher>(BEventDispatcher)); } }