public void Update(TimeSpan timeSpan) { // Create cloud list by concatenating thunderstorms and rainclouds Clouds = Thunderstorms.Concat <Cloud>(RainClouds).ToList(); // Update game logic foreach (Cloud cloud in Clouds) { cloud.Update(iteration); } // Remove dead thunderstorms for (int i = 0; i < Thunderstorms.Count; i++) { if (Thunderstorms[i].IsDead()) { Thunderstorms.RemoveAt(i--); } } // Remove dead rainclouds for (int i = 0; i < RainClouds.Count; i++) { if (RainClouds[i].IsDead()) { RainClouds.RemoveAt(i--); } } iteration++; }
public void AddThunderstorm(string name, CloudType type) { Thunderstorm thunderstorm = new Thunderstorm(this, 1000, graphicManager, ShapeType.ThunderStorm, inputFactory.NewInputHandler(type)) { velocity = new Vector(0, 0), position = new Vector(Random.Next(Settings.Width), Random.Next(Settings.Height)) }; Thunderstorms.Add(thunderstorm); }