private void FireProjectile(Point target) { WeaponProjectile projectile = Magazine.Dequeue(); Game.AddGameObject(projectile); if (ProjectilesLeftAnimation != null) { ProjectilesLeftAnimation.Start(); } }
protected override void Reload() { float deltaTime = Game.DeltaTime; reloadTicks++; if ((reloadTicks * deltaTime) >= ReloadInterval) { Magazine.Enqueue(new TankMissileLauncherMissile(Game, this)); reloadTicks = 0; ProjectilesLeftAnimation.Start(); } }
protected override void Reload() { if (!Reloading) { Reloading = true; } reloadCounter++; if (reloadCounter * Game.DeltaTime > ReloadInterval) { for (int i = 0; i < MagazineSize; i++) { magazine.Enqueue(new TankMachineGunBullet(Game, this)); } Reloading = false; ProjectilesLeftAnimation.Start(); reloadCounter = 0; } }
public virtual void Update() { ProjectileSpawnPoint = projectileSpawnPoint.TranslatePoint(new Point(), Game.PlayArea); Rotate(LookAt(Target), Width / 2, Height / 1.25); if (Magazine.Count == 0) { Reload(); } if (Fire) { fireCounter++; if (CanShoot()) { FireProjectile(Target); fireCounter = 0; } } if (ProjectilesLeftAnimation != null) { ProjectilesLeftAnimation.Update(); } }