public static void Broadcast(IActorNotify message) { Unit[] units = Game.Scene.GetComponent <UnitComponent>().GetAll(); ActorMessageSenderComponent actorMessageSenderComponent = Game.Scene.GetComponent <ActorMessageSenderComponent>(); foreach (Unit unit in units) { UnitGateComponent unitGateComponent = unit.GetComponent <UnitGateComponent>(); if (unitGateComponent.IsDisconnect) { continue; } actorMessageSenderComponent.GetWithActorId(unitGateComponent.GateSessionActorId).Send(message); } }
public static void Send(this ActorMessageSender self, IActorNotify notify) { ActorTask task = new ActorTask(notify); self.Add(task); }