private void MoveWithRadius() { TilePlayerTurret playerTurret = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret)); Position = playerTurret.PixelPosition + (playerTurret.Direction * new Vector2(AIM_RADIUS)); PixelPosition = Position; }
private Vector2 ContainTurretAngle(Vector2 CrosshairPosition) { TilePlayerTurret playerTurret = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret)); TilePlayer player = (TilePlayer)Game.Services.GetService(typeof(TilePlayer)); TankPosition = player.PixelPosition; return((playerTurret.Direction * Vector2.Distance(TankPosition, CrosshairPosition))); }
private void MoveWithMouse(TilePlayer player, TilePlayerTurret playerTurret) { Vector2 MousePos = InputEngine.MousePosition - new Vector2(FrameWidth / 2, FrameHeight / 2); Position = (MousePos + Camera.CamPos); Vector2 TransformPosition = ContainTurretAngle(player, playerTurret, Position); TransformPosition += TankPosition; PixelPosition = TransformPosition; }
public override void Update(GameTime gametime) { if (!Disabled && Helper.CurrentGameStatus == GameStatus.PLAYING) { if (InputEngine.UsingKeyboard) { PixelPosition = InputEngine.MousePosition - new Vector2(FrameWidth / 2, FrameHeight / 2); PixelPosition += Camera.CamPos; } TilePlayerTurret playerTurret = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret)); Disabled = playerTurret.IsDead; base.Update(gametime); } }
public override void Update(GameTime gameTime) { if (!Disabled && Helper.CurrentGameStatus == GameStatus.PLAYING) { TilePlayer player = (TilePlayer)Game.Services.GetService(typeof(TilePlayer)); TilePlayerTurret playerTurret = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret)); if (InputEngine.UsingKeyboard) { MoveWithMouse(player, playerTurret); } else { MoveWithRadius(playerTurret); } Disabled = playerTurret.IsDead; base.Update(gameTime); } }
private Vector2 ContainTurretAngle(TilePlayer player, TilePlayerTurret playerTurret, Vector2 CrosshairPosition) { TankPosition = player.PixelPosition; return((playerTurret.Direction * Vector2.Distance(TankPosition, CrosshairPosition))); }
private void MoveWithRadius(TilePlayerTurret playerTurret) { Position = playerTurret.PixelPosition + (playerTurret.Direction * new Vector2(AIM_RADIUS)); PixelPosition = Position; }