AnimatedSprite.PlayerWithWeapon.Update C# (CSharp) Method

Update() public method

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void
        public override void Update(GameTime gameTime)
        {
            // Whenever the rocket is still and loaded it follows the player posiion
            if (MyProjectile != null && MyProjectile.ProjectileState == Projectile.PROJECTILE_STATE.STILL)
                MyProjectile.Tileposition = this.Tileposition;
            // if a roecket is loaded
            if (MyProjectile != null)
            {
                // fire the rocket and it looks for the target
                if(Keyboard.GetState().IsKeyDown(Keys.Space))
                    MyProjectile.fire(Site.Tileposition);
            }

            // Update the Camera with respect to the players new position
            //Vector2 delta = cam.Pos - this.position;
            //cam.Pos += delta;

            if (MyProjectile != null)
                MyProjectile.Update(gameTime);
            // Update the players site
            Site.Update(gameTime);
            // call Sprite Update to get it to animated
            if(_playerHealthBar != null)
            {
                _playerHealthBar.position = PixelPosition;
                _playerHealthBar.health = Health;
            }

            base.Update(gameTime);
        }