private static void OnSimulateAfter(this UnitSimulateComponent self) { ActorMessageSenderComponent actorLocationSenderComponent = Game.Scene.GetComponent <ActorMessageSenderComponent>(); UnitGateComponent unitGateComponent = self.Entity.GetComponent <UnitGateComponent>(); ActorMessageSender actorMessageSender = actorLocationSenderComponent.Get(unitGateComponent.GateSessionActorId); if (unitGateComponent.IsDisconnect) { return; } if (self.ExecuteQueue.Count > 0) { Actor_ServerCommond serverCommond = new Actor_ServerCommond(); while (self.ExecuteQueue.Count > 0) { StateCommand stateCommand = self.ExecuteQueue.Dequeue(); serverCommond.Result.Add(stateCommand.ToCommand()); } actorMessageSender.Send(serverCommond); } if (self.Frame % UnitStateComponent.SyncFrame == 1) { Actor_StateSync stateSync = new Actor_StateSync(); Unit[] units = Game.Scene.GetComponent <UnitComponent>().GetAll(); foreach (Unit unit in units) { UnitStateComponent unitStateComponent = unit.GetComponent <UnitStateComponent>(); UnitState state = unitStateComponent.State; UnitStateInfo info = state.Pack(unit.Id, state.Frame); stateSync.States.Add(info); } actorMessageSender.Send(stateSync); } }