public void Fire()
        {
            if (_fireRecoveryTime > 0)
            {
                return;
            }
            else
            {
                _fireRecoveryTime = FireRecovery;
            }

            Bullet bullet = new Bullet(_bulletTexture);
            bullet.SetColor(new Color(0, 1, 0, 1));
            bullet.SetPosition(_sprite.GetPosition() + _gunOffset);
            _bulletManager.Shoot(bullet);
        }
Example #2
0
        internal void OnCollision(Bullet bullet)
        {
            // If the ship is already dead then ignore any more bullets.
            if (Health == 0)
            {
                return;
            }

            Health = Math.Max(0, Health - 25);
            _hitFlashCountDown = HitFlashTime; // half
            _sprite.SetColor(new Engine.Color(1, 1, 0, 1));

            if (Health == 0)
            {
                OnDestroyed();
            }
 
        }
 public void Shoot(Bullet bullet)
 {
     _bullets.Add(bullet);
 }