public Commander(ComponentCommander componentCommander, ISpatialCommunicator communicator) { this.componentCommander = componentCommander; this.communicator = communicator; componentToRequestIds = new Dictionary <EntityComponentId, HashSet <uint> >(); communicator.ComponentAuthorityChanged += OnComponentAuthorityChanged; }
private IEnumerator Connect() { if (ShouldGetDeploymentList()) { var callback = SpatialOS.OnDeploymentListReceived ?? OnDeploymentListReceived; var getList = WorkerConnection.GetDeploymentListAsync(parameters, callback, chosenDeployment => Deployment = chosenDeployment); yield return(getList); var listWait = new WaitUntil(() => Deployment.HasValue); yield return(listWait); } // Can't start prepooling assets until a deployment is chosen, since the Streaming strategy needs to know which assembly it should stream assets from. if (legacyEntityPipeline != null) { var prepareAssetsCoroutine = legacyEntityPipeline.PrepareAssets(); if (prepareAssetsCoroutine != null) { yield return(prepareAssetsCoroutine); } } var connect = WorkerConnection.ConnectAsync(parameters, Deployment, AttachConnection); yield return(connect); SpatialOS.ConnectionWasSuccessful = Connection.IsConnected; if (SpatialOS.ConnectionWasSuccessful) { logger = new LogSender(() => SpatialOS.IsConnected, Connection.SendLogMessage, SpatialOS.Configuration, SpatialOS.LogFilter); SetupComponents(); if (SpatialOS.Configuration.ProtocolLoggingOnStartup) { Connection.SetProtocolLoggingEnabled(true); } eventHandler.ConnectionReady(); var componentCommander = new ComponentCommander(null, spatialCommunicator); Commander = new Commander(componentCommander, spatialCommunicator); ComponentCommander = componentCommander; SpatialOS.OnConnectedInternal(); } }