Example #1
0
        private void MoveWithRadius()
        {
            TilePlayerTurret playerTurret = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret));

            Position      = playerTurret.PixelPosition + (playerTurret.Direction * new Vector2(AIM_RADIUS));
            PixelPosition = Position;
        }
Example #2
0
        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)));
        }
Example #3
0
        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;
        }
Example #4
0
        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);
            }
        }
Example #5
0
        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);
            }
        }
Example #6
0
        private Vector2 ContainTurretAngle(TilePlayer player, TilePlayerTurret playerTurret, Vector2 CrosshairPosition)
        {
            TankPosition = player.PixelPosition;

            return((playerTurret.Direction * Vector2.Distance(TankPosition, CrosshairPosition)));
        }
Example #7
0
 private void MoveWithRadius(TilePlayerTurret playerTurret)
 {
     Position      = playerTurret.PixelPosition + (playerTurret.Direction * new Vector2(AIM_RADIUS));
     PixelPosition = Position;
 }