Exemplo n.º 1
0
        public void setDoorType(int direction, int door_type)
        {
            if (direction > 3)
            {
                throw new Exception();
            }
            doorType[direction] = door_type;
            int       opposite_direction = Direction.GetOppositeDirection(direction);
            RoomTrait room = neighbor[direction];

            if (room != null)
            {
                room.doorType[opposite_direction] = door_type;
            }
        }
Exemplo n.º 2
0
        bool _set_traits(Position pos, int direction, int door_type)
        {
            Position biased_pos = pos.GetBiasedPosition(direction);

            if ((biased_pos.X >= 0) && (biased_pos.Y >= 0))
            {
                if ((biased_pos.X < width) && (biased_pos.Y < height))
                {
                    if (!maze_generator.isFree(biased_pos))
                    {
                        return(false);
                    }
                    maze_generator.markReservedPosition(biased_pos);
                }
            }
            RoomTrait room = getRoom(pos);

            if (room.isLinked(direction))
            {
                throw new Exception();
            }

            if (room.getDoorType(direction) != 0)
            {
                throw new Exception();
            }

            int link_type;

            if (door_type == 3100)
            {
                link_type = 2;
            }
            else if (door_type == 3000)
            {
                link_type = 1;
            }
            else
            {
                throw new Exception();
            }
            room.Link(direction, link_type);
            room.setDoorType(direction, door_type);
            return(true);
        }
Exemplo n.º 3
0
        bool _create_sub_path_recursive(Position pos)
        {
            RoomTrait          room      = getRoom(pos);
            maze_room_internal maze_room = maze_generator.getRoom(pos);

            room.roomType = 1;
            for (int direction = 0; direction < 4; direction++)
            {
                if (maze_room.GetPassageType(direction) == 2)
                {
                    Position biased_pos = pos.GetBiasedPosition(direction);
                    if (room != null)
                    {
                        room.Link(direction, 2);
                    }
                    return(_create_sub_path_recursive(biased_pos));
                }
            }
            return(true);
        }
Exemplo n.º 4
0
 public void setNeighbor(int direction, RoomTrait room)
 {
     neighbor[direction] = room;
 }
Exemplo n.º 5
0
 public void setNeighbor(int direction, RoomTrait room)
 {
     neighbor[direction] = room;
 }