Beispiel #1
0
        public TransitionStateFluent <TS, TT> After(TimeSpan timeSpan)
        {
            var key = currentTransition;

            if (!AfterEntries.TryGetValue(key, out var l))
            {
                l = new List <Timer <TS> >();
                AfterEntries.Add(key, l);
            }
            l.Add(new Timer <TS>(key.Item2, timeSpan.TotalMilliseconds, TimeUnit.MILLISECONDS));
            return(this);
        }
Beispiel #2
0
 private void ResetCurrentAfterEntries()
 {
     foreach (var k in Current.Model.Transitions.Keys)
     {
         if (!AfterEntries.TryGetValue(new Tuple <TS, TS>(Current.Identifier, k), out var currentAfterEntries))
         {
             continue;
         }
         for (var i = 0; i < currentAfterEntries.Count; i++)
         {
             var e = currentAfterEntries[i];
             e.Reset();
             currentAfterEntries[i] = e;
         }
     }
 }
Beispiel #3
0
        public void Update(TimeSpan elapsedTime)
        {
            // After-entries on transitions.
            foreach (var k in Current.Model.Transitions.Keys)
            {
                if (!AfterEntries.TryGetValue(new Tuple <TS, TS>(Current.Identifier, k), out var currentAfterEntries))
                {
                    continue;
                }
                if (CheckAfterEntries(currentAfterEntries, Current.Model.Transitions, elapsedTime))
                {
                    return;
                }
            }

            // Global after-entries.
            if (CheckAfterEntries(GlobalAfterEntries, Model.GlobalTransitions, elapsedTime))
            {
                return;
            }

            Model.Current.RaiseUpdated(new UpdateArgs <TS, TT>(this, Current, elapsedTime));
        }