public Ship CreateFlagship(Galaxy galaxy) { Ship flagship = new Ship () { Position = new Point( RandomStarSystem(galaxy).Position), Name = "Flagship", }; return flagship; }
public Galaxy CreateGalaxy() { Galaxy newGalaxy = new Galaxy () { Width = Width, Height = Height, }; for (int i = 0; i < MAX_STARS; i++) { newGalaxy.StarSystems.Add (CreateStarSystem ()); } int flagshipStarSystemIndex = _rng.Next (MAX_STARS); Ship flagship = CreateFlagship(newGalaxy); newGalaxy.Flagship = flagship; newGalaxy.StarSystems[flagshipStarSystemIndex].Ships.Add(flagship); return newGalaxy; }
private StarSystem RandomStarSystem(Galaxy galaxy) { int starCount = galaxy.StarSystems.Count; int starIndex = _rng.Next(starCount); return galaxy.StarSystems[starIndex]; }