Пример #1
0
        public override void RequestFire(Vector3 PositionToFire, Quaternion shipRotation)
        {
            if ((_timer <= 0 || _timer == _coolDownMS) && AmountMissles > 0) //This means that a squadron wants to fire.
            {
                Vector3 desiredDirection = Vector3.Normalize(WeaponPosition - PositionToFire);
                Quaternion desiredRotation = Quaternion.CreateFromRotationMatrix(Matrix.CreateWorld(WeaponPosition, desiredDirection, Vector3.Up)); //The up direction is irrelevant, a billboard is created anyways.

                Projectile proj = new Projectile(_type, _boundingRadius, WeaponPosition + _weaponPositionRelative, BulletSpread(shipRotation, _bulletSpreadIntensity), _weaponSpeed, _life);

                _projectileList.Add(proj);
                CollidableReference.Add(proj);
                //Shoot Logic
                _timer = _coolDownMS;
                _soundDump.Add(new Sound(_soundType, WeaponPosition, false)); //When shooting a bullet, the initial sound should not be looped.
                AmountMissles--;
            }
        }
Пример #2
0
 public virtual void RequestFire(Vector3 FiringPosition, Quaternion shipRotation)
 {
     if (_timer <= 0 || _timer == _coolDownMS) //This means that a squadron wants to fire.
     {
         Projectile projectile = new Projectile(_type, _boundingRadius, FiringPosition + _weaponPositionRelative, BulletSpread(shipRotation, _bulletSpreadIntensity), _weaponSpeed);
         _projectileList.Add(projectile);
         CollidableReference.Add(projectile);
         //Shoot Logic
         _timer = _coolDownMS;
         _soundDump.Add(new Sound(_soundType, FiringPosition, false)); //When shooting a bullet, the initial sound should not be looped.
     }
 }