private void Awake() { Instance = this; Log.OnMessage += (sender, args) => Debug.Log(args.Message); _commandQueue = new NetworkCommandQueue(_client) { LagCompensation = 10 }; _commandQueue.InitReceived += (sender, init) => { AllActorIds = init.AllActors; Debug.Log($"Starting simulation. Total actors: {init.AllActors.Length}. Local ActorID: {init.ActorID}"); Simulation.Start(init.SimulationSpeed, init.ActorID, init.AllActors); }; Simulation = new Simulation(Contexts.sharedInstance, _commandQueue, new UnityGameService(EntityDatabase)); }
private void Awake() { Instance = this; Systems = new World(Contexts.sharedInstance, new UnityGameService(EntityDatabase), new UnityLogger()); _remoteCommandBuffer = new NetworkCommandBuffer(_client); _remoteCommandBuffer.RegisterCommand(() => new SpawnCommand()); _remoteCommandBuffer.RegisterCommand(() => new NavigateCommand()); Simulation = new Simulation(Systems, _remoteCommandBuffer) { LagCompensation = 3 }; _remoteCommandBuffer.InitReceived += StartSimulation; //Simulation.Ticked += id => //{ // _dataReceiver.Receive(MessageTag.HashCode, new HashCode {FrameNumber = id, Value = _systems.HashCode}); //}; }