public override void Draw(GameTime gameTime) { UpdateTank(gameTime); _mesh.IsAi = false; _mesh.DrawModel(_camera); CanonManager.Draw(gameTime); base.Draw(gameTime); }
protected virtual void HandleInput(GameTime gameTime) { //movement _movement = Vector3.Zero; if (KeyboardHelper.IsKeyDown(Keys.W)) { _movement.Z = -1; } else if (KeyboardHelper.IsKeyDown(Keys.S)) { _movement.Z = 1; } //rotation _turnAmount = 0; if (KeyboardHelper.IsKeyDown(Keys.A)) { _turnAmount += 1; } else if (KeyboardHelper.IsKeyDown(Keys.D)) { _turnAmount += -1; } timeSpent += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timeSpent > reloadingTime) { if (MouseHelper.IsLeftButtonPressed()) { CanonManager.Fire(_position + Vector3.Up * 1.7f, Vector3.Zero, _camera.Yaw, _camera.Pitch, gameTime.TotalGameTime); _soundFire.Play(); timeSpent = 0f; } } if (Keyboard.GetState().IsKeyDown(Keys.LeftShift)) { recenter = true; } if (Keyboard.GetState().IsKeyDown(Keys.T)) { _soundTankGoInstance.Play(); } }
public Player(WarZGame game, Camera camera, Tank tank, Terrain terrain) : base(game) { WZGame = game; _mesh = tank; _terrain = terrain; ChangeCamera(camera); _canonManager = new CanonManager(game); _soundFire = WZGame.Content.Load<SoundEffect>("Sounds/tank - shoot"); _soundTankGo = WZGame.Content.Load<SoundEffect>("Sounds/tank - go"); _soundTankGoInstance = _soundTankGo.CreateInstance(); _soundTankGoInstance.IsLooped = true; // _camera.HorizontalOffset = 4f; }
public Player(WarZGame game, Camera camera, Tank tank, Terrain terrain) : base(game) { WZGame = game; _mesh = tank; _terrain = terrain; ChangeCamera(camera); _canonManager = new CanonManager(game); _soundFire = WZGame.Content.Load <SoundEffect>("Sounds/tank - shoot"); _soundTankGo = WZGame.Content.Load <SoundEffect>("Sounds/tank - go"); _soundTankGoInstance = _soundTankGo.CreateInstance(); _soundTankGoInstance.IsLooped = true; // _camera.HorizontalOffset = 4f; }
void UpdateCanonManager(GameTime gameTime) { CanonManager.Update(gameTime); }