Beispiel #1
0
        public void Subscribe(StateOption options, Subscriber callback)
        {
            SubscriberOptions subscriberOption = new SubscriberOptions();

            subscriberOption.option     = options;
            subscriberOption.subscriber = callback;

            if (!subscribers.Contains(subscriberOption))
            {
                subscribers.Add(subscriberOption);
            }
            PublishIfMatches(subscriberOption, true);
        }
Beispiel #2
0
 private void PublishIfMatches(SubscriberOptions subscriberOption, bool forceDirtyBit = false)
 {
     if (
         subscriberOption.option.Matches(
             previousNetworkState,
             previousGameState,
             networkState,
             gameState,
             isNetworkDirty,
             isGameDirty
             )
         )
     {
         subscriberOption.subscriber();
     }
 }