Exemple #1
0
//------------------------------------------------------------------------------
// transmit() -- send radar emissions
//------------------------------------------------------------------------------
void Radar::transmit(const LCreal dt)
{
   BaseClass::transmit(dt);

   // Transmitting, scanning and have an antenna?
   if ( !areEmissionsDisabled() && isTransmitting() ) {
      // Send the emission to the other player
      Emission* em = new Emission();
      em->setFrequency(getFrequency());
      em->setBandwidth(getBandwidth());
      const LCreal prf1 = getPRF();
      em->setPRF(prf1);
      int pulses = static_cast<int>(prf1 * dt + 0.5);
      if (pulses == 0) pulses = 1; // at least one
      em->setPulses(pulses);
      const LCreal p = getPeakPower();
      em->setPower(p);
      em->setMaxRangeNM(getRange());
      em->setPulseWidth(getPulseWidth());
      em->setTransmitLoss(getRfTransmitLoss());
      em->setReturnRequest( isReceiverEnabled() );
      em->setTransmitter(this);
      getAntenna()->rfTransmit(em);
      em->unref();
   }

}
Exemple #2
0
CoinSprite::CoinSprite(const std::string& name, float scaledFactor) :
  Drawable(name,
           Vector2f(Gamedata::getInstance().getXmlInt(name+"/startLoc/x") + getPRF(), 
                    Gamedata::getInstance().getXmlInt(name+"/startLoc/y") + getRF()), 
           Vector2f((Gamedata::getInstance().getXmlInt(name+"/speedX")), 
                    (Gamedata::getInstance().getXmlInt(name+"/speedY"))) 
           ),
  frame( FrameFactory::getInstance().getFrame(name) ),
  frameWidth(frame->getWidth()),
  frameHeight(frame->getHeight()),
  worldWidth(Gamedata::getInstance().getXmlInt("world/width")),
  worldHeight(Gamedata::getInstance().getXmlInt("world/height")),
  type(2),
  scaledFactor(scaledFactor)
{ }