private static void CreateConstellations(int amount) { var next = TimeCoordinate.FiveToEight; if (LoadedConstellations > 0) { if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.FiveToEight).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.NineToEleven).Count()) { next = TimeCoordinate.NineToEleven; } else if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.NineToEleven).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.Midnight).Count()) { next = TimeCoordinate.Midnight; } else if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.Midnight).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.OneToFour).Count()) { 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)); var 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; } } }
private static void CreateConstellations(int amount) { TimeCoordinate next = TimeCoordinate.FiveToEight; if (LoadedConstellations > 0) { int count = 0; for (var index = 0; index < Constellations.Count; index++) { var c = Constellations[index]; if (c.TimeCoordinate == TimeCoordinate.NineToEleven) { count++; } } int count1 = 0; for (var index = 0; index < Constellations.Count; index++) { var c = Constellations[index]; if (c.TimeCoordinate == TimeCoordinate.FiveToEight) { count1++; } } if (count1 > count) { next = TimeCoordinate.NineToEleven; } else { int count2 = 0; for (var index = 0; index < Constellations.Count; index++) { var c = Constellations[index]; if (c.TimeCoordinate == TimeCoordinate.Midnight) { count2++; } } int count3 = 0; for (var index = 0; index < Constellations.Count; index++) { var c = Constellations[index]; if (c.TimeCoordinate == TimeCoordinate.NineToEleven) { count3++; } } if (count3 > count2) { next = TimeCoordinate.Midnight; } else { int count4 = 0; for (var index = 0; index < Constellations.Count; index++) { var c = Constellations[index]; if (c.TimeCoordinate == TimeCoordinate.OneToFour) { count4++; } } int count5 = 0; for (var index = 0; index < Constellations.Count; index++) { var c = Constellations[index]; if (c.TimeCoordinate == TimeCoordinate.Midnight) { count5++; } } if (count5 > count4) { 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; } } }