Ejemplo n.º 1
0
 public void mossify_tile_at(gridCoordinate target_coord, Texture2D moss_sheet, 
                             List<KeyValuePair<Tile.Tile_Type, gridCoordinate>> moss_map)
 {
     if (target_coord.is_safe(current_floorsize))
     {
         Tile target_tile = floorTiles[target_coord.x][target_coord.y];
         if (target_tile.can_mossify())
             target_tile.mossify(moss_sheet, moss_map);
     }
 }
Ejemplo n.º 2
0
 public Tile.Tile_Type get_tile_type_at(gridCoordinate target_coord)
 {
     if (!target_coord.is_safe(current_floorsize))
         return Tile.Tile_Type.Void;
     else
         return floorTiles[target_coord.x][target_coord.y].get_my_tile_type();
 }
Ejemplo n.º 3
0
 public bool is_tile_passable(gridCoordinate target_coord)
 {
     if (!target_coord.is_safe(current_floorsize))
         return false;
     else
         return floorTiles[target_coord.x][target_coord.y].isPassable();
 }
Ejemplo n.º 4
0
        public void draw_sub_rectangle(ref List<List<Tile>> grid, gridCoordinate start_coord, gridCoordinate end_coord,
                                       Tile.Tile_Type c_tileType, Random rGen,
                                       Texture2D general_sheet, Texture2D dungeon_sheet,
                                       List<KeyValuePair<Tile.Tile_Type, gridCoordinate>> texture_map)
        {
            for(int x = start_coord.x; x < end_coord.x; x++)
                for (int y = start_coord.y; y < end_coord.y; y++)
                {
                    gridCoordinate target_tile = new gridCoordinate(x, y);
                    if (target_tile.is_safe(grid.Count))
                        grid[x][y].set_tile_type(c_tileType, general_sheet, dungeon_sheet, texture_map);
                }

            for (int i = 0; i < 10; i++)
            {
                int next_xSize = (int)((end_coord.x - start_coord.x) * (rGen.NextDouble() * .3 + .2));
                int next_ySize = (int)((end_coord.y - start_coord.y) * (rGen.NextDouble() * .3 + .2));

                int next_corner = rGen.Next(4);
                int x_offset = 0;
                int y_offset = 0;

                gridCoordinate upper_left_corner = new gridCoordinate(start_coord.x, start_coord.y);
                switch (next_corner)
                {
                    //Along top edge
                    case 0:
                        x_offset = (int)((end_coord.x - start_coord.x - next_xSize) * rGen.NextDouble());
                        upper_left_corner = new gridCoordinate(start_coord.x + x_offset, start_coord.y - next_ySize);
                        break;
                    //Along right edge
                    case 1:
                        y_offset = (int)((end_coord.y - start_coord.y - next_ySize) * rGen.NextDouble());
                        upper_left_corner = new gridCoordinate(end_coord.x, start_coord.y + y_offset);
                        break;
                    //Along bottom edge
                    case 2:
                        x_offset = (int)((end_coord.x - start_coord.x - next_xSize) * rGen.NextDouble());
                        upper_left_corner = new gridCoordinate(start_coord.x + x_offset, end_coord.y);
                        break;
                    //Along left edge
                    case 3:
                        y_offset = (int)((end_coord.y - start_coord.y - next_ySize) * rGen.NextDouble());
                        upper_left_corner = new gridCoordinate(start_coord.x - next_xSize, start_coord.y + y_offset);
                        break;
                }

                gridCoordinate lower_right_corner = new gridCoordinate(upper_left_corner.x + next_xSize, upper_left_corner.y + next_ySize);

                if (next_xSize >= 1 && next_ySize >= 1)
                    draw_sub_rectangle(ref grid, upper_left_corner, lower_right_corner, c_tileType, rGen, general_sheet, dungeon_sheet, texture_map);
            }
        }