protected override void Update(GameTime gameTime) { updateDealer.Update(gameTime); InputState.UpdateInput(this); SceneManager.Update(updateDealer); //SUpdate未加上! base.Update(gameTime); updateCount++; sUpdateElapsedTime += gameTime.ElapsedGameTime; if (updateCount >= SUpdateTimer) { supdateDealer.Update(new GameTime(gameTime.TotalGameTime, sUpdateElapsedTime, false)); sUpdateElapsedTime = TimeSpan.Zero; sceneManager.SUpdate(supdateDealer); updateCount = 0; } }
protected override void Update(GameTime gameTime) { PlayerControl.UpdateInput(this); updateDealer.Update(gameTime); if (PlayerControl.IsKeyDown(Keys.Escape)) { this.Exit(); } if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } if (PlayerControl.IsKeyDown(Keys.W)) { camera1.Position += new Vector3(0, 0.5f * updateDealer.ElapsedTime, 0); } if (PlayerControl.IsKeyDown(Keys.S)) { camera1.Position += new Vector3(0, -0.5f * updateDealer.ElapsedTime, 0); } if (PlayerControl.IsKeyDown(Keys.A)) { camera1.Position += new Vector3(-0.5f * updateDealer.ElapsedTime, 0, 0); } if (PlayerControl.IsKeyDown(Keys.D)) { camera1.Position += new Vector3(0.5f * updateDealer.ElapsedTime, 0, 0); } if (GamePad.GetState(PlayerIndex.One).IsConnected) { camera1.Position += new Vector3(GamePad.GetState(PlayerIndex.One).ThumbSticks.Left * 0.5f * updateDealer.ElapsedTime, 0); rotation -= (GamePad.GetState(PlayerIndex.One).Triggers.Left - GamePad.GetState(PlayerIndex.One).Triggers.Right) * rotateSpeed * updateDealer.ElapsedTime; } if (PlayerControl.IsKeyPressed(Keys.Space)) { SwitchModel(); } if (PlayerControl.IsKeyDown(Keys.Q)) { rotation -= rotateSpeed * updateDealer.ElapsedTime; } if (PlayerControl.IsKeyDown(Keys.E)) { rotation += rotateSpeed * updateDealer.ElapsedTime; } if (PlayerControl.IsKeyPressed(Keys.P)) { if (pMethod == ProjectMethod.XNAProjection) { pMethod = ProjectMethod.IlluProjection; } else { pMethod = ProjectMethod.XNAProjection; } } base.Update(gameTime); }