public WreckGroup(Wreck wreck1, Wreck wreck2, int range2) { this.Center = wreck1.Center(wreck2); this.Range2 = range2; this.Wrecks = new HashSet <Wreck> { wreck1, wreck2 }; this.Weight = wreck1.AvailableWater + wreck2.AvailableWater; }
public void Add(Wreck wreck, int range2, Wreck farestWreck) { if (range2 > this.Range2) { this.Range2 = range2; this.Center = wreck.Center(farestWreck); } this.Wrecks.Add(wreck); this.Weight += wreck.AvailableWater; }