I am currently making a game with randomly generated rooms, as I iterate through the newly created rooms to check their coordinates to add them onto a graph I have a list of rooms.
list<Room> listOfAllRooms;
I can continue with the clunky way of specifying where all the room objects are stored.
list<Room> listOfAllRooms = new List<Room> {roomObject.room1, ...}
They are stored in another class just to keep things tidy, exactly like so...
public class RoomObjects { public static Room room1 = new Room(); .....}
All the way for 25 rooms.
This is messy beyond all belief and will create a serious issue should I expand beyond the current 25 rooms I am currently working with. In my mind there should exist a way to populate this list of all the rooms directly from one neat and tidy source. So really my question boils down to is there a better way to declare these objects and store them into a list automatically? or if not at least a way to add each room into a list automatically?
(Note, I have a large part of the code working with a list of all rooms so i hope i don't have to re-write that to fix this)
ObservableCollection<Room>instead ofList<Room>would be easier.room1,room2,room3....?