/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public void Update(GameTime gameTime) { // Make sure we have plenty of cats... // Create some roaming cats Random r = new Random(); Random r2 = new Random(DateTime.Now.Millisecond); for (int i = Cats.Count; i < NUM_OF_CATS_MIN; i++) { InnocentCat cat = new InnocentCat() { WorldPosition = new Vector2(r.Next(-1200, 1200), r2.Next(-1200, 1200)) }; Cats.Add(cat); } // Update the Hero Hero.Update(gameTime); // Update the cats foreach (Cat cat in Cats) cat.Update(gameTime); // Update the Ammo foreach (Ammo ammo in Ammo) ammo.Update(gameTime); foreach (FloatingStatus fs in FloatingStatuses) fs.Update(gameTime); // Check for dead cats List<Cat> _catsToRemove = new List<Cat>(); foreach (Cat cat in Cats) if (cat.Health <= 0) _catsToRemove.Add(cat); foreach (Cat cat in _catsToRemove) { // Update quest progress if (cat is InnocentCat) { if (CurrentQuest == QuestEnum.Quest1) SharedContext.QuestProgressManager.NumberOfInnocentKittensKilled++; } else if (cat is CatEvoLevel2 || cat is CatEvoLevel3) { if (CurrentQuest == QuestEnum.Quest2) SharedContext.QuestProgressManager.NumberOfMutatedKittensKilled++; } SharedContext.SoundEffectManager.PlayFart(); Cats.Remove(cat); } foreach (Cat cat in RequestedCatsToAdd) { // Limit the number.. ControlPopulationToAddCat(); Cats.Add(cat); } RequestedCatsToAdd.Clear(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> public void LoadContent(Camera camera) { // Create our hero Hero = new Hero(camera); Hero.LoadContent(); // Create the boss Cats = new List<Cat>(); EndBossBadass boss = new EndBossBadass(); boss.LoadContent(); Cats.Add(boss); Random r = new Random(); Random r2 = new Random(); // Create some roaming cats if (Cats.Count < NUM_OF_CATS_MIN) { InnocentCat cat = new InnocentCat() { GestationState = Cat.GestationStateEnum.Grown }; cat.GestationState = Cat.GestationStateEnum.Grown; cat.WorldPosition = new Vector2(r.Next(-600, 600), r2.Next(-1200, 1200)); Cats.Add(cat); } CurrentQuest = QuestEnum.PreQuest; //for (int i = 0; i < 5; i++) //{ // CatEvoLevel2 cat = new CatEvoLevel2() // { // WorldPosition = new Vector2(r.Next(-600, 600), r2.Next(-600, 600)) // }; // Cats.Add(cat); //} //for (int i = 0; i < 10; i++) //{ // CatEvoLevel3 cat = new CatEvoLevel3() // { // WorldPosition = new Vector2(r.Next(-600, 600), r2.Next(-600, 600)) // }; // Cats.Add(cat); //} Ammo = new List<Ammo>(); FloatingStatuses = new List<FloatingStatus>(); RequestedItemsToRemove = new List<Entity>(); RequestedCatsToAdd = new List<Entity>(); }