public pStateType(string name) { this.name = name; this.body = new pStateBody(); }
public pStateType(string name, pStateBody body) { this.name = name; this.body = body; }
public override pStateBody pGetStateBody(Boolean requireIcon) { pStateBody body = new pStateBody(); try { body.Icon = ""; body.FuelDepletionState = "Dead"; if ("Icon" == reader.Name) { body.Icon = pGetString(); } else if (requireIcon) { throw new ApplicationException("Required icon missing"); } if ("StateParameters" == reader.Name) { reader.Read(); if ("LaunchDuration" == reader.Name) body.LaunchDuration = pGetDouble(); if ("DockingDuration" == reader.Name) body.DockingDuration = pGetDouble(); // if ("TimeToRemove" == reader.Name) body.TimeToRemove = pGetInt()*1000; if ("TimeToAttack" == reader.Name) body.TimeToAttack = pGetInt() * 1000; if ("EngagementDuration" == reader.Name) body.EngagementDuration = pGetInt() * 1000; if ("MaximumSpeed" == reader.Name) body.MaximumSpeed = pGetDouble(); if ("FuelCapacity" == reader.Name) body.FuelCapacity = pGetDouble(); if ("InitialFuelLoad" == reader.Name) body.InitialFuelLoad = pGetDouble(); if ("FuelConsumptionRate" == reader.Name) body.FuelConsumptionRate = pGetDouble(); if ("FuelDepletionState" == reader.Name) body.FuelDepletionState = pGetString(); if ("Stealable" == reader.Name) body.Stealable = pGetBoolean(); while ("Sense" == reader.Name) { body.Sensors.Add(pGetString()); } if ("Capability" == reader.Name) { body.Capabilities = pGetCapabilities(); } if ("SingletonVulnerability" == reader.Name) { body.Vulnerabilities = pGetVulnerabilities(); } if ("ComboVulnerability" == reader.Name) { body.Combinations = pGetCombinations(); } while ("Emitter" == reader.Name) { pEmitterType emitter = pGetEmitter(); body.Emitters[emitter.Attribute] = emitter; } reader.ReadEndElement(); } } catch (System.Exception e) { throw new ApplicationException("Error reading state body: ", e); } return body; }