/// <summary> /// Will only run if parent is bound to the target, fires a bullet targeted at this spawners parents attackTarget /// </summary> /// <param name="gameTime"></param> protected override void SpawnBullet(GameTime gameTime) { if ((gameTime.TotalGameTime.TotalSeconds - this.previousFire.TotalSeconds > this.fireRateSeconds)) { Bullet b = new CardinalBullet(this.Position, this.parent.attackTarget, this.bulletTexture, this.bulletSpeed, this.bulletLifeSpan); base.InvokeFire(b); this.previousFire = gameTime.TotalGameTime; } }
/// <summary> /// Will only run if parent is bound to the target /// </summary> /// <param name="gameTime"></param> protected override void SpawnBullet(GameTime gameTime) { if ((gameTime.TotalGameTime.TotalSeconds - this.previousFire.TotalSeconds > this.fireRateSeconds)) { UserInput state = UserInput.Instance; if (state.IsKeyDown(UserInput.KeyBinds.Fire)) { Bullet b = new CardinalBullet(this.Position, this.direction, this.bulletTexture, this.bulletSpeed, this.bulletLifeSpan); base.InvokeFire(b); this.previousFire = gameTime.TotalGameTime; } } }
/// <summary> /// Will only run if parent is bound to the target /// </summary> /// <param name="gameTime"></param> protected override void SpawnBullet(GameTime gameTime) { if (creationTime == new TimeSpan(0)) { creationTime = gameTime.TotalGameTime; } if ((gameTime.TotalGameTime.TotalSeconds - this.previousFire.TotalSeconds > this.fireRateSeconds && creationTime.Add(new TimeSpan(0, 0, this.timeToLive)) > gameTime.TotalGameTime)) { Bullet b; if (type == 1) { b = new CardinalBullet(this.Position, Movement.CardinalDirection.South, this.bulletTexture, 3.0f, 5.0f); } else { b = new CardinalBullet(this.Position, this.parent.attackTarget, this.bulletTexture, 3.0f, 5.0f); } base.InvokeFire(b); this.previousFire = gameTime.TotalGameTime; } }