/// <summary> /// Checks if the given spaceship is partial match to this one. /// Any differences (other than properties not defined) will be considered mismatch. /// </summary> /// <param name="other">The spaceship to compare to this one.</param> /// <returns>True, if the spaceships are a partial match. False otherwise.</returns> public bool IsPartialMatch(Spaceship other) { if (other == null) { return(false); } if (other.Size != Sizes.NotDefined && other.Size != Size) { return(false); } foreach (EngineTypes engineType in other.Engines) { if (!Engines.Contains(engineType)) { return(false); } } foreach (WeaponTypes weaponType in other.Weapons) { if (!Weapons.Contains(weaponType)) { return(false); } } if (other.Crew != CrewTypes.NotDefined && other.Crew != Crew) { return(false); } return(true); }
public virtual void IdlePower(Engine engine) { if (Engines.Contains(engine, new Engine.EngineComparer())) { Engines.Where(v => v.SerialNumber == engine.SerialNumber).Select(v => v).First().CurrentPower = 1; } }
public void AddEngine(EngineTypes engineType) { if (!Engines.Contains(engineType)) { Engines.Add(engineType); } }