Пример #1
0
 protected Tile(Map home, Coords position, TileGenerator generator)
     : this(home, position)
 {
     this._myName = generator.name;
     //this._visibilityCoefficient = generator.visibilityCoefficient;
     this._myBitmap = generator.tileBitmap;
 }
        // Fills a space with tiles of "tileType"
        private void FillRectangleWithTiles(Map homeMap, Coords topLeft, Coords bottomRight, TileGenerator tileType)
        {
            Coords difference = bottomRight - topLeft;
            if (!(difference.X > -1 && difference.Y > -1))
            {
                return;
            }

            // There should be a more elegant way of dealing with the "Is it passable or impassable?" problem.
            if (tileType.passable)
            {
                for (int i = 0; i < difference.X + 1; ++i)
                {
                    for (int j = 0; j < difference.Y + 1; ++j)
                    {
                        Coords currentCoords = new Coords(CoordsType.Tile, topLeft.X + i, topLeft.Y + j);
                        homeMap.SetTile(currentCoords, new TilePassable(homeMap, currentCoords, tileType));
                    }
                }
            }
            else
            {
                for (int i = 0; i < difference.X + 1; ++i)
                {
                    for (int j = 0; j < difference.Y + 1; ++j)
                    {
                        Coords currentCoords = new Coords(CoordsType.Tile, topLeft.X + i, topLeft.Y + j);
                        homeMap.SetTile(currentCoords, new TileImpassable(homeMap, currentCoords, tileType));
                    }
                }
            }
        }
        // Fills a space with tiles of "tileType"
        private void FillRectangleWithTiles(Map homeMap, Coords topLeft, Coords bottomRight, TileGenerator tileType)
        {
            Coords difference = bottomRight - topLeft;

            if (!(difference.X > -1 && difference.Y > -1))
            {
                return;
            }

            // There should be a more elegant way of dealing with the "Is it passable or impassable?" problem.
            if (tileType.passable)
            {
                for (int i = 0; i < difference.X + 1; ++i)
                {
                    for (int j = 0; j < difference.Y + 1; ++j)
                    {
                        Coords currentCoords = new Coords(CoordsType.Tile, topLeft.X + i, topLeft.Y + j);
                        homeMap.SetTile(currentCoords, new TilePassable(homeMap, currentCoords, tileType));
                    }
                }
            }
            else
            {
                for (int i = 0; i < difference.X + 1; ++i)
                {
                    for (int j = 0; j < difference.Y + 1; ++j)
                    {
                        Coords currentCoords = new Coords(CoordsType.Tile, topLeft.X + i, topLeft.Y + j);
                        homeMap.SetTile(currentCoords, new TileImpassable(homeMap, currentCoords, tileType));
                    }
                }
            }
        }
Пример #4
0
 public TilePassable(Map home, Coords position, TileGenerator generator)
     : base(home, position, generator)
 {
     this._myInventory = new Inventory(this);
 }
Пример #5
0
 public TileImpassable(Map home, Coords position, TileGenerator generator)
     : base(home, position, generator)
 {
 }
Пример #6
0
 public TilePassable(Map home, Coords position, TileGenerator generator)
     : base(home, position, generator)
 {
     this._myInventory = new Inventory(this);
 }
Пример #7
0
 public TileImpassable(Map home, Coords position, TileGenerator generator)
     : base(home, position, generator)
 {
 }
Пример #8
0
 protected Tile(Map home, Coords position, TileGenerator generator)
     : this(home, position)
 {
     this._myName = generator.name;
     //this._visibilityCoefficient = generator.visibilityCoefficient;
     this._myBitmap = generator.tileBitmap;
 }