Example #1
0
        private void Updates()
        {
            long last_update_time = 0;

            Stopwatch timer = new Stopwatch();

            timer.Start();

            while (!m_ShouldStopUpdates)
            {
                long time = timer.ElapsedMilliseconds;

                if (Enabled && (m_ForceReevaluation || (m_UpdateExplorationInterval > 0 && (time - last_update_time) > m_UpdateExplorationInterval) || m_Navigator.GetDestinationType() < DestType.Explore))
                {
                    last_update_time = time;

                    //using (new Profiler("[Nav] Nav updated [%t]"))
                    UpdateExploration();

                    m_ForceReevaluation = false;
                }
                else
                {
                    Thread.Sleep(50);
                }
            }
        }
Example #2
0
        private void Updates()
        {
            long last_update_time = 0;

            Stopwatch timer = new Stopwatch();

            timer.Start();

            while (!m_ShouldStopUpdates)
            {
                long time = timer.ElapsedMilliseconds;

                var forceReevaluation = Interlocked.CompareExchange(ref m_ForceReevaluation, 0, 1) == 1;
                if (forceReevaluation || (m_UpdateExplorationInterval > 0 && (time - last_update_time) > m_UpdateExplorationInterval) || (Enabled && m_Navigator.GetDestinationType() < DestType.Explore))
                {
                    last_update_time = time;

                    lock (UpdateLocker)
                    {
                        //using (new Profiler("[Nav] Nav updated [%t]"))
                        UpdateExploration(forceReevaluation, false);
                    }
                }
                else
                {
                    Thread.Sleep(50);
                }
            }
        }