Exemple #1
0
        /// <summary>
        /// Runs a single tick of this mocked run.
        /// </summary>
        /// <returns><c>true</c> if the run should continue; <c>false</c> otherwise.</returns>
        public virtual bool NextTick(out MockedRunFrame frame)
        {
            EnsureInit();
            var scheduledPBs = 0;
            var runPBs       = 0;

            foreach (var pb in MockedProgrammableBlocks)
            {
                UpdateType updateType;
                if (pb.TryGetUpdateTypeFor(_tickCount, out updateType))
                {
                    RunProgrammableBlock(pb, null, updateType);
                    runPBs++;
                }
                pb.ToggleOnceFlag();
                if (pb.IsScheduledForLater(_tickCount))
                {
                    scheduledPBs++;
                }
            }

            frame = new MockedRunFrame(_tickCount, scheduledPBs > 0, scheduledPBs, runPBs);
            _tickCount++;
            return(scheduledPBs > 0);
        }
Exemple #2
0
        public override bool NextTick(out MockedRunFrame frame)
        {
            if (!base.NextTick(out frame))
            {
                return(false);
            }

            if (!IsPaused)
            {
                return(ContinuousTick(frame.Tick));
            }

            if (IsPaused)
            {
                return(PausedTick(frame.Tick));
            }

            return(false);
        }