コード例 #1
0
ファイル: BulletLib.cs プロジェクト: FrancoisJEA/ITI.BBTB
 public BulletLib(WeaponLib ctx, Vector2 position, int height, int width)
 {
     _direction = ctx.Direction;
     _position  = position;
     _height    = height;
     _width     = width;
 }
コード例 #2
0
ファイル: Bullet.cs プロジェクト: FrancoisJEA/ITI.BBTB
 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;
 }
コード例 #3
0
ファイル: Weapon.cs プロジェクト: FrancoisJEA/ITI.BBTB
        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;
        }
コード例 #4
0
ファイル: Weapon.cs プロジェクト: FrancoisJEA/ITI.BBTB
        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);
        }
コード例 #5
0
ファイル: Weapon.cs プロジェクト: FrancoisJEA/ITI.BBTB
        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;
        }
コード例 #6
0
ファイル: Board.cs プロジェクト: FrancoisJEA/ITI.BBTB
 internal void CreateBullet(Texture2D bulletTexture, Vector2 position, SpriteBatch spriteBatch, WeaponLib weaponLib)
 {
     Bullets.Add(new Bullet(bulletTexture, position, spriteBatch, weaponLib, this, _player._weapon));
 }