示例#1
0
 /// <summary>
 /// Constructs the world generator object.
 /// </summary>
 /// <param name="terrain">The world's terrain.</param>
 /// <param name="graphicsDevice">The GraphicsDevice.</param>
 /// <param name="terrainTheme">The theme to use for the terrain generator.</param>
 public TerrainGenerator(Terrain terrain, GraphicsDevice graphicsDevice,
                         TerrainTheme terrainTheme)
 {
     this.graphicsDevice = graphicsDevice;
     this.Terrain        = terrain;
     this.terrainTheme   = terrainTheme;
 }
示例#2
0
        /// <summary>
        /// Creates and initializes a World.
        /// </summary>
        /// <param name="graphicsDevice">The GraphicsDevice from Game class.</param>
        /// <param name="size">Size of the world.</param>
        public World(GraphicsDevice graphicsDevice, Point size)
        {
            this.graphicsDevice = graphicsDevice;
            terrain             = new Terrain(graphicsDevice, size.X, size.Y);
            backgroundTerrain   = new Terrain(graphicsDevice, size.X, size.Y);
            gameObjects         = new HashSet <IGameObject>();
            var terrainTheme = new TerrainTheme
            {
                DistanceBetweenBorderReads = 10,
                DistanceBetweenBorders     = 23,
                BorderOffsetTerrain        = new Point(0, -5),
                BorderTextureLocation      = "h3",
                OffsetBetweenBorders       = 1,
                FillTileLocation           = "grassCenter"
            };

            worldGenerator = new TerrainGenerator(backgroundTerrain, graphicsDevice, terrainTheme);
        }