/// <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> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } //Console.WriteLine(gameTime.ElapsedGameTime.TotalSeconds); // TODO: Add your update logic here Escena.INSTANCIA?.Update(gameTime); MotorFisico.Update(gameTime); UTGameObjectsManager.Update(gameTime); base.Update(gameTime); }
/// <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> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } now = Keyboard.GetState(); if (now.IsKeyUp(Keys.O) && last.IsKeyDown(Keys.O)) { paused = !paused; pause.Play(); } if (paused) { last = now; return; } //Console.WriteLine(gameTime.ElapsedGameTime.TotalSeconds); // TODO: Add your update logic here Escena.INSTANCIA?.Update(gameTime); MotorFisico.Update(gameTime); UTGameObjectsManager.Update(gameTime); if (!EnterPressed && Keyboard.GetState().IsKeyDown(Keys.Enter) && pantalla == GameState.Inicio) { plink.Play(); EnterPressed = true; pantalla = GameState.Gameplay; new Escena2(); } if (Keyboard.GetState().IsKeyUp(Keys.Enter)) { EnterPressed = false; } if (Keyboard.GetState().IsKeyDown(Keys.I) && pantalla == GameState.Inicio) { plink.Play(); pantalla = GameState.Instruct; } if (Keyboard.GetState().IsKeyDown(Keys.Back) && pantalla == GameState.Instruct) { plink.Play(); pantalla = GameState.Inicio; } if (Keyboard.GetState().IsKeyDown(Keys.C) && pantalla == GameState.Inicio) { plink.Play(); pantalla = GameState.Creditos; } if (Keyboard.GetState().IsKeyDown(Keys.Back) && pantalla == GameState.Creditos) { plink.Play(); pantalla = GameState.Inicio; } if (pantalla == GameState.Final && Keyboard.GetState().IsKeyDown(Keys.R)) { plink.Play(); pantalla = GameState.Inicio; } gameplay.Update(gameTime); base.Update(gameTime); last = now; }