public List <Satellite> CreateRandPlanetAndSat(int total, List <Planet> planets) { Satellite satellite = new Satellite(); //satellites.Add(satellite); int name = 1; for (int i = 0; i < total; i++) { CountSat = random.Next(0, 4); satellite.CreateRandSat(CountSat, 0, satellites, name); InitData(name, CountSat, planets); name++; } return(satellites); }
private void btn_AddSat_Click(object sender, EventArgs e) { if (IsValidInput(textBox_NamePlan1.Text, out int name)) { int numOfSats = 0; foreach (Satellite satellite in star.satellites) { if (satellite.fatherName == name) { numOfSats++; } } satellite.CreateRandSat(1, numOfSats, star.satellites, name); SearchFatherPlanet(name); } }