public NavMeshTemplateCreation(Dictionary <XZPosInt, YRangeInt> chunkRange, AreaPassabilityHashData hashData, XZPosInt gridPosition, AgentProperties properties)
 {
     this.gridPosition = gridPosition;
     this.hashData     = hashData;
     this.properties   = properties;
     this.chunkRange   = chunkRange;
 }
        private AreaPassabilityHashData(AreaPassabilityHashData origin)
        {
            _globalPool = new HashSet <Area>(origin._globalPool);
            _localPool  = new HashSet <Area>(origin._localPool);

            if (origin._localPool.Count != 0)
            {
                Debug.LogWarning("Pthfinder expect to not have local area while it makes copy itself but somehow it exists");
            }
        }
Пример #3
0
        //all this awesome pipeline
        //threaded
        public override void Work()
        {
            if (profiler != null)
            {
                profiler.AddLog("start thread", Color.green);
                profiler.StartThreadStuff();
            }

            if (stop)
            {
                if (profiler != null)
                {
                    profiler.Abort();
                }
                return;
            }

            VolumeContainer volumes = new VolumeContainer(this);

            if (profiler != null)
            {
                profiler.AddLog("start collecting volumes", Color.green);
            }
            _terrainCollector.Collect(volumes);
            if (profiler != null)
            {
                profiler.AddLog("terrain collected");
            }
            _primitivesCollector.Collect(volumes);
            if (profiler != null)
            {
                profiler.AddLog("collected");
            }


            hashData = PathFinder.CloneHashData();

            if (stop)
            {
                if (profiler != null)
                {
                    profiler.Abort();
                }
                return;
            }

            if (profiler != null)
            {
                profiler.AddLog("volumes container start doing stuff");
            }
            volumes.DoStuff();
            if (profiler != null)
            {
                profiler.AddLog("volumes container end doing stuff");
            }

            if (stop)
            {
                if (profiler != null)
                {
                    profiler.Abort();
                }
                return;
            }

            if (profiler != null)
            {
                profiler.AddLog("graph generator start doing stuff", Color.green);
            }
            GraphGenerator generator = new GraphGenerator(volumes, this);
            Graph          graph     = generator.MakeGraph();

            if (profiler != null)
            {
                profiler.AddLog("graph generator end making graph");
            }

            if (stop)
            {
                if (profiler != null)
                {
                    profiler.Abort();
                }
                return;
            }

            if (profiler != null)
            {
                profiler.AddLog("end thread", Color.green);
                profiler.EndThreadStuff();
                profiler.EndProfile();
                profiler.DebugLog(ProfilderLogMode.log);
            }

            GC.Collect();


            //Graph graph = new Graph(chunk, properties);
            if (onEndCallBack != null)
            {
                onEndCallBack.Invoke(graph);
            }
        }
 private AreaPassabilityHashData(AreaPassabilityHashData origin)
 {
     _areaPool   = new HashSet <Area>(origin._areaPool);
     _areaToHash = new Dictionary <AreaPassabilityPair, int>(origin._areaToHash);
     _hashToArea = new Dictionary <int, AreaPassabilityPair>(origin._hashToArea);
 }