public override void Update(GameTime gameTime) { resumeCounter -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (scene.MatchPaused) { foreach (Player p in scene.GetPlayers()) { p.Update(gameTime); ActionSet actions = p.GetCurrentActionSet(); foreach (int t in actions.actions) { if (t == InputConfig.Actions.JUMP) { ResumeGame(); resumeCounter = 0.2f; } if (t == InputConfig.Actions.TRAP) { TransitionToMenu(); } } if (actions.actions.Count != 0) { actions.actions.Clear(); } } } else { scene.MatchShopKeeper.Update(gameTime); if (resumeCounter <= 0) { foreach (Player p in scene.GetPlayers()) { p.Update(gameTime); ActionSet actions = p.GetCurrentActionSet(); foreach (int t in actions.actions) { if (t == InputConfig.Actions.MENU) { PauseGame(); } } } } List <AiController> aiControllers = scene.GetAiControllers(); foreach (AiController controller in aiControllers) { controller.Update(gameTime); } foreach (AiController controller in scene.GetAndClearPendingAiRemovals()) { aiControllers.Remove(controller); } weatherSystem.Update(gameTime); if (weatherSystem.IsRaining && previouslyRaining) { rainTimeDelta += gameTime.ElapsedGameTime.TotalSeconds; if (rainTimeDelta >= 5) { scene.MatchSoundManager.PlaySoundEffect(SoundEffectEnumeration.Rain); rainTimeDelta = 0; } } else if (weatherSystem.IsRaining && !previouslyRaining) { scene.MatchSoundManager.PlaySoundEffect(SoundEffectEnumeration.Rain); previouslyRaining = true; } else { rainTimeDelta = 0; } //Update moving foliages foreach (Foliage foliage in scene.GetFoliage()) { foliage.Update(gameTime); } //Update snakes foreach (Snake snake in scene.GetSnakes()) { snake.Update(gameTime); } foreach (ParticleEffectManager pEffect in scene.ParticleEffects) { pEffect.Update(gameTime); } scene.LightningManager.Update(); //Winning Condition: End Match if there are no treasures left if (scene.TreasuresLeft <= 0) { TransitionToWinningScreen(); } // DEBUG! TODO: REMOVE LATER #if DEBUG if (Keyboard.GetState() != null) { KeyboardState state = Keyboard.GetState(); if (state.IsKeyDown(Keys.I) && scene.GetAiControllers().Count < 1) { Character ch; ch = CharacterImporter.ImportCharacter( MainConfig.CONTENT_CHARACTERS_DIRECTORY + "IndigenousChar.xml", director.Content, scene); ch.InitCharacter(new Vector3(500, 500 - 70, 0f)); ch.InitCharacter(); AiIndigenController c = new AiIndigenController(scene, scene.NavigationGraph, new AiBehavior()); c.Possess(ch); scene.Characters.Add(ch); scene.GetActors().Add(ch); scene.AddAiController(c); } } #endif } }