CalculateThreadCount() public static méthode

public static CalculateThreadCount ( ThreadCount count ) : int
count ThreadCount
Résultat int
Exemple #1
0
    private void InitializePathProcessor()
    {
        int  num        = AstarPath.CalculateThreadCount(this.threadCount);
        int  processors = Mathf.Max(num, 1);
        bool flag       = num > 0;

        this.pathProcessor = new PathProcessor(this, this.pathReturnQueue, processors, flag);
        this.pathProcessor.OnPathPreSearch += delegate(Path path)
        {
            OnPathDelegate onPathPreSearch = AstarPath.OnPathPreSearch;
            if (onPathPreSearch != null)
            {
                onPathPreSearch(path);
            }
        };
        this.pathProcessor.OnPathPostSearch += delegate(Path path)
        {
            this.LogPathResults(path);
            OnPathDelegate onPathPostSearch = AstarPath.OnPathPostSearch;
            if (onPathPostSearch != null)
            {
                onPathPostSearch(path);
            }
        };
        if (flag)
        {
            this.graphUpdates.EnableMultithreading();
        }
    }
Exemple #2
0
 private void Awake()
 {
     if (this.simulator == null)
     {
         int workers = AstarPath.CalculateThreadCount(this.workerThreads);
         this.simulator = new Simulator(workers, this.doubleBuffering);
     }
 }
 void Awake()
 {
     if (simulator == null)
     {
         int threadCount = AstarPath.CalculateThreadCount(workerThreads);
         simulator = new Pathfinding.RVO.Simulator(threadCount, doubleBuffering);
     }
 }
 // Token: 0x0600290A RID: 10506 RVA: 0x001BF0B0 File Offset: 0x001BD2B0
 protected override void Awake()
 {
     base.Awake();
     if (this.simulator == null && Application.isPlaying)
     {
         int workers = AstarPath.CalculateThreadCount(this.workerThreads);
         this.simulator = new Simulator(workers, this.doubleBuffering, this.movementPlane);
     }
 }
Exemple #5
0
 protected override void Awake()
 {
     base.Awake();
     if (simulator == null && Application.isPlaying)
     {
         int threadCount = AstarPath.CalculateThreadCount(workerThreads);
         simulator = new Pathfinding.RVO.Simulator(threadCount, doubleBuffering, movementPlane);
     }
 }
Exemple #6
0
 public ParallelWorkQueue(Queue <T> queue)
 {
     this.queue   = queue;
     initialCount = queue.Count;
                 #if (UNITY_WEBGL && !UNITY_EDITOR)
     threadCount = 1;
                 #else
     threadCount = System.Math.Min(initialCount, System.Math.Max(1, AstarPath.CalculateThreadCount(ThreadCount.AutomaticHighLoad)));
                 #endif
 }
        public ParallelWorkQueue(Queue <T> queue)
        {
            this.queue   = queue;
            initialCount = queue.Count;
#if SINGLE_THREAD
            threadCount = 1;
#else
            threadCount = System.Math.Min(initialCount, System.Math.Max(1, AstarPath.CalculateThreadCount(ThreadCount.AutomaticHighLoad)));
#endif
        }
 protected override void Awake()
 {
     base.Awake();
     // We need to set active during Awake as well to ensure it is set when graphs are being scanned.
     // That is important if the RVONavmesh component is being used.
     active = this;
     if (simulator == null && Application.isPlaying)
     {
         int threadCount = AstarPath.CalculateThreadCount(workerThreads);
         simulator = new Pathfinding.RVO.Simulator(threadCount, doubleBuffering, movementPlane);
     }
 }
Exemple #9
0
 private void Awake()
 {
     if (this.desiredSimulationFPS < 1)
     {
         this.desiredSimulationFPS = 1;
     }
     if (this.simulator == null)
     {
         int workers = AstarPath.CalculateThreadCount(this.workerThreads);
         this.simulator = new Simulator(workers, this.doubleBuffering);
         this.simulator.Interpolation    = this.interpolation;
         this.simulator.DesiredDeltaTime = 1f / ((float)this.desiredSimulationFPS);
     }
 }
Exemple #10
0
    void Awake()
    {
        if (desiredSimulatonFPS < 1)
        {
            desiredSimulatonFPS = 1;
        }

        if (simulator == null)
        {
            int threadCount = AstarPath.CalculateThreadCount(workerThreads);
            simulator = new Pathfinding.RVO.Simulator(threadCount, doubleBuffering);
            simulator.Interpolation    = interpolation;
            simulator.DesiredDeltaTime = 1.0f / desiredSimulatonFPS;
        }
    }
Exemple #11
0
        void Awake()
        {
            if (desiredSimulatonFPS < 1)
            {
                desiredSimulatonFPS = 1;
            }

            if (simulator == null)
            {
                int threadCount = AstarPath.CalculateThreadCount(workerThreads);
                simulator = new Pathfinding.RVO.Simulator(threadCount, doubleBuffering);
                simulator.Interpolation    = interpolation;
                simulator.DesiredDeltaTime = 1.0f / desiredSimulatonFPS;
            }

            /*Debug.LogWarning ("RVO Local Avoidance is temporarily disabled in the A* Pathfinding Project due to licensing issues.\n" +
             * "I am working to get it back as soon as possible. All agents will fall back to not avoiding other agents.\n" +
             * "Sorry for the inconvenience.");*/
        }
    // Token: 0x06000031 RID: 49 RVA: 0x00002984 File Offset: 0x00000B84
    private void InitializePathProcessor()
    {
        int num = AstarPath.CalculateThreadCount(this.threadCount);

        if (!Application.isPlaying)
        {
            num = 0;
        }
        int  processors = Mathf.Max(num, 1);
        bool flag       = num > 0;

        this.pathProcessor = new PathProcessor(this, this.pathReturnQueue, processors, flag);
        this.pathProcessor.OnPathPreSearch += delegate(Path path)
        {
            OnPathDelegate onPathPreSearch = AstarPath.OnPathPreSearch;
            if (onPathPreSearch != null)
            {
                onPathPreSearch(path);
            }
        };
        this.pathProcessor.OnPathPostSearch += delegate(Path path)
        {
            this.LogPathResults(path);
            OnPathDelegate onPathPostSearch = AstarPath.OnPathPostSearch;
            if (onPathPostSearch != null)
            {
                onPathPostSearch(path);
            }
        };
        this.pathProcessor.OnQueueUnblocked += delegate()
        {
            if (this.euclideanEmbedding.dirty)
            {
                this.euclideanEmbedding.RecalculateCosts();
            }
        };
        if (flag)
        {
            this.graphUpdates.EnableMultithreading();
        }
    }
Exemple #13
0
 private void Awake()
 {
     if (RVOSimulator.Instance == null)
     {
         RVOSimulator.Instance = this;
     }
     else if (RVOSimulator.Instance != this)
     {
         RVOSimulator.Instance.enabled = false;
         RVOSimulator.Instance         = this;
     }
     if (this.desiredSimulationFPS < 1)
     {
         this.desiredSimulationFPS = 1;
     }
     if (this.simulator == null)
     {
         int workers = AstarPath.CalculateThreadCount(this.workerThreads);
         this.simulator = new Simulator(workers, this.doubleBuffering);
         this.simulator.Interpolation = this.interpolation;
     }
 }
Exemple #14
0
 // Token: 0x060029C7 RID: 10695 RVA: 0x001C42EF File Offset: 0x001C24EF
 public ParallelWorkQueue(Queue <T> queue)
 {
     this.queue        = queue;
     this.initialCount = queue.Count;
     this.threadCount  = Math.Min(this.initialCount, Math.Max(1, AstarPath.CalculateThreadCount(ThreadCount.AutomaticHighLoad)));
 }