Ejemplo n.º 1
0
        private static void BuildNavmeshes()
        {
            WorldMgr.Init();
            Log.Normal("-----------------------------------------------------------------------------");
            Log.Normal("Building recast navmeshes!");

            var zones = GetZonesToBuild().Distinct().Shuffle().ToArray();

            Log.Normal("We will be creating {0} zones today. Right here. Right now.", zones.Length);
            Log.Normal("-----------------------------------------------------------------------------");
            Log.Normal("");
            Console.Title = "NavGen";
            int finishedZones = 0;
            var po            = new ParallelOptions()
            {
                MaxDegreeOfParallelism = 6
            };

            Parallel.Invoke(po, zones.Select(z => new Action(() => {
#if !DEBUG
                try
                {
#endif
                NavmeshMgr.BuildNavMesh(z);
#if !DEBUG
            }
                                                             catch (Exception ex)
            {
                Log.Error(ex);
            }
#endif
                int finished  = Interlocked.Increment(ref finishedZones);
                Console.Title = String.Format("[{2}%] NavGen {0}/{1}", finished, zones.Length, finished * 100 / zones.Length);
            })).ToArray());
        }
Ejemplo n.º 2
0
        public Zone2Obj(Zone2 zone)
        {
            Zone = zone;
            if (!Directory.Exists("zones"))
            {
                Directory.CreateDirectory("zones");
            }
            string filename = Path.Combine("zones", string.Format("zone{0:D3}", zone.ID));

            DoorWriter    = new DoorWriter(filename + ".doors");
            GeomSetWriter = new GeomSetWriter(filename + ".geomset");
            ObjWriter     = new WavefrontObjFile(filename + ".obj")
            {
                Scale = MESH_SCALE
            };
            GeomSetWriter.WriteLoadMesh(filename + ".obj");
            FirstPass = !NavmeshMgr.IsPathingEnabled(zone);
        }
Ejemplo n.º 3
0
 private Vector3 GetClosestNavmeshPoint(Vector3 v, float xRange, float yRange, float zRange)
 {
     return(NavmeshMgr.GetClosestPoint(Zone, v, xRange, yRange, zRange) ?? Vector3.Zero);
 }