Example #1
0
        private void SetupTileHeightFieldTerrain()
        {
            var HeightFieldTerrain = new Sunshine.World.World(MapTilesWidth, MapTilesHeight);

            for (int y = 0; y < MapTilesHeight; y++)
            {
                for (int x = 0; x < MapTilesHeight; x++)
                {
                    MapTile[] tileHights = new MapTile[4]
                    {
                        HeightFieldTerrain.GetMapTile(x, y),
                        HeightFieldTerrain.GetMapTile(x + 1, y),
                        HeightFieldTerrain.GetMapTile(x + 1, y + 1),
                        HeightFieldTerrain.GetMapTile(x, y + 1),
                    };
                    //var tileDepth = GetDepth(tile);
                    int l = Math.Max(0, x - 1);
                    int r = Math.Min(MapTilesWidth, x + 1);
                    int t = Math.Max(0, y - 1);
                    int b = Math.Min(MapTilesHeight, y + 1);

                    AddTile(_terrainTextures[TILE_ROCK], tileHights, new Vector3(x - MapTilesWidth / 2, 0, y - MapTilesHeight / 2));
                }
            }
            GC.Collect(GC.MaxGeneration);
        }
Example #2
0
 private void InitializeContent()
 {
     Map.ClipToBounds = true;
     World            = new World.World(64, 64);
     TileRender       = new TileRender(World, Map.Dispatcher);
 }