/// <summary> /// Initializes a new instance of the <see cref="PlanetoidData" /> class. /// </summary> /// <param name="planetoid">The planetoid.</param> /// <param name="owner">The owner.</param> /// <param name="passiveCMs">The passive Countermeasures.</param> /// <param name="planetoidStat">The stat.</param> public PlanetoidData(IPlanetoid planetoid, Player owner, IEnumerable<PassiveCountermeasure> passiveCMs, PlanetoidStat planetoidStat) : base(planetoid, owner, planetoidStat.MaxHitPoints, passiveCMs) { Mass = planetoidStat.Mass; Category = planetoidStat.Category; Radius = planetoidStat.Radius; Capacity = planetoidStat.Capacity; Resources = planetoidStat.Resources; Topography = Topography.System; _sectorID = InitializeSectorID(); }
/// <summary> /// Initializes a new instance of the <see cref="PlanetoidData" /> class /// with no countermeasures and no owner. /// </summary> /// <param name="planetoid">The planetoid.</param> /// <param name="planetoidStat">The stat.</param> public PlanetoidData(IPlanetoid planetoid, PlanetoidStat planetoidStat) : this(planetoid, TempGameValues.NoPlayer, Enumerable.Empty<PassiveCountermeasure>(), planetoidStat) { }
/// <summary> /// Initializes a new instance of the <see cref="PlanetoidData" /> class with no owner. /// </summary> /// <param name="planetoid">The planetoid.</param> /// <param name="passiveCMs">The passive Countermeasures.</param> /// <param name="planetoidStat">The stat.</param> public PlanetoidData(IPlanetoid planetoid, IEnumerable<PassiveCountermeasure> passiveCMs, PlanetoidStat planetoidStat) : this(planetoid, TempGameValues.NoPlayer, passiveCMs, planetoidStat) { }
public void RemovePlanetoid(IPlanetoid planetoid) { D.Assert(!planetoid.IsOperational); bool isRemoved = _planetoids.Remove(planetoid as APlanetoidItem); D.Assert(isRemoved); var planet = planetoid as PlanetItem; if (planet != null) { isRemoved = _planets.Remove(planet); D.Assert(isRemoved); } else { isRemoved = _moons.Remove(planetoid as MoonItem); D.Assert(isRemoved); } Data.RemovePlanetoidData((planetoid as APlanetoidItem).Data); }