Skip to content
Snippets Groups Projects
Select Git revision
  • f012cc78bd3b0424fbde929083eefb061e8e41b3
  • master default
  • JS-based-scroll-rendering
  • Paul_Marius_Level
  • Paul_Marius_2
  • Paul_Marius
  • Andi_Mark
  • be-UnityWebView
  • gitignoreFrameitServer
  • ZimmerBSc
  • Bugfix_StageLoading
  • stages
  • MAZIFAU_Experimental
  • tsc/coneworld
  • tsc/fact-interaction
  • marcel
  • MaZiFAU_TopSort
  • mergeHelper
  • zwischenSpeichern
  • tempAndrToMaster
  • SebBranch
  • 3.0
  • v2.1
  • v2.0
  • v1.0
25 results

IEnumeratorExtensions.cs

Blame
  • user avatar
    MaZiFAU authored
    parseFact as IEnumerator;
    + noticably slower than non IEterator
    + but less stillframes
    + maybe go multithreaded?
    
    Bugfixes;
    + FasrForward() has issue for nested Ienumerables
    + Saving/Loading Dynamic<List/Tuple>Facts fixxed
    +-> need to reduce amount of loading savegames
    f012cc78
    History
    IEnumeratorExtensions.cs 791 B
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public static class IEnumeratorExtensions
    {
        public static void FastForward(this IEnumerator that)
        {
            while (that.MoveNext())
                if(that.Current is IEnumerator next)
                    next.FastForward();
        }
    
        public static IEnumerator yield_break => _YieldBreak;
        private static IEnumerator _YieldBreak = YieldBreak();
        public static IEnumerator YieldBreak()
        {
            yield break;
        }
    
        public static IEnumerator<float> ClockForSeconds(float time)
        {
            if (time < 0) 
                yield break;
    
            for (float current_time = 0; time > current_time; current_time += Time.deltaTime)
                yield return current_time;
    
            yield return time;
        }
    }