Example #1
0
 public BulletLib(WeaponLib ctx, Vector2 position, int height, int width)
 {
     _direction = ctx.Direction;
     _position  = position;
     _height    = height;
     _width     = width;
 }
Example #2
0
 public Bullet(Texture2D texture, Vector2 position, SpriteBatch spritebatch, WeaponLib weapon, Board board, Weapon weaponCtx)
     : base(texture, position, spritebatch)
 {
     _origin    = new Vector2(-27, 20);
     _rotation  = weapon.Rotation;
     BulletLib  = new BulletLib(weapon, new Vector2(base.Position.X, base.Position.Y), texture.Height, texture.Width);
     _weaponCtx = weaponCtx;
     _damages   = weaponCtx.Damages;
     _ctx       = board;
     _boss      = Board.CurrentBoard._boss;
 }
Example #3
0
        public Weapon(Texture2D weaponTexture, Texture2D bulletTexture, Texture2D weaponTexture2, Texture2D bulletTexture2, Vector2 position, SpriteBatch spritebatch, Player player)
            : base(weaponTexture, position, spritebatch)
        {
            _bulletTexture  = bulletTexture;
            _weaponTexture  = weaponTexture;
            _bulletTexture2 = bulletTexture2;
            _weaponTexture2 = weaponTexture2;
            _player         = player;
            _rotationOrigin = new Vector2(_player.Position.X - (_player.Bounds.Width) - 50, _player.Position.Y - (_player.Bounds.Height) - 15);
            Position        = new Vector2(_player.Position.X + (_player.Bounds.Width / 2), _player.Position.Y + (_player.Bounds.Height / 2));
            WeaponLib       = new WeaponLib();
            _time           = 15;
            _ctx            = player.Ctx;

            _damages = 50;
        }
Example #4
0
        public void Update(GameTime gameTime)
        {
            KeyboardState keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.E))
            {
                SetWeaponType(1);
            }
            if (keyboardState.IsKeyDown(Keys.R))
            {
                SetWeaponType(2);
            }

            var mousePos = CheckMouseAndUpdateMovement();

            Position = new Vector2(_player.Position.X + (_player.Bounds.Width / 2), _player.Position.Y + (_player.Bounds.Height / 2));
            WeaponLib.Update(mousePos.X - Position.X, mousePos.Y - Position.Y);
        }
Example #5
0
        public Weapon(GameState ctx, Texture2D Texture, Vector2 position, SpriteBatch spritebatch, Player player, List <Texture2D> BulletTextures)
            : base(Texture, position, spritebatch)
        {
            WeaponLib       = new WeaponLib();
            _player         = player;
            _bulletTextures = BulletTextures;
            Inventory       = _player.Inventory.InventoryList();
            _weaponTexture  = Inventory[4]._texture;

            _ctx = ctx;

            _weaponTexture2 = Inventory[5]._texture;

            SetWeaponType(1);
            _bulletTextures = Inventory[4].DefineBulletTexture(BulletTextures, _player.PlayerClasse);

            _rotationOrigin = new Vector2(_player.Position.X - (_player.animation.SourceRect.Width) - 50, _player.Position.Y - (_player.animation.SourceRect.Height) - 15);
            Position        = new Vector2(_player.Position.X + (_player.animation.SourceRect.Width / 2), _player.Position.Y + (_player.animation.SourceRect.Height / 2));
            _time           = 15;
        }
Example #6
0
 internal void CreateBullet(Texture2D bulletTexture, Vector2 position, SpriteBatch spriteBatch, WeaponLib weaponLib)
 {
     Bullets.Add(new Bullet(bulletTexture, position, spriteBatch, weaponLib, this, _player._weapon));
 }