Creating Neighbors list from objects dictionary

192 views Asked by At

Good day everyone, i will asks about one thing for game. Tired to find any example somewhere for this cause. Here the objects we have:

public class Gate
{
  public int MapID; //where gate located.
  public int ToMapID;//destination.
}
public class Map
{
  public int MapID;
  public string Map;
  public List<Gate> gates; //list of our gates!
}

public static class MapsManager
{
   //here the list of our maps.
   public static Dictionary<int, Map> Maps
} 

Well, the main objective is creating a neighbors list for those maps and operate them. "Map of Maps" for patchfinding. Where their "connection" based on gates. Something like that: MapExample

And how i can get the List of gates from MapID to MapID in this cause? For example: We have a map: LittleMap

And how we can reach S4 from S5? The function should returns a List with 2 Gate objects, i.e. our way: enter image description here

But me completly lack of ideas how to "make them in code"... On whole internet - alot of examples for tile-based maps, sadly but no one example for those type of maps.

Best Regards. Thanks for advice!

0

There are 0 answers