Closed WasabiFan closed 9 years ago
Do you mean the CaveUtils.CheckIfValid
method? Does that work?
Do you mean the CaveUtils.CheckIfValid method?
Yup
Does that work?
Yes, although it is currently commented out here so that it doesn't throw exceptions while testing. I recommend that you test your algorithm by calling the check method yourself and then uncomment that line that I referenced when you think that you have it working.
@WasabiFan Do you have any idea how I can check if a Room already exists? For example, if I have this:
0
1 2
x 3
and I wanted to check if there was a room below 1, how could I do that? I was thinking I could check all of the rooms for their position and check if any were equal to (1.x, 1.y - 1.height), but that seems hacky. An easier way would be to check if any of x's neighbors are connecting to x, but then I need to figure out which rooms are x's neighbors. Any ideas?
What contextual information do you have? If you already have the connections, it should be pretty easy (1.AdjacentRooms[Direction.South]
), but I doubt that that's what you are trying to do. Are you assuming that you have a grid (say, 5x5) and you want to figure out what ID is below 1? Like what the MapGenerator.GetIDAtDirection
method does, but in a more elegant way?
Sort of. I figured it out, but thanks! I basically just store the rooms in an array whenever I add them and just check whether they exist in the array when I'm adding a new one.
@kyranstar Can you make it add random gold too?
We already have some basic code to create the whole cave. Now we just need to make it limit the corrections to 0<n<4 connections. There is a method to verify this in the map class.