Hello everyone,
I’ve been battling with this problem for a while now and haven’t come to any conclusions on how to fix it, the details are as follows.
I’m working on a top down map of the UK which has major locations on it, these locations can be connected via links which can be purchased. What I need is a system to find connections from one location to another using the links, then add them to a list.
Here is the information we have to work with;
- A list of all the links that’s currently on the map
- Access to the 1st location the link is connected to and 2nd location the link is connected to.
I just really need help with the logic surrounding this, it’s frying my brain, hehe.
Here is a diagram showing the map and how I need it to work.
As an example for code, I can add all the nearby locations by simply doing this:
foreach(Link e in gameObject.GetComponent<LinkManager>().links){
if(e.Location1Name == LocationName){
nearbyLinks.Add(e);
}
}
Any help is greatly appreciated, I just need someone else’s views on this problem.
Thanks!
Joseph