예제 #1
0
        public Terrarium(float x, float y, float wallThickness, float airHeight, ATerrainGrid groundGrid, SpriteBatch spriteBatch)
        {
            X            = x; Y = y; WallThickness = wallThickness; Length = groundGrid.Length; Height = airHeight + groundGrid.Height;
            _spriteBatch = spriteBatch;

            // Build walls based on airHeight and groundGrid dimensions
            TopWall    = new HWall(X, Y, WallThickness, Terrain.Length + (2 * (WallThickness)), _spriteBatch);
            BottomWall = new HWall(X, Y + WallThickness + AirHeight + Terrain.Height, WallThickness, Terrain.Length + (2 * (WallThickness)), _spriteBatch);
            LeftWall   = new VWall(X, Y, WallThickness, Terrain.Height + (2 * (WallThickness)), _spriteBatch);
            RightWall  = new VWall(X + WallThickness + Terrain.Length, Y, WallThickness, Terrain.Height + (2 * (WallThickness)), _spriteBatch);
        }
예제 #2
0
        public Terrarium(float x, float y, float length, float height, float thickness, SpriteBatch spriteBatch)
        {
            X            = x; Y = y; Length = length; Height = height; WallThickness = thickness;
            _spriteBatch = spriteBatch;

            TopWall    = new HWall(X, Y, WallThickness, Length, _spriteBatch);
            BottomWall = new HWall(X, Y + Height - WallThickness, WallThickness, Length, _spriteBatch);
            LeftWall   = new VWall(X, Y, WallThickness, Height, _spriteBatch);
            RightWall  = new VWall(X + Length, Y, WallThickness, Height, _spriteBatch);

            // Build groundgrid
            float terrainStartX = (X + WallThickness);
            float terrainStartY = 215;
            int   columns       = 19;
            int   rows          = 4;

            Terrain = new GroundGrid(terrainStartX, terrainStartY, columns, rows, _spriteBatch);
        }