private void AsyncPathProbe()
        {
            int probeSize = this.probeSize;

            pathProbeJob.Reset(null);
            for (int i = 0; i != brains.Count; i++)
            {
                ClampBrainIndex(ref nextPathProbeBrain);
                Navigator component = brains[nextPathProbeBrain].GetComponent <Navigator>();
                IncrementBrainIndex(ref nextPathProbeBrain);
                if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                {
                    component.executePathProbeTaskAsync          = true;
                    component.PathProber.potentialCellsPerUpdate = this.probeSize;
                    component.pathProbeTask.Update();
                    pathProbeJob.Add(component.pathProbeTask);
                    if (pathProbeJob.Count == probeCount)
                    {
                        break;
                    }
                }
            }
            CPUBudget.Start(this);
            GlobalJobManager.Run(pathProbeJob);
            CPUBudget.End(this);
        }
예제 #2
0
 public void TriggerStart()
 {
     if (budget != null && FastTrackMod.GameRunning)
     {
         lock (CPU_BUDGET_LOCK) {
             CPUBudget.Start(budget);
         }
     }
     time.Restart();
 }
예제 #3
0
 public void TriggerComplete()
 {
     runtime = time.ElapsedTicks;
     if (budget != null && FastTrackMod.GameRunning)
     {
         lock (CPU_BUDGET_LOCK) {
             CPUBudget.End(budget);
         }
     }
     Instance?.OnPathComplete(this);
 }
 protected override void OnPrefabInit()
 {
     brainGroups.Add(new DupeBrainGroup());
     brainGroups.Add(new CreatureBrainGroup());
     Components.Brains.Register(OnAddBrain, OnRemoveBrain);
     CPUBudget.AddRoot(this);
     foreach (BrainGroup brainGroup in brainGroups)
     {
         CPUBudget.AddChild(this, brainGroup, brainGroup.LoadBalanceThreshold());
     }
     CPUBudget.FinalizeChildren(this);
 }