Beispiel #1
0
 public DeletePointCommand(WorldEditor worldEditor, PointCollection parentObject, MPPoint delPt)
 {
     app    = worldEditor;
     parent = parentObject;
     point  = delPt;
 }
Beispiel #2
0
 public AddPointCommand(PointCollection points, Vector3 location, int index)
 {
     this.points   = points;
     this.location = location;
     this.index    = index;
 }
        protected void FromXml(XmlReader r)
        {
            // first parse the attributes
            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);

                // set the field in this object based on the element we just read
                switch (r.Name)
                {
                case "Name":
                    this.name = r.Value;
                    break;

                case "Priority":
                    this.priority = int.Parse(r.Value);
                    break;
                }
            }
            r.MoveToElement(); //Moves the reader back to the element node.

            while (r.Read())
            {
                if (r.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (r.NodeType == XmlNodeType.Element)
                {
                    switch (r.Name)
                    {
                    case "PointCollection":
                        if (!r.IsEmptyElement)
                        {
                            this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary, r);
                            Add(points);
                            points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler);
                        }
                        break;

                    case "NameValuePairs":
                        this.nameValuePairs = new NameValueObject(r);
                        break;

                    case "Forest":
                        Forest forest = new Forest(r, this, app);
                        Add(forest);
                        break;

                    case "Fog":
                        Fog fog = new Fog(r, this, app);
                        Add(fog);
                        break;

                    case "Water":
                        Water water = new Water(r, this, app);
                        Add(water);
                        break;

                    case "Sound":
                        Sound sound = new Sound(r, (IWorldContainer)this, app);
                        Add(sound);
                        break;

                    case "Grass":
                        Grass grass = new Grass(r, this, app);
                        Add(grass);
                        break;

                    case "SpawnGen":
                        SpawnGen mob = new SpawnGen(r, app, this);
                        Add(mob);
                        break;

                    case "AmbientLight":
                        AmbientLight ambientLight = new AmbientLight(app, this, r);
                        Add(ambientLight);
                        break;

                    case "DirectionalLight":
                        DirectionalLight directionalLight = new DirectionalLight(app, this, r);
                        Add(directionalLight);
                        break;
                    }
                }
            }
            if (points == null)
            {
                this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary);
                Add(points);
                points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler);
            }
        }
Beispiel #4
0
 public AddPointCommand(PointCollection points, Vector3 location)
 {
     this.points   = points;
     this.location = location;
 }