Example #1
0
 public Coroutine(CoroutineGroup group, IEnumerator routine)
 {
     this.Group             = group;
     this.Routine           = routine;
     this.CreatedFrameCount = UnityEngine.Time.frameCount;
     this.Status            = Status.RUNNING;
 }
Example #2
0
        /**
         * --- DOC BEGIN ---
         * Coroutine will be executed in *LateUpdate*
         * --- DOC END ---
         */
        public Coroutine Run(IEnumerator routine, CoroutineGroup group = null)
        {
            if (group == null)
            {
                group = CoroutineGroup.DEFAULT;
            }

            LinkedList <Coroutine> coroutines;

            if (this._coroutineGroups.TryGetValue(group, out coroutines) == false)
            {
                coroutines = new LinkedList <Coroutine>();
                this._coroutineGroups[group] = coroutines;
            }

            // var coroutine = new Coroutine(group, routine);
            var coroutine = ObjectPool.Instance.Alloc <Coroutine>(group, routine);

            coroutines.AddLast(coroutine);

            return(coroutine);
        }