public GunController(Gun gun, BulletBuffer bulletBuffer) { this.gun = gun; this.WeaponData = gun.WeaponData; this.firePoint = gun.FirePoint; this.bulletBuffer = bulletBuffer; this.timerUID = this.fireRateTimer.RollingUID; this.fireRate = WeaponData.FireRate; this.fireRateTimer.Set(this.timerUID, this.GetBulletWaitTime(this.WeaponData.FireRate)); if (!this.gun.Bullet.TryGetComponent(out SpriteRenderer bulletSpriteRender)) { throw new MissingComponentException("Bullet sprite missing"); } this.bulletData = new BulletData( WeaponData.BulletVelocity, WeaponData.BulletTtl, WeaponData.BulletDamage, bulletSpriteRender.sprite, this.gun.Bullet.transform ); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent () { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch (GraphicsDevice); //TODO: use this.Content to load your game content here spriteFont = Content.Load<SpriteFont>("DejaVuSans"); //spriteFont = Content.Load<SpriteFont>("Contnt/bin/Windows/gfx/DejaVuSans"); gfl = null; playerShips = new ObjectShip[Settings.Current.Players.Length]; gfl = GravitiForceLevel.ReadGravitiForceLevelFile("GRBomber's Delight.GFB"); levelBackground = LevelBackgroundGF.CreateLevelBackground(GraphicsDevice, gfl, Content); shipBase = new ShipBase[playerShips.Length]; shipBase[0] = new ShipBase(new Vector3(gfl.playerBase[0].X - 104, 999 - gfl.playerBase[0].Y, 0f)); shipBase[1] = new ShipBase(new Vector3(gfl.playerBase[1].X - 104, 999 - gfl.playerBase[1].Y, 0f)); for(int i = 0; i < playerShips.Length; i++) { playerShips[i] = ObjectShip.CreateShip(GraphicsDevice, Content); playerShips[i].Position = shipBase[i].Position; } bullerBuffer = new BulletBuffer(GraphicsDevice, Content); }