To enable MapGraph you need to do the following changes:
Change MapData.cs
using MoratelliToolBelt; // Add the namespace
//...
public class MapData : ScriptableObject {
public MapGraph map; // Add the MapGraph
//...
public int depth { get { return map.GetDepth(); } } // Put depth before the Header, and change it to this getter
[Header("Path Generation")]
}
Change Map.cs
using GraphProcessor; // Add the namespace
//...
public class Map {
// ...
public virtual void GenerateMap(World world) // Replace the GenerateMap with this method
{
MapData mdata = MapData.Get(map_id);
System.Random seed_rand = new System.Random(seed);
System.Random gen_rand = new System.Random(seed + map_id.GetHashCode());
mdata.map.SetParameterValue("Map", this);
mdata.map.SetParameterValue("Seed", seed_rand);
mdata.map.SetParameterValue("GenSeed", gen_rand);
new ProcessGraphProcessor(mdata.map).Run();
}
//...
}
(Optional) Now that you migrated to the new Map system, you can remove some properties on MapData, like:
events
fixed_widths
ixed_events
fork_probability
width_min
width_max
GetLocationEvent()
GetFixedLocation()
GetFixedWidth()
You will end up with something similar to this:
// Imports above
public class MapData : ScriptableObject {
public string id;
public string title;
public MapGraph map;
[Header("Gameplay")]
public string map_scene;
public string battle_scene;
public int depth { get { return map.GetDepth(); } }
public static List<MapData> map_list = new List<MapData>();
// Methods below
}