public void Clone(IWorldContainer copyParent) { SpawnGen clone = new SpawnGen(app, copyParent, respawnTime, numSpawn, templateName, spawnRadius); clone.NameValue = new NameValueObject(this.NameValue); copyParent.Add(clone); }
public void Execute() { if (mob == null) { mob = new SpawnGen(app, parent, respawnTime, numberOfSpawns, templateName); } parent.Add(mob); for (int i = app.SelectedObject.Count - 1; i >= 0; i--) { app.SelectedObject[i].Node.UnSelect(); } if (mob.Node != null) { mob.Node.Select(); } }
protected void FromXml(XmlReader r) { // first parse the attributes bool adjustHeightFound = false; 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 "Sound": // this.soundAssetName = r.Value; // break; case "TerrainOffset": offsetFound = true; terrainOffset = float.Parse(r.Value); break; case "AllowHeightAdjustment": adjustHeightFound = true; if (String.Equals(r.Value.ToLower(), "false")) { allowAdjustHeightOffTerrain = false; } break; case "Azimuth": azimuth = float.Parse(r.Value); break; case "Zenith": zenith = float.Parse(r.Value); break; case "WorldViewSelect": worldViewSelectable = bool.Parse(r.Value); break; } } // this.nameValuePairs = new NameValueObject(); r.Read(); do { if (r.NodeType == XmlNodeType.Whitespace) { continue; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "Position": this.position = XmlHelperClass.ParseVectorAttributes(r); break; case "Orientation": orientation = XmlHelperClass.ParseQuaternion(r); break; case "NameValuePairs": this.nameValuePairs = new NameValueObject(r); break; case "ParticleEffect": ParticleEffect particle = new ParticleEffect(r, this, app); Add(particle); break; case "SpawnGen": SpawnGen mob = new SpawnGen(r, app, this); Add(mob); break; case "Sound": Sound sound = new Sound(r, this, app); Add(sound); break; case "Color": Color = XmlHelperClass.ParseColorAttributes(r); break; } } else if (r.NodeType == XmlNodeType.EndElement) { break; } } while (r.Read()); if (!adjustHeightFound) { allowAdjustHeightOffTerrain = true; } if (!offsetFound) { terrainOffset = this.Position.y - app.GetTerrainHeight(position.x, position.z); } if (orientation != null && disp != null) { disp.SetOrientation(orientation); foreach (IWorldObject obj in children) { if (obj is ParticleEffect) { (obj as ParticleEffect).Orientation = this.orientation; } } } }
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); } }
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); } }