Exemplo n.º 1
0
 // Wall
 protected bool ConvertWall(VirtualMap map, VirtualCell conversion_cell)
 {
     if (behaviour.useDirectionalFloors)
     {
         if (conversion_cell.IsCorridorWall())
         {
             conversion_cell.Type = VirtualCell.CellType.CorridorWallI;
         }
         else
         {
             conversion_cell.Type = VirtualCell.CellType.RoomWallI;
         }
         ConvertWallOrientation(map, conversion_cell);
     }
     return(ConvertPerimeterWall(map, conversion_cell));             // Returns whether it is a perimeter or not
 }
Exemplo n.º 2
0
    // This will convert 'None' cells to columns where necessary.
    protected bool ConvertColumn(VirtualMap map, VirtualCell conversion_cell, bool mayBeDirectional = true)
    {
        CellLocation l = conversion_cell.location;
        //Debug.Log(l);
        bool isRoomColumn     = false;
        bool isCorridorColumn = false;
        bool isPassageColumn  = false;
        bool createColumn     = true;

        if (map.IsColumnRemovable(l, behaviour.drawWallCorners, behaviour.createColumnsInRooms))
        {
            //Debug.Log(conversion_cell.location + " Is removable!");
            createColumn = false;
        }
        else
        {
            //Debug.Log(conversion_cell.location + " Is not removable!");

            // We check all neighs to determine what type of column this is
            foreach (VirtualMap.DirectionType dir in map.directions)
            {
                CellLocation neigh_loc = map.GetNeighbourCellLocation(l, dir);
                if (!map.LocationIsOutsideBounds(neigh_loc))
                {
                    VirtualCell neigh_cell = map.GetCell(neigh_loc);

                    //Debug.Log("CHECK " + neigh_cell.location + " TYPE " + neigh_cell.Type);

                    if (neigh_cell.IsDoor())
                    {
                        conversion_cell.Type = VirtualCell.CellType.PassageColumn;
                        isPassageColumn      = true;
                        break;
                    }
                    else if (!isRoomColumn && neigh_cell.IsCorridorWall())
                    {
                        conversion_cell.Type = VirtualCell.CellType.CorridorColumn;
                        isCorridorColumn     = true;
                        // Do not break, as we need to check all the other walls to be sure
                    }
                    else if (neigh_cell.IsRoomWall())
                    {
                        conversion_cell.Type = VirtualCell.CellType.RoomColumn;
                        isRoomColumn         = true;
                        // Do not break, as we need to check all the other walls to be sure
                    }
                }
            }
        }

        // This may be surrounded by floors!
        if (createColumn &&
            (!isRoomColumn && !isCorridorColumn && !isPassageColumn))
        {
            if (map.IsInRoom(l))
            {
                if (behaviour.createColumnsInRooms)
                {
                    conversion_cell.Type = VirtualCell.CellType.InsideRoomColumn;
                }
                else
                {
                    conversion_cell.Type = VirtualCell.CellType.RoomFloorInside;
                }
            }
            else
            {
                // NOT IN ROOM: THIS IS EITHER SURROUNDED BY ROCKS OR BY CORRIDORS!!
                // We check all neighbours to make sure

                /*foreach(VirtualMap.DirectionType dir in map.directions){
                 *      CellLocation neigh_loc = map.GetNeighbourCellLocationOfSameType(l,dir);
                 *      if (!map.LocationIsOutsideBounds(neigh_loc)){
                 *              VirtualCell neigh_cell = map.GetCell(neigh_loc);
                 * }*/
                conversion_cell.Type = VirtualCell.CellType.CorridorColumn;
            }
            //Debug.Log("ROOM COL? " + conversion_cell.Type);
        }


        // Directional column
        if (createColumn)
        {
            ConvertDirectionalColumn(map, conversion_cell, mayBeDirectional);
        }

        // If the column is not created, we disable it
        if (!createColumn)
        {
            conversion_cell.Type = VirtualCell.CellType.None;
        }

        return(createColumn);
    }