//add functionality to ensure that children edges inheret our id and type public override void OnEdgeSplitCustom(LinkedGraphEdge edge1, LinkedGraphEdge edge2) { if (edge1 is CityEdge) { CityEdge ce1 = (CityEdge)edge1; ce1.id = id; ce1.type = type; ce1.width = width; } else { Debug.Log("couldn't assign data to sub edge on split."); } if (edge2 is CityEdge) { CityEdge ce2 = (CityEdge)edge2; ce2.id = id; ce2.type = type; ce2.width = width; } else { Debug.Log("couldn't assign data to sub edge on split."); } }
//Cities always subdivide with citySkeleton //this function could randomize what subdivscheme is returned easily public override ISubDivScheme <SubdividableEdgeLoop <CityEdge> > GetDivScheme() { CityEdgeFactory factory = new CityEdgeFactory(); System.Object[] factoryParams = CityEdge.GetRoadFactoryParams(depth); if (Random.value > 0.4 || GetPolygon().area < City.MINSUBDIVAREA * 2f) { return(new GetBlocks(factoryParams)); } else { return(new CircularCenter <CityEdge>(factory, factoryParams)); } }
//Cities always subdivide with citySkeleton //this function could randomize what subdivscheme is returned easily public override ISubDivScheme <SubdividableEdgeLoop <CityEdge> > GetDivScheme() { //return new Divide<CityEdge>(new CityEdgeFactory(), CityEdgeType.LandPath); return(new CitySkeleton(new Vector2[] { entrence }, Random.Range(20, 40), CityEdge.GetRoadFactoryParams(depth))); //return new GetBlocks(10, 10); }