Installation

To enable MapGraph you need to do the following changes:

  1. 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")] 
}
  1. 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();
  }

  //...
}
  1. (Optional) Now that you migrated to the new Map system, you can remove some properties on MapData, like:

    1. events

    2. fixed_widths

    3. ixed_events

    4. fork_probability

    5. width_min

    6. width_max

    7. GetLocationEvent()

    8. GetFixedLocation()

    9. 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
}

Last updated