예제 #1
0
        public Ship CreateFlagship(Galaxy galaxy)
        {
            Ship flagship = new Ship ()
            {
                Position = new Point( RandomStarSystem(galaxy).Position),
                Name = "Flagship",

            };

            return flagship;
        }
예제 #2
0
        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;
        }
예제 #3
0
        private StarSystem RandomStarSystem(Galaxy galaxy)
        {
            int starCount = galaxy.StarSystems.Count;

            int starIndex = _rng.Next(starCount);

            return galaxy.StarSystems[starIndex];
        }