public static ClusterController StartBuildingCluster(MapPresentation presentation, Vector2Int startingPosition) { if (presentation == null) { throw new ArgumentNullException(nameof(presentation)); } // Instantiate cluster. ClusterController controller = MakeEmptyCluster(); // Start building cluster. controller.StartBuilding(presentation, startingPosition); return(controller); }
// Fabric. public static ClusterController MakeEmptyCluster() { // Instantiate GameObjct. GameObject cluster = Instantiate(Prefab); ClusterController controller = cluster.GetComponent <ClusterController>(); // Force duplicating TerrainData. var terrainData = controller.terrain.terrainData; terrainData = Instantiate(terrainData); controller.terrain.terrainData = terrainData; controller.terrainCollider.terrainData = terrainData; return(controller); }