Example #1
0
        public static void LShape(int _roomLength, int _roomHeight, int _directionIndex)
        {
            Square();
            for (int i = 0; i < _roomLength + 1; ++i)
            {
                for (int a = 0; a < _roomHeight; ++a)
                {
                    switch (_directionIndex)
                    {
                    case 0:    //Right
                        Vector2Int pos = ShapeDirectionVector(_roomLength + i + 1, 0 + a);
                        AddToFloorTilePositions(pos);
                        break;

                    case 1:    //Left
                        Vector2Int pos2 = ShapeDirectionVector(0 - i, 0 + a);
                        AddToFloorTilePositions(pos2);
                        break;

                    case 2:    //UpRight
                        Vector2Int pos3 = ShapeDirectionVector(WallGen.GetWallDimensions().x + 1 + i, WallGen.GetWallDimensions().y - _roomHeight + a);
                        AddToFloorTilePositions(pos3);
                        break;

                    case 3:    //UpLeft
                        Vector2Int pos4 = ShapeDirectionVector(0 - i, WallGen.GetWallDimensions().y - _roomHeight + a);
                        AddToFloorTilePositions(pos4);
                        break;
                    }
                }
            }
        }
Example #2
0
 public static void Square()
 {
     for (int i = 0; i < WallGen.GetWallDimensions().x + 1; ++i)
     {
         for (int a = 0; a < WallGen.GetWallDimensions().y; ++a)
         {
             Vector2Int pos = new Vector2Int(DungeonUtility.GetBuildPoint().x + i, DungeonUtility.GetBuildPoint().y + a);
             AddToFloorTilePositions(pos);
         }
     }
 }
Example #3
0
        static void BuildPathTile(Vector3Int _pos)
        {
            TileHolder        tileHolder       = TileManager.GetTileHolder(TileType.Path);
            float             randomFreq       = Random.Range(1, tileHolder.Tiles.OrderByDescending(t => t.PickChance).First().PickChance);
            List <CustomTile> tilesWithinRange = new List <CustomTile>();

            tilesWithinRange = tileHolder.Tiles.Where(t => t.PickChance >= randomFreq).ToList();
            int tempTileIndex;

            tempTileIndex = Random.Range(0, tilesWithinRange.Count);
            TileManager.PlaceTile(_pos, tempTileIndex, WallGen.GetTilemap(), DungeonUtility.GetTilemap(), tilesWithinRange[tempTileIndex], DictionaryType.Floor);
        }