Пример #1
0
 public bool Validate(Fiber inFiber)
 {
     return(inFiber.HasHost(Host));
 }
Пример #2
0
 public bool Validate(Fiber inFiber)
 {
     return(inFiber.HasHost(Host) && inFiber.HasName(Name));
 }
Пример #3
0
 public bool Validate(Fiber inFiber)
 {
     return(true);
 }
Пример #4
0
 public bool Validate(Fiber inFiber)
 {
     return(inFiber.HasHost(Host) && inFiber.HasGroups(GroupMask));
 }
Пример #5
0
 /// <summary>
 /// Adds a Fiber to the free list.
 /// </summary>
 public void AddFreeFiber(Fiber inFiber)
 {
     AddFirst(inFiber, ref m_FreeList);
 }
Пример #6
0
        /// <summary>
        /// Manually updates the given routine.
        /// </summary>
        public bool ManualUpdate(Fiber inFiber, float inDeltaTime)
        {
            if (!inFiber.PrepareManualUpdate())
            {
                return(false);
            }

            Frame oldFrame      = Frame;
            bool  bPrevUpdating = m_Updating;

            if (bPrevUpdating)
            {
                // Copy this, so we have a consistent group time scale
                // for any previous updates
                oldFrame.GroupTimeScale = (float[])oldFrame.GroupTimeScale.Clone();
            }

            Frame.IncrementSerial();
            Frame.ResetTime(inDeltaTime, TimeScale);
            Frame.PauseMask = m_QueuedPauseMask;
            if (m_GroupTimescaleDirty)
            {
                if (!bPrevUpdating)
                {
                    m_GroupTimescaleDirty = false;
                }
                Array.Copy(m_QueuedGroupTimescale, Frame.GroupTimeScale, Routine.MAX_GROUPS);
            }

            m_Updating = true;
            {
                #if DEVELOPMENT
                if (m_DebugMode && !bPrevUpdating && ProfilingEnabled)
                {
                    m_UpdateTimer.Reset();
                    m_UpdateTimer.Start();

                    if (m_NeedsSnapshot)
                    {
                        m_Snapshot      = GetRoutineStats();
                        m_NeedsSnapshot = false;
                    }

                    Fibers.RunManualUpdate(inFiber);
                    Frame.ResetTimeScale();

                    m_UpdateTimer.Stop();

                    m_TotalUpdateTime += m_UpdateTimer.ElapsedTicks;
                }
                else
                #endif // DEVELOPMENT
                {
                    Fibers.RunManualUpdate(inFiber);
                    Frame.ResetTimeScale();
                }
            }
            m_Updating = bPrevUpdating;
            Frame      = oldFrame;

            if (!m_Updating)
            {
                if (m_Destroying)
                {
                    m_Destroying = false;
                    Destroy();
                }
            }

            return(true);
        }
Пример #7
0
 /// <summary>
 /// Adds a Fiber to the active list.
 /// </summary>
 public void AddActiveFiber(Fiber inFiber)
 {
     AddLast(inFiber, ref m_ActiveList);
 }
Пример #8
0
 /// <summary>
 /// Removes a Fiber from the active list.
 /// </summary>
 public void RemoveActiveFiber(Fiber inFiber)
 {
     RemoveEntry(inFiber, ref m_ActiveList);
 }
Пример #9
0
 /// <summary>
 /// Sets the parent Fiber to use for time scaling.
 /// </summary>
 public void SetParentFiber(Fiber inFiber)
 {
     m_RootFiber = inFiber.m_RootFiber == null ? inFiber : inFiber.m_RootFiber;
 }
Пример #10
0
        /// <summary>
        /// Cleans up the Fiber.
        /// </summary>
        public void Dispose()
        {
            if ((uint)m_Handle == 0)
            {
                return;
            }

            if (m_UnityWait != null)
            {
                Manager.Host.StopCoroutine(m_UnityWait);
                m_UnityWait = null;
            }

            bool bKilled  = m_StackPosition >= 0;
            bool bChained = m_Chained;

            ClearStack();

            m_Handle       = Routine.Null;
            m_Host         = null;
            m_HostIdentity = null;

            // If this is chained and we have a parallel
            if (bChained && m_Parallel != null)
            {
                m_Parallel.RemoveFiber(this);
            }

            m_Chained = m_Disposing = m_HasIdentity
                                          = m_Paused = m_IgnoreObjectTimescale = m_HostedByManager
                                                                                     = m_IgnoreObjectActive = m_Executing = false;

            m_WaitTime = 0;
            m_Name     = null;
            Priority   = 0;

            m_Parallel  = null;
            m_RootFiber = null;

            m_TimeScale       = 1.0f;
            m_YieldFrameDelay = 0;

            if (m_YieldPhase != YieldPhase.None)
            {
                Manager.Fibers.RemoveFiberFromYieldList(this, m_YieldPhase);
                m_YieldPhase = YieldPhase.None;
            }

            if (!bChained)
            {
                Manager.Fibers.RemoveFiberFromUpdateList(this, m_UpdatePhase);
            }
            Manager.RecycleFiber(this, bChained);

            m_UpdatePhase      = Manager.DefaultPhase;
            m_OnException      = null;
            m_HandleExceptions = false;

            if (bKilled)
            {
                m_OnComplete = null;
                Action onStop = m_OnStop;
                m_OnStop = null;
                if (onStop != null)
                {
                    onStop();
                }
            }
            else
            {
                m_OnStop = null;
                Action onComplete = m_OnComplete;
                m_OnComplete = null;
                if (onComplete != null)
                {
                    onComplete();
                }
            }
        }
Пример #11
0
 public void Dispose()
 {
     m_Current = 0;
     m_Fiber   = null;
 }
Пример #12
0
 public WaitEnumerator(Fiber inFiber)
 {
     m_Fiber   = inFiber;
     m_Current = (uint)m_Fiber.m_Handle;
 }
Пример #13
0
 void INestedFiberContainer.SetParentFiber(Fiber inFiber)
 {
     m_ParentFiber = inFiber;
 }