using System.Collections.Generic;
using InfinityCode.RealWorldTerrain.Generators;
using InfinityCode.RealWorldTerrain.OSM;
using UnityEditor;
using UnityEngine;
public class InterceptBuildingGeneration:EditorWindow
{
[MenuItem("RWT Extra/Intercept Building Generation")]
public static void InterceptGeneration()
{
// Intercept generation of buildings
RealWorldTerrainBuildingGenerator.OnGenerateBuilding = OnGenerateBuilding;
Debug.Log("Generation of buildings intercepted");
}
///
/// This method is called when generating each building
///
/// List of points in Unity World Space
/// Reference to the way
/// Dictionary of all the nodes of all buildings.
/// True - the building was generated successfully, false - generate the building with a built-in generator.
private static bool OnGenerateBuilding(List points, RealWorldTerrainOSMWay way, Dictionary nodes)
{
// Here you generate a building
return true;
}
[MenuItem("RWT Extra/Restore Building Generation")]
public static void RestoreGeneration()
{
// Restore generation of buildings
RealWorldTerrainBuildingGenerator.OnGenerateBuilding = null;
Debug.Log("Generation of buildings restored");
}
}