Esempio n. 1
0
        //случайные события - в данном случае случайное событие - генерация планеты Гайа
        void generate_random_events()
        {
            Random     rand = new Random((int)DateTime.Now.Ticks);
            StarSystem nova = stars[rand.Next(stars.Count)];

            nova.name  = "Гайа";                        //name for new star
            nova.type  = 8;                             //type for "super nova"
            nova.color = PlanetBrushes.SuperWhiteBrush; //brush for "super nova"

            Planet.generatePlanets(nova, Time);
        }
Esempio n. 2
0
        /// <summary>
        /// Генерирует сферическую галактику
        /// </summary>
        /// <param name="galaxysize">Размер галактики</param>
        /// <param name="starscount">Количество звезд</param>
        void generate_sphere_galaxy(int galaxysize, int starscount)
        {
            Double r;
            Double t = 0;;

            Random rand = new Random();

            for (int j = 0; j < starscount / 2; j++)
            {
                r  = 0;
                t += Math.PI * starscount / 2 + rand.NextDouble() * galaxysize;
                for (int i = 0; i < 2; i++)
                {
                    r = rand.Next(starscount);
                    StarSystem s = new StarSystem();

                    s.R          = r;
                    s.increment  = 100 * (galaxysize + 1);
                    s.timeOffset = t;

                    s.type = rand.Next(7);  //type impact on size and color
                    s.name = GenerateRandomStarName();
                    switch (s.type)
                    {
                    //O - Blue, t =30 000 — 60 000 K
                    case 0:
                        s.color = PlanetBrushes.BlueBrush;
                        break;

                    //B - Light blue, t = 10 500 — 30 000 K
                    case 1:
                        s.color = PlanetBrushes.LightBlueBrush;
                        break;

                    //A - White, t = 7500—10 000 K
                    case 2:
                        s.color = PlanetBrushes.WhiteBrush;
                        break;

                    //F - Light Yellow, t = 6000—7200 K
                    case 3:
                        s.color = PlanetBrushes.LightYellowBrush;
                        break;

                    //G - Yellow, t = 5500 — 6000 K
                    case 4:
                        s.color = PlanetBrushes.YellowBrush;
                        break;

                    //K - Orange, t = 4000 — 5250 K
                    case 5:
                        s.color = PlanetBrushes.OrangeBrush;
                        break;

                    //M - Red, t = 2600 — 3850 K
                    case 6:
                        s.color = PlanetBrushes.RedBrush;
                        break;
                    }
                    Planet.generatePlanets(s, Time);
                    stars.Add(s);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Генерирует галактику нерегулярного типа
        /// </summary>
        /// <param name="offset">Временной сдвиг</param>
        /// <param name="galaxysize">Размер галактики</param>
        /// <param name="starscount">Количество звезд</param>
        void generate_irregular_galaxy(double offset, int galaxysize, int starscount)
        {
            Double r;           //radius
            Double t;           //rotate angle
            Random rand = new Random();

            r = 0;
            t = offset;
            for (int i = 0; i < starscount / 2; i++)
            {
                StarSystem s = new StarSystem();

                r += rand.NextDouble() * galaxysize * 10;
                t += 0.2 - Math.PI * 2;

                s.timeOffset = t;
                s.R          = r;

                s.y         = -5.0 + rand.NextDouble() * 10.0;
                s.increment = rand.Next(-starscount * 100, starscount * 100);

                s.type = rand.Next(7);             //type impact on size and color
                s.name = GenerateRandomStarName(); //s.name = (i + 1).ToString();

                switch (s.type)
                {
                //O - Blue, t =30 000 — 60 000 K
                case 0:
                    s.color = PlanetBrushes.BlueBrush;
                    break;

                //B - Light blue, t = 10 500 — 30 000 K
                case 1:
                    s.color = PlanetBrushes.LightBlueBrush;
                    break;

                //A - White, t = 7500—10 000 K
                case 2:
                    s.color = PlanetBrushes.WhiteBrush;
                    break;

                //F - Light Yellow, t = 6000—7200 K
                case 3:
                    s.color = PlanetBrushes.LightYellowBrush;
                    break;

                //G - Yellow, t = 5500 — 6000 K
                case 4:
                    s.color = PlanetBrushes.YellowBrush;
                    break;

                //K - Orange, t = 4000 — 5250 K
                case 5:
                    s.color = PlanetBrushes.OrangeBrush;
                    break;

                //M - Red, t = 2600 — 3850 K
                case 6:
                    s.color = PlanetBrushes.RedBrush;
                    break;
                }

                Planet.generatePlanets(s, Time);

                stars.Add(s);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Генерирует элиптическую галактику
        /// </summary>
        /// <param name="galaxysize">Размер галактики</param>
        /// <param name="starscount">Количество звезд</param>
        void generate_elliptical_galaxy(int galaxysize, int starscount)
        {
            Random rand = new Random((int)DateTime.Now.Ticks);

            double inc = Math.PI * 48 / starscount;
            double t = 0, r = 100 * (galaxysize + 1);

            for (int i = 0; i < starscount; i++)
            {
                StarSystem s = new StarSystem();

                t += inc + rand.NextDouble() * galaxysize;

                s.timeOffset = t;

                s.R = r + rand.Next(starscount) * 10;

                s.type = rand.Next(7);  //type impact on size and color
                s.name = GenerateRandomStarName();

                switch (s.type)
                {
                //O - Blue, t =30 000 — 60 000 K
                case 0:
                    s.color = PlanetBrushes.BlueBrush;
                    break;

                //B - Light blue, t = 10 500 — 30 000 K
                case 1:
                    s.color = PlanetBrushes.LightBlueBrush;
                    break;

                //A - White, t = 7500—10 000 K
                case 2:
                    s.color = PlanetBrushes.WhiteBrush;
                    break;

                //F - Light Yellow, t = 6000—7200 K
                case 3:
                    s.color = PlanetBrushes.LightYellowBrush;
                    break;

                //G - Yellow, t = 5500 — 6000 K
                case 4:
                    s.color = PlanetBrushes.YellowBrush;
                    break;

                //K - Orange, t = 4000 — 5250 K
                case 5:
                    s.color = PlanetBrushes.OrangeBrush;
                    break;

                //M - Red, t = 2600 — 3850 K
                case 6:
                    s.color = PlanetBrushes.RedBrush;
                    break;
                }

                Planet.generatePlanets(s, Time);
                stars.Add(s);
            }
        }