Пример #1
0
        public HeightfieldTerrainGenerator(string heightfieldName, int preloadRadius, float outsideHeight)
        {
            this.heightfieldName = heightfieldName;
            this.preloadRadius   = preloadRadius;
            this.outsideHeight   = outsideHeight;

            Mosaic = new HeightfieldMosaic(heightfieldName, preloadRadius, outsideHeight);
            Mosaic.MosaicModificationStateChanged += Mosaic_OnMosaicModificationStateChanged;
            Mosaic.MosaicChanged += Mosaic_OnMosaicChanged;
        }
Пример #2
0
        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;
        }