Example #1
0
        private void BuildVertices(Vector4 mapSize)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();


            sw.Start();
            WorldGenerator.generateRegionMapLOD(out this.Vertices, out this.sector, out this.resources, (int)mapSize.X, (int)mapSize.Y, (int)mapSize.Z, (int)mapSize.W);
            sw.Stop();
            Console.WriteLine("map generation took: " + sw.ElapsedMilliseconds.ToString() + " ms");
            GameSession.GameStorage storage = new GameSession.GameStorage("map.dat", true);
            storage.Write(mapSize);
            storage.Write(this.Vertices.Length);
            for (int i = 0; i < this.Vertices.Length; i++)
            {
                storage.Write(this.Vertices[i]);
            }
            storage.Write(this.sector.Length);
            for (int i = 0; i < this.sector.Length; i++)
            {
                storage.Write(this.sector[i]);
            }
            storage.Write(this.resources.Length);
            for (int i = 0; i < this.resources.Length; i++)
            {
                this.resources[i].Store(storage);
            }

            storage.Close();
        }