Ejemplo n.º 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));
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public TilePassable(Map home, Coords position, TileGenerator generator)
     : base(home, position, generator)
 {
     this._myInventory = new Inventory(this);
 }
Ejemplo n.º 5
0
 public TileImpassable(Map home, Coords position, TileGenerator generator)
     : base(home, position, generator)
 {
 }
Ejemplo n.º 6
0
 public TilePassable(Map home, Coords position, TileGenerator generator)
     : base(home, position, generator)
 {
     this._myInventory = new Inventory(this);
 }
Ejemplo n.º 7
0
 public TileImpassable(Map home, Coords position, TileGenerator generator)
     : base(home, position, generator)
 {
 }
Ejemplo n.º 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;
 }