示例#1
0
        private static void CreateConstellations(int amount)
        {
            TimeCoordinate next = TimeCoordinate.FiveToEight;

            if (LoadedConstellations > 0)
            {
                if (Constellations.Count(c => c.TimeCoordinate == TimeCoordinate.FiveToEight) > Constellations.Count(c => c.TimeCoordinate == TimeCoordinate.NineToEleven))
                {
                    next = TimeCoordinate.NineToEleven;
                }
                else if (Constellations.Count(c => c.TimeCoordinate == TimeCoordinate.NineToEleven) > Constellations.Count(c => c.TimeCoordinate == TimeCoordinate.Midnight))
                {
                    next = TimeCoordinate.Midnight;
                }
                else if (Constellations.Count(c => c.TimeCoordinate == TimeCoordinate.Midnight) > Constellations.Count(c => c.TimeCoordinate == TimeCoordinate.OneToFour))
                {
                    next = TimeCoordinate.OneToFour;
                }
            }

            for (int i = 0; i < amount; i++)
            {
                int    ra  = 0;
                double dec = 0.0;

                do
                {
                    ra  = Utility.RandomMinMax(0, MaxRA);
                    dec = Utility.RandomMinMax(0, (int)MaxDEC) + Utility.RandomList(.2, .4, .6, .8, .0);
                }while (CheckExists(next, ra, dec));

                ConstellationInfo info = new ConstellationInfo(next, ra, dec, ConstellationInfo.RandomStarPositions());
                Constellations.Add(info);

                info.Identifier = Constellations.Count - 1;

                switch (next)
                {
                case TimeCoordinate.FiveToEight: next = TimeCoordinate.NineToEleven; break;

                case TimeCoordinate.NineToEleven: next = TimeCoordinate.Midnight; break;

                case TimeCoordinate.Midnight: next = TimeCoordinate.OneToFour; break;

                case TimeCoordinate.OneToFour: next = TimeCoordinate.FiveToEight; break;
                }
            }
        }