Exemplo n.º 1
0
    /// <summary>
    /// Given a RoomObject, this returns a list of existing Rooms that have
    /// an open interaction point for that RoomObject type
    /// </summary>
    /// <typeparam name="T">The RoomObject object type</typeparam>
    /// <returns>A list of Rooms with the available RoomObject type</returns>
    public List <Room> GetRoomsWithAvailableObjectType <T>(RoomObjectType objType) where T : RoomObject
    {
        List <Room.Type> roomTypes  = RoomObject.GetAllowedRoomTypes(objType);
        List <Room>      roomList   = new List <Room>();
        List <Room>      returnList = new List <Room>();

        foreach (Room.Type type in roomTypes)
        {
            roomList = GetRoomsOfType(type);
            foreach (Room room in roomList)
            {
                if (room.HasAvailableObjectType <T>())
                {
                    returnList.Add(room);
                }
            }
        }
        return(returnList);
    }