Пример #1
0
        public Terrain(string terrainFileName)//FITFile terrainFitFile)
        {
            terrainName = terrainFileName;

            string TerrainFileName = System.IO.Path.ChangeExtension(terrainFileName, "fit");

            FITFile terrainFitFile = new FITFile(MechCommanderUnity.Instance.FileManager.File(MCGExtensions.PathCombine(new string[] { "terrain", TerrainFileName })));

            terrainFitFile.SeekSection("TerrainData");

            terrainFitFile.GetInt("VerticesBlockSide", out this.verticesBlockSide);
            terrainFitFile.GetInt("BlocksMapSide", out this.blocksMapSide);

            terrainFitFile.GetFloat("MetersPerElevLevel", out this.MetersPerElevLevel);
            terrainFitFile.GetFloat("MetersPerVertex", out this.MetersPerVertex);

            terrainFitFile.GetInt("VisibleVerticesPerSide", out this.visibleVerticesPerSide);

            terrainFitFile.SeekSection("TileData");

            string TerrainTileFile;

            terrainFitFile.GetString("TerrainTileFile", out TerrainTileFile);

            this.realVerticesMapSide = this.verticesBlockSide * this.blocksMapSide;
            this.halfVerticesMapSide = this.realVerticesMapSide / 2;

            this.worldUnitsMapSide = this.realVerticesMapSide * MetersPerVertex;

            this.numObjBlocks   = this.blocksMapSide * this.blocksMapSide;
            this.numObjVertices = this.verticesBlockSide * this.verticesBlockSide;

            //Init TerrainTiles
            TerrainTiles = new TerrainTiles(terrainFileName, TerrainTileFile, (int)this.blocksMapSide, (int)this.verticesBlockSide);

            //Init MapBlockManager
            MapBlock = new MapBlockManager(terrainFileName, (int)this.blocksMapSide, (int)this.verticesBlockSide);

            //Init VertexManager

            //Init TerrainTileManager

            //Init ObjectManager
            ObjBlock = new ObjectBlockManager(terrainFileName);

            //Init TacticalMap
        }
Пример #2
0
 public IEnumerator InitTerrainTiles(Func <IEnumerator> OnFinish)
 {
     yield return(TerrainTiles.Init(OnFinish));
 }