public int TalkToAll(Actor?sender, ActorMatch actorMatch, object message) { var matchCount = 0; foreach (var actor in Actors) { if (!actorMatch.IsMatch(actor)) { continue; } var receiveProcess = actorMatch.GetReceiveProcess(actor); if (receiveProcess == null) { actor.Talk(message); } else { receiveProcess(sender !, actorMatch, message); } matchCount++; } return(matchCount); }
public int TalkToAll(ActorMatch actorMatch, object message) => TalkToAll(null, actorMatch, message);