public static void SetRadiationLevel(XmlDocument CardsXml) { Random Rdm = new Random(); int Card = Rdm.Next(1, 3); Radiation radiation = new Radiation(); XmlNodeList xnlRadiation = CardsXml.SelectNodes(@"/Cards/Card[@type = 'Radiation']"); radiation.Level = Convert.ToInt16(xnlRadiation[Card].Attributes["level"].Value); radiation.Image = xnlRadiation[Card].Attributes["image"].Value; }
public void SetUp(string difficulty) { // Sets the beginning year Year = 1956; // Creates an XML Document from the Cards.xml file XmlDocument CardsXml = new XmlDocument(); CardsXml.Load(@"../../Cards.xml"); // Instanciates cards for a new game. Rocket.SetRockets(CardsXml, Rockets); Supply.SetSupplies(CardsXml, Supplies); Sample.SetSamples(CardsXml, Samples); Capsule.SetCapsules(CardsXml, Capsules); Astronaut.SetAstronauts(CardsXml, Astronauts); Location.SetLocations(CardsXml, Locations); Radiation.SetRadiationLevel(CardsXml); Mission.SetMissions(CardsXml, Missions, difficulty); // Set mission cards }