Beispiel #1
0
 void Awake()
 {
     DontDestroyOnLoad(transform.gameObject);
     timeLeft         = timePerLevel;
     jamState         = CycleState.Playing;
     singletonRecords = new List <GameObject>();
 }
Beispiel #2
0
 public CycleManager(XRayMonitor xRayMonitor, MotionMonitor motionMonitor, TurnableMonitor turnableMonitor, DetectorMonitor detectorMonitor, NotificationManager notificationManager)
 {
     this.mXRayMonitor         = xRayMonitor;
     this.mMotionMonitor       = motionMonitor;
     this.mTurnableMonitor     = turnableMonitor;
     this.mDetectorMonitor     = detectorMonitor;
     this.mNotificationManager = notificationManager;
     mState = CycleState.IDILE;
 }
Beispiel #3
0
    /// <summary>
    /// Handles State Transition from [Paused -> Playing]
    /// Sets Timescale to 1
    /// </summary>
    void ResumePlay()
    {
        CycleManager.jamState = CycleState.Playing;
        Time.timeScale        = 1.0f;

        //Stub code for supporting a universal AudioBus

        /*if (wasPlaying)
         * {
         *      transform.FindChild("AudioBus").audio.Play();
         * }*/
    }
Beispiel #4
0
 public void stopCurrentCycle()
 {
     if (this.mState == CycleState.IDILE)
     {
         return;
     }
     this.mState = CycleState.FORCE_TO_STOP;
     while (this.mState != CycleState.DONE)
     {
         Logger.Info("Wait to stop the cycle");
     }
     this.mState = CycleState.IDILE;
 }
Beispiel #5
0
        public bool createCycleProcess()
        {
            bool res = false;

            if (this.mState != CycleState.IDILE)
            {
                return(res);
            }
            TurnableMonitor.SampleType sampleType = this.mSampleType;
            this.mState = CycleState.INITIALIZING;


            switch (sampleType)
            {
            case TurnableMonitor.SampleType.SMALL:
            {
                res = this.createCycleProcessForSmallSample();
                break;
            }

            case TurnableMonitor.SampleType.MIDDLE:
            {
                res = this.createCycleProcessForMiddleSample();
                break;
            }

            case TurnableMonitor.SampleType.BIG:
            {
                res = this.createCycleProcessForBigSample();
                break;
            }

            default:
            {
                break;
            }
            }

            if (res == false)
            {
                this.mCycleTasks.Clear();
                this.mState = CycleState.DONE;
            }
            else
            {
                this.mState = CycleState.INITIALIZED;
            }
            this.mNotificationManager.ShowInformation("Finish Init Cycle");
            return(res);
        }
Beispiel #6
0
 private static byte GetCurrentState(CycleState gameState, Bitmap bmp)
 {
     bool validityFlag = gameState.isCurrentCycleValid();
     if (!validityFlag && !gameState.isCurrentCycleOptional())
     {
         return 0;
     }
     //Even though an optional step may occur, it can get skipped this way
     if (validityFlag)
     {
         Console.WriteLine("Validity of State \"{0}\" was successfully evaluated.", gameState.getCycleName());
         gameState.fireAction();
         Console.WriteLine("Next step: \"{0}\"", gameState.getCycleName());
     }
     return 1;
 }
Beispiel #7
0
        static void Main(string[] args)
        {
            WindowDetection.Structure ws = WindowDetection.GetRecordingWindow("Mobizen");
            CycleState gameState = new CycleState(ws);
            Random r = new Random();
            while (ws.contentWindow != IntPtr.Zero)
            {
                WindowDetection.GetImageFromWindow(ws);
                ws.currentFrame.Save("D:\\bmp_output.bmp");
                byte state = GetCurrentState(gameState, ws.currentFrame);
                int timeout = 500 + (int)(r.NextDouble() * 400);

                Console.WriteLine("Idling for {0}ms....", timeout);
                System.Threading.Thread.Sleep(timeout);
            }
        }
Beispiel #8
0
    /// <summary>
    /// Handles State Transition from [Playing -> Paused]
    /// Sets Timescale to 0
    /// </summary>
    void PausePlay()
    {
        CycleManager.jamState = CycleState.Paused;
        Time.timeScale        = 0.0f;

        //Stub code for supporting a universal AudioBus

        /*if (transform.FindChild("AudioBus") != null)
         * {
         *      AudioSource playerBus = transform.FindChild("AudioBus").audio;
         *      if (playerBus.isPlaying)
         *      {
         *              transform.FindChild("AudioBus").audio.Pause();
         *              wasPlaying = true;
         *      }
         * }*/
    }
Beispiel #9
0
    /// <summary>
    /// A single multiplatform approach for quitting the application/returning to the main menu.
    /// </summary>
    public void QuitCycle()
    {
#if UNITY_WEBPLAYER
        enableTime = true;
        ResumePlay();
        CycleManager.jamState = CycleState.MainMenu;
        Application.LoadLevel(0);
        enableTime = true;
#elif UNITY_EDITOR
        enableTime = true;
        ResumePlay();
        CycleManager.jamState = CycleState.MainMenu;
        Application.LoadLevel(0);
        enableTime = true;
#elif UNITY_STANDALONE_WIN
        Application.Quit();
#endif
    }
 public void SwapState(CycleState newState, bool force)
 {
     if (state == CycleState.Override)
     {
         StopAllCoroutines();
     }
     if(force){
         switch(newState){
             case CycleState.Day:
                 dayNightImage.color = dayColor;
                 break;
             case CycleState.Night:
                 dayNightImage.color = nightColor;
                 break;
             case CycleState.DayToNight:
                 dayNightImage.color = dayColor;
                 break;
             case CycleState.NightToDay:
                 dayNightImage.color = nightColor;
                 break;
         }
         timer = 0;
     }
     else
     {
         switch(newState){
             case CycleState.Day:
                 StartCoroutine(NightToDay(newState));
                 break;
             case CycleState.Night:
                 StartCoroutine(DayToNight(newState));
                 break;
             case CycleState.DayToNight:
                 StartCoroutine(NightToDay(newState));
                 break;
             case CycleState.NightToDay:
                 StartCoroutine(DayToNight(newState));
                 break;
         }
     }
 }
Beispiel #11
0
        private bool executeCurrentCycle()
        {
            if (this.mState != CycleState.INITIALIZED)
            {
                return(false);
            }
            int numOfTask = this.mCycleTasks.Count;

            this.mState = CycleState.PROCESSING;
            for (int i = 0; i < numOfTask; i++)
            {
                TimeoutSyncTask.TOSResult res = this.mCycleTasks[i].execute();
                String result = "Task " + this.mCycleTasks[i].getType().ToString() + ": " + res.ToString();
                Logger.Info("Task {0} result is {1}", i, result);
                //this.EventCycleInfo(result);
                if (this.mState == CycleState.FORCE_TO_STOP)
                {
                    this.mState = CycleState.DONE;
                    return(false);
                }
            }
            this.mState = CycleState.IDILE;
            return(true);
        }
Beispiel #12
0
 private void Btn_right_Click(object sender, RoutedEventArgs e)
 {
     cycleState     = CycleState.left;
     txt_Copy1.Text = "RIGHT";
 }
Beispiel #13
0
 private void Btn_left_Click(object sender, RoutedEventArgs e)
 {
     cycleState     = CycleState.right;
     txt_Copy1.Text = "LEFT";
 }
Beispiel #14
0
        private void CompositionTarget_Rendering(object sender, EventArgs e)
        {
            try
            {
                //if (slider1.Value < 220)
                //    slider1.Value += 1;
                if (isCanSend1)
                {
                    if (cycleState != CycleState.pause)
                    {
                        if (index % 2 == 0)
                        {
                            #region left
                            if (cycleState == CycleState.left)
                            {
                                if (_val < Valmax)
                                {
                                    _val += 1;
                                }
                                else
                                if ((bool)chk1.IsChecked)
                                {
                                    cycleState = CycleState.right;
                                }
                            }
                            #endregion

                            #region right
                            if (cycleState == CycleState.right)
                            {
                                if (_val > 21)
                                {
                                    _val -= 1;
                                }
                                else
                                if ((bool)chk1.IsChecked)
                                {
                                    cycleState = CycleState.left;
                                }
                            }
                            #endregion

                            slider1.Value = _val;
                        }
                    }

                    #region send val position
                    CurrentVal = _val;

                    if (LastVal != CurrentVal)
                    {
                        double _sub = CurrentVal - LastVal;
                        if (cycleState == CycleState.pause || cycleState == CycleState.slider)
                        {
                            if (Math.Abs(_sub) > 1)
                            {
                                if (_sub > 0)
                                {
                                    speed = 1;
                                }
                                if (_sub < 0)
                                {
                                    speed = -1;
                                }
                                LastVal += speed;
                                Console.WriteLine("***************************************************************current value:" + LastVal);
                                Thread.Sleep(60);
                                ComDevice.Write(LastVal.ToString() + ",");
                                if (LastVal == CurrentVal)
                                {
                                    LastVal = _val;
                                }
                            }
                        }
                        if (cycleState == CycleState.left || cycleState == CycleState.right)
                        {
                            Thread.Sleep(60);
                            ComDevice.Write(_val.ToString() + ",");
                            txt.Text = _val.ToString();

                            LastVal = _val;
                            Console.WriteLine("----------------------------------------------------------------------------------------");
                        }
                    }

                    #endregion
                    index++;
                    if (index > 10000)
                    {
                        index = 1;
                    }
                }

                #region 注释



                //    txt_Copy.Text = rees;
                //    if (index % 3 == 0)
                //    {

                //        if (isCanSend1&& IsAutomatic)
                //        {
                //            //ComDevice.Write(CurrentVal.ToString());
                //            if (_val >= 1000)
                //            {
                //                if (_CirCleNum >= 100000000)
                //                    _CirCleNum = 0;
                //                _CirCleNum++;
                //                isBack = false;
                //                _val = 999;
                //                ErrorLog.WriteLog("It's turn back now!++:"+ _CirCleNum);

                //            }
                //            if (_val <= 0)
                //            {
                //                _CirCleNum++;
                //                if (_CirCleNum >= 100000000)
                //                    _CirCleNum = 0;

                //                _val = 1;
                //                isBack = true;
                //                ErrorLog.WriteLog("It's turn back now!--:"+ _CirCleNum);
                //            }
                //            if (isBack)
                //                _val++;
                //            else
                //                _val--;
                //            txt_Copy1.Text = "当前值:" + _val.ToString() + " 第:" + _CirCleNum + "圈";
                //            Console.WriteLine("-------------------------------:" + _val);
                //        }
                //    }
                //    if (isCanSend)
                //    {
                //        isCanSend = false;
                //        ComDevice.Write(_val.ToString() + ",");
                //        _val1 = _val;
                //    }
                //    if (_val1 == _val)
                //        isCanSend = false;
                //    else
                //        isCanSend = true;
                //    index++;
                //    if (index > 10000)
                //        index = 1;

                #endregion
            }
            catch (Exception ex)
            {
                ErrorLog.WriteLog(ex);
                Process.GetCurrentProcess().Kill();
            }
        }
        public void Dispose()
        {
            CyclesStop();
            _ticks = 0;

            _map = null;
            _mapArea.Children.Clear();
            if (_robot != null) _robot.Dispose();
            if (_minimap != null) _minimap.Dispose();

            _lblOutput.Content = "";
            _state = CycleState.Initiated;
        }
 public void CyclesStop()
 {
     _state = CycleState.Paused;
     _dispatcherTimer.Stop();
 }
 private void CyclesStart()
 {
     _state = CycleState.Running;
     _dispatcherTimer.Start();
 }
        private IEnumerable<InstallItem> GetDependencyList(IEnumerable<InstallItem> values, out CycleState cycleState)
        {
            cycleState = CycleState.NoCycle;
              var lookup = (from i in values
                    group i by i.Reference into refGroup
                    select refGroup)
                  .ToDictionary(i => i.Key, i => (IEnumerable<InstallItem>)i);

              IEnumerable<ItemReference> sorted = null;
              IList<ItemReference> cycle = new List<ItemReference>() { null };
              List<XmlNode> refs;

              sorted = lookup.Keys.DependencySort<ItemReference>(d =>
              {
            IEnumerable<InstallItem> res = null;
            if (lookup.TryGetValue(d, out res)) return res.SelectMany(r =>
            {
              var ii = r as InstallItem;
              if (ii == null) return Enumerable.Empty<ItemReference>();
              return _dependAnalyzer.GetDependencies(ii.Reference);
            });
            return Enumerable.Empty<ItemReference>();
              }, ref cycle, false);

              // Attempt to remove cycles by identifying a Relationships tag in one of the cycles
              // and moving the Relationships to the top level
              if (cycle.Count > 0 && (cycle[0] != null || cycle.Count > 1))
              {
            cycleState = CycleState.UnresolvedCycle;
            for (int i = (cycle[0] == null ? 2 : 1); i < cycle.Count; i++)
            {
              refs = _dependAnalyzer.GetReferences(cycle[i - 1], cycle[i]).ToList();
              if (refs.Count == 1)
              {
            var relTag = refs[0].Parents().FirstOrDefault(e => e.LocalName == "Relationships");
            if (relTag != null)
            {
              var parentTag = refs[0].Parents().Last(e => e.LocalName == "Item").Parent();
              foreach (var child in relTag.Elements().ToList())
              {
                child.Detatch();
                parentTag.AppendChild(child);
                var sourceId = (XmlElement)child.AppendChild(child.OwnerDocument.CreateElement("source_id"));
                sourceId.SetAttribute("type", relTag.Parent().Attribute("type"));
                sourceId.SetAttribute("keyed_name", relTag.Parent().Attribute("_keyed_name"));
                sourceId.InnerText = relTag.Parent().Attribute("id");
              }
              relTag.Detatch();
              cycleState = CycleState.ResolvedCycle;
              return Enumerable.Empty<InstallItem>();
            }
              }
            }
              }

              var result = new List<InstallItem>();
              IEnumerable<InstallItem> items = null;
              foreach (var sort in sorted)
              {
            if (lookup.TryGetValue(sort, out items))
            {
              foreach (var item in items)
            result.Add(item);
            }
            else
            {
              result.Add(InstallItem.FromDependency(sort));
            }
              }

              return result;
        }
Beispiel #19
0
        internal IEnumerable <InstallItem> GetDependencyList(DependencyAnalyzer dependAnalyzer
                                                             , IEnumerable <InstallItem> values, out CycleState cycleState)
        {
            cycleState = CycleState.NoCycle;
            var lookup = (from i in values
                          group i by i.Reference into refGroup
                          select refGroup)
                         .ToDictionary(i => i.Key, i => (IEnumerable <InstallItem>)i);

            IEnumerable <ItemReference> sorted = null;
            IList <ItemReference>       cycle  = new List <ItemReference>()
            {
                null
            };
            List <XmlNode> refs;

            // Bias the install order initially to try and help the dependency sort properly handle anything
            // where explicit dependencies don't exist.  Then, perform the dependency sort.
            var initialSort = lookup.Keys
                              .OrderBy(DefaultInstallOrder)
                              .ThenBy(i => i.Type.ToLowerInvariant())
                              .ThenBy(i => i.Unique)
                              .ToList();

            sorted = initialSort.DependencySort <ItemReference>(d =>
            {
                IEnumerable <InstallItem> res = null;
                if (lookup.TryGetValue(d, out res))
                {
                    return(res.SelectMany(r =>
                    {
                        var ii = r as InstallItem;
                        if (ii == null)
                        {
                            return Enumerable.Empty <ItemReference>();
                        }
                        return dependAnalyzer.GetDependencies(ii.Reference);
                    }));
                }

                return(Enumerable.Empty <ItemReference>());
            }, ref cycle, false);

            // Attempt to remove cycles by identifying a Relationships tag in one of the cycles
            // and moving the Relationships to the top level
            if (cycle.Count > 0 && (cycle[0] != null || cycle.Count > 1))
            {
                cycleState = CycleState.UnresolvedCycle;
                for (int i = (cycle[0] == null ? 2 : 1); i < cycle.Count; i++)
                {
                    refs = dependAnalyzer.GetReferences(cycle[i - 1], cycle[i]).ToList();
                    if (refs.Count == 1)
                    {
                        var relTag = refs[0].Parents().FirstOrDefault(e => e.LocalName == "Relationships");
                        if (relTag != null)
                        {
                            var parentTag = refs[0].Parents().Last(e => e.LocalName == "Item").Parent();
                            foreach (var child in relTag.Elements().ToList())
                            {
                                child.Detach();
                                parentTag.AppendChild(child);
                                var sourceId = (XmlElement)child.AppendChild(child.OwnerDocument.CreateElement("source_id"));
                                sourceId.SetAttribute("type", relTag.Parent().Attribute("type"));
                                sourceId.SetAttribute("keyed_name", relTag.Parent().Attribute("_keyed_name"));
                                sourceId.InnerText = relTag.Parent().Attribute("id");
                            }
                            relTag.Detach();
                            cycleState = CycleState.ResolvedCycle;
                            //return Enumerable.Empty<InstallItem>();
                        }
                    }
                }
            }

            var result = new List <InstallItem>();
            IEnumerable <InstallItem> items = null;

            foreach (var sort in sorted)
            {
                if (lookup.TryGetValue(sort, out items))
                {
                    foreach (var item in items)
                    {
                        result.Add(item);
                    }
                }
                else
                {
                    result.Add(InstallItem.FromDependency(sort));
                }
            }

            return(result);
        }
    // Use this for initialization
    void Start()
    {
        timer = 0;
        if (state == CycleState.DayToNight || state == CycleState.NightToDay || state == CycleState.Override)
            state = CycleState.Day;

        if (state == CycleState.Day)
        {
            dayNightImage.color = dayColor;
        }
        else
        {
            dayNightImage.color = nightColor;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if(!paused)
            timer += Time.deltaTime;
        switch (state)
        {
            case CycleState.Day:
                if (timer >= dayDuration)
                {
                    timer = 0;
                    state = CycleState.DayToNight;
                }
                break;
            case CycleState.DayToNight:
                dayNightImage.color = Color.Lerp(dayColor, nightColor, timer / dayToNightDuration);
                if (timer >= dayToNightDuration)
                {
                    timer = 0;
                    state = CycleState.Night;
                    dayNightImage.color = nightColor;
                }
                break;
            case CycleState.Night:
                if (timer >= nightDuration)
                {
                    timer = 0;
                    state = CycleState.NightToDay;
                }
                break;
            case CycleState.NightToDay:
                dayNightImage.color = Color.Lerp(nightColor, dayColor, timer / nightToDayDuration);
                if (timer >= nightToDayDuration)
                {
                    timer = 0;
                    state = CycleState.Day;
                    dayNightImage.color = dayColor;
                }
                break;
            case CycleState.Override:

                break;
        }
    }
Beispiel #22
0
 private void Btn_pause_Click(object sender, RoutedEventArgs e)
 {
     cycleState     = CycleState.pause;
     txt_Copy1.Text = "PAUSE";
 }
 IEnumerator DayToNight(CycleState newState)
 {
     float counter = 0;
     Color startColor = dayNightImage.color;
     while (counter < nightToDayDuration)
     {
         counter += Time.deltaTime;
         dayNightImage.color = Color.Lerp(startColor, nightColor, counter / dayToNightDuration);
         yield return null;
     }
     dayNightImage.color = nightColor;
     timer = 0;
     state = newState;
 }
Beispiel #24
0
    void OnGUI()
    {
        switch (CycleManager.jamState)
        {
            #region Main Menu
        case CycleState.MainMenu:
            if (GUI.Button(new Rect(Screen.width / 3, Screen.height - 250, Screen.width / 3, 100), "Begin CycleJam!"))
            {
                entriesNotPlayed = FindJamEntries();
                entriesPlayed.Clear();

                ResumePlay();

                //This is somewhat hacky. We only ever advance scenes through time running out.
                AdvanceToNext();
            }

            DrawQuitButton();

            #region Cycle Forever Button
            string buttonText = "Cycle Forever?\n";

            //Setting text based on which creates more personality.
            if (CycleManager.Instance.cycleForever)
            {
                buttonText += "Definitely";
            }
            else
            {
                buttonText += "Just once please.";
            }
            //Draw the button
            if (GUI.Button(new Rect(30, Screen.height - 170, 150, 40), buttonText))
            {
                //Toggle the boolean.
                CycleManager.Instance.cycleForever = !CycleManager.Instance.cycleForever;
            }
            #endregion

            #region Main Menu Digit Setting
            //A box for this little submenu
            GUI.Box(new Rect(10, Screen.height - 120, 190, 110), "Code Control");

            //A set of horizontal sliders for each. This uses some private floats to hold the values in the meantime.
            first  = GUI.HorizontalSlider(new Rect(20, Screen.height - 90, 150, 20), first, 0, 9);
            second = GUI.HorizontalSlider(new Rect(20, Screen.height - 70, 150, 20), second, 0, 9);
            third  = GUI.HorizontalSlider(new Rect(20, Screen.height - 50, 150, 20), third, 0, 9);
            fourth = GUI.HorizontalSlider(new Rect(20, Screen.height - 30, 150, 20), fourth, 0, 9);

            //We assign our digit values the integer values. The reason this works is because it keeps assigning the float to 3.4, but once it moves to 3.6, it will round up to 4, creating a integer slider.
            FirstDigit  = (int)first;
            SecondDigit = (int)second;
            ThirdDigit  = (int)third;
            FourthDigit = (int)fourth;

            //Reassign our new value so the slider snaps to integer values every frame.
            first  = (int)first;
            second = (int)second;
            third  = (int)third;
            fourth = (int)fourth;

            //Draw labels with the Digits so the user can easily see what values they have selected.
            GUI.Label(new Rect(180, Screen.height - 95, 10, 20), FirstDigit.ToString());
            GUI.Label(new Rect(180, Screen.height - 75, 10, 20), SecondDigit.ToString());
            GUI.Label(new Rect(180, Screen.height - 55, 10, 20), ThirdDigit.ToString());
            GUI.Label(new Rect(180, Screen.height - 35, 10, 20), FourthDigit.ToString());
            #endregion
            break;
            #endregion

            #region Paused
        case CycleState.Paused:

            //Contains no base pause menu currently. Individual devs make a pause menu on top of this.
            GUI.Box(new Rect(-5, -5, Screen.width + 5, Screen.height + 5), "");


            DrawTimeRemaining();

            //Pause menu elements
            DrawNextButton();
            DrawStopClockButton();
            DrawQuitButton();
            break;
            #endregion

            #region Playing
        case CycleState.Playing:

            DrawTimeRemaining();
            break;
            #endregion

            #region End
        case CycleState.End:
            //Need a way to reset to main menu to keep the play loop going.
            if (GUI.Button(new Rect(Screen.width / 3, Screen.height - 60, Screen.width / 3, 40), "Back to Main Menu!"))
            {
                ResumePlay();
                CycleManager.jamState = CycleState.MainMenu;
                Application.LoadLevel(0);
            }

            DrawQuitButton();
            break;
            #endregion
        }

#if UNITY_EDITOR
        //Will only draw in the editor. Will not draw in built versions
        DrawDebugInfo(CycleManager.jamState.ToString() + "\n" + GetDigitString());
#else
        if (Debug.isDebugBuild)
        {
            DrawDebugInfo(CycleManager.jamState.ToString() + "\n" + GetDigitString());
        }
#endif
    }
Beispiel #25
0
 private void Btn_slider_Click(object sender, RoutedEventArgs e)
 {
     cycleState     = CycleState.slider;
     txt_Copy1.Text = "USE SLIDER";
 }
Beispiel #26
0
    /// <summary>
    /// Loads a random JamEntry that has not been played in the current cycle.
    /// Updates the EntriesPlayed List.
    /// </summary>
    void LoadRandomEntry()
    {
        int nextLevel = -1;
        int nextEntry = -1;

        //This is for output information.
        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        //EntriesNotPlayed is reset every loop. If we still have an entries we have not played this loop
        if (entriesNotPlayed.Count > 0)
        {
            //We need to reset the time.
            timeLeft = timePerLevel;

            //Pick one of the unplayed entries at random.
            nextEntry = Random.Range(0, entriesNotPlayed.Count);

            sb.AppendLine("Changing Scene from \t[" + Application.loadedLevel + "]" + Application.loadedLevelName + "\tto\t" + entriesNotPlayed[nextEntry].scenes[0]);

            JamEntry selectedEntry = entriesNotPlayed[nextEntry];

            //Move the selected entry from the 'Not played' to the 'Played' list.
            entriesNotPlayed.RemoveAt(nextEntry);
            entriesPlayed.Add(selectedEntry);

            //Make sure we update the state otherwise it'll stay paused in the new entry.
            CycleManager.jamState = CycleState.Playing;

            //Clear any existing singletons from the previous scene out.
            ClearSingletons();

            //Load the first listed scene in the Selected Entry.
            Application.LoadLevel(selectedEntry.scenes[0]);
        }
        //This case occurs when we have no entries left unplayed this loop.
        else
        {
            //If we want to cycle forever like Groundhog day, just reset the list of unplayed entries.
            if (cycleForever)
            {
                entriesNotPlayed = FindJamEntries();

                //Note, we don't reset EntriesPlayed because that list will constantly grow in length giving a 'play path'
                //This does not support someone playing more entries than the maximum size of a list, but this is an unlikely problem.
            }
            //If we don't want to play forever, we go to the credits.
            else
            {
                //The credits scene should be the last scene. Could also load it by name.
                nextLevel = Application.levelCount - 1;
                sb.AppendLine("Changing to Credits Scene.");

                CycleManager.jamState = CycleState.End;

                //Clear any existing singletons from the previous scene out.
                ClearSingletons();

                Application.LoadLevel(nextLevel);

                //No time limit on the credits scene.
                timeLeft = float.MaxValue;

                //Don't even show the clock on the credits scene.
                enableTime = false;
            }
        }


#if UNITY_EDITOR
        //Will only print out in dev builds or in the editor. Minor computation saving in built versions.
        ConcatOutput(sb);
#else
        if (Debug.isDebugBuild)
        {
            ConcatOutput(sb);
        }
#endif
    }