public HeightfieldTerrainGenerator(XmlReader r) { for (int i = 0; i < r.AttributeCount; i++) { r.MoveToAttribute(i); switch (r.Name) { case "Type": string type = r.Value; Debug.Assert(type == "HeightfieldMosaic"); break; case "MosaicName": heightfieldName = r.Value; break; case "PreloadRadius": preloadRadius = int.Parse(r.Value); break; case "OutsideHeight": outsideHeight = float.Parse(r.Value); break; } } r.MoveToElement(); if (!r.IsEmptyElement) { do { r.Read(); } while (r.NodeType != XmlNodeType.EndElement); } Mosaic = new HeightfieldMosaic(heightfieldName, preloadRadius, outsideHeight); Mosaic.MosaicModificationStateChanged += Mosaic_OnMosaicModificationStateChanged; Mosaic.MosaicChanged += Mosaic_OnMosaicChanged; }
public HeightfieldTerrainGenerator(string heightfieldName, int preloadRadius, float outsideHeight, MosaicDescription desc) { this.heightfieldName = heightfieldName; this.preloadRadius = preloadRadius; this.outsideHeight = outsideHeight; Mosaic = new HeightfieldMosaic(heightfieldName, preloadRadius, outsideHeight, desc); Mosaic.MosaicModificationStateChanged += Mosaic_OnMosaicModificationStateChanged; Mosaic.MosaicChanged += Mosaic_OnMosaicChanged; }