Exemplo n.º 1
0
 public override bool CanFire()
 {
     return(HoldingObj.GetCurrentEnergy() >= Stats.EnergyCost &&                                                                                                                       //Check if there is enough energy
            timeSinceLastShot >= Stats.FirePeriod &&                                                                                                                                   //Fire period check
            (!WaitingForFireResponse || TimeOfWaitStart > waitTimeOut) && ((Ship)HoldingObj).Cargo.GetCargoAmount(((MissileLauncherStats)Stats).MissileType) >= Stats.NumProjectiles); //Try removing missile only if everything else is OK.
     //TODO: Reimplement ICanFire to enable non-ships to use missile launchers...
 }
Exemplo n.º 2
0
        public void Charge(double elapsedTimeMS)
        {
            double chargeAmount = elapsedTimeMS / 1000d * _chargeRate;

            if (_currentCharge < _maxCharge)
            {
                _currentCharge += chargeAmount;
                HoldingObj.ChangeEnergy(-(int)(chargeAmount * _energyPerCharge));
            }
        }