当前位置: 首页>>代码示例>>C++>>正文


C++ PlaneObject::isPlaneAlive方法代码示例

本文整理汇总了C++中PlaneObject::isPlaneAlive方法的典型用法代码示例。如果您正苦于以下问题:C++ PlaneObject::isPlaneAlive方法的具体用法?C++ PlaneObject::isPlaneAlive怎么用?C++ PlaneObject::isPlaneAlive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlaneObject的用法示例。


在下文中一共展示了PlaneObject::isPlaneAlive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: renderScreen

void Game::renderScreen()
{
  m_currentCam->setAsCamera();

  renderScene(false);

  PlaneObject *plane = objects->getPlaneObject();
  if(plane != NULL)
  {
    //render plane reticles    
    plane->renderReticle(15.0f, 1.3f);
    plane->renderReticle(8.0f, 1.0f);
    
    if (plane->isPlaneAlive() == false)
    {
      int textY = gRenderer.getScreenY()/2;
      IRectangle rect = IRectangle(0,textY,gRenderer.getScreenX()-1, textY + 30);
      gRenderer.drawText("Press \"Space Bar\" to Respawn",&rect, eTextAlignModeCenter, false);
    }
  }

  gConsole.render();
  if (GameBase::m_renderInfo)
    GameBase::renderInfo();  
}
开发者ID:carussell,项目名称:nvvg,代码行数:25,代码来源:Game.cpp

示例2:

bool Ned3DObjectManager::interactPlaneTerrain(PlaneObject &plane, TerrainObject &terrain)
{
  Terrain *terr = terrain.getTerrain();
  if(terr == NULL) return false;

  //test for plane collision with terrain
  Vector3 planePos = plane.getPosition();
  EulerAngles planeOrient = plane.getOrientation();
  Vector3 disp = planePos - disp;
  RotationMatrix planeMatrix;
  planeMatrix.setup(plane.getOrientation()); // get plane's orientation

  float planeBottom = plane.getBoundingBox().min.y;
  float terrainHeight = terr->getHeight(planePos.x,planePos.z);
  if(plane.isPlaneAlive() && planeBottom < terrainHeight)
  { //collision
    Vector3 viewVector = planeMatrix.objectToInertial(Vector3(0,0,1));
    if(viewVector * terr->getNormal(planePos.x,planePos.z) < -0.5f // dot product
      || plane.isCrashing())
    { 
      plane.killPlane();
      int partHndl = gParticle.createSystem("planeexplosion");
      gParticle.setSystemPos(partHndl, plane.getPosition());
      int boomHndl = gSoundManager.requestSoundHandle("Boom.wav");
      int boomInst = gSoundManager.requestInstance(boomHndl);
      if(boomInst != SoundManager::NOINSTANCE)
      {
        gSoundManager.setPosition(boomHndl,boomInst,plane.getPosition());
        gSoundManager.play(boomHndl,boomInst);
        gSoundManager.releaseInstance(boomHndl,boomInst);
      }
      plane.setSpeed(0.0f);
      planePos += 2.0f * viewVector;
      planeOrient.pitch = kPi / 4.0f;
      planeOrient.bank = kPi / 4.0f;
      plane.setOrientation(planeOrient);
    }
    else planePos.y = terrainHeight + planePos.y - planeBottom;
    //plane.setPPosition(planePos);
    return true;
  }
  return false;
}
开发者ID:kmh0237,项目名称:GameProgramming2Project,代码行数:43,代码来源:Ned3DObjectManager.cpp

示例3: processInput

void StatePlaying::processInput()
{
  PlaneObject *planeObject = m_objects->getPlaneObject();

  // Exit to menu if requested
  if (gInput.keyJustUp(DIK_ESCAPE, true)) 
  {        
    gGame.changeState(eGameStateMenu);    
    return;
  }

  // If you press space bar after you die reset game
  if (gInput.keyJustUp(DIK_SPACE))
   if (planeObject->isPlaneAlive() == false)
    {
      resetGame();
      return;
    }    
}
开发者ID:kmh0237,项目名称:GameProgramming2Project,代码行数:19,代码来源:StatePlaying.cpp

示例4: renderScreen

void StatePlaying::renderScreen()
{
  // render the entire scene
  renderScene();
  
  PlaneObject* plane = m_objects->getPlaneObject();
  if (plane != NULL)
  {
    //render plane reticles    
    plane->renderReticle(15.0f, 1.3f);
    plane->renderReticle(8.0f, 1.0f);
    
    if (plane->isPlaneAlive() == false)
    {
      int textY = gRenderer.getScreenY()/2;
      IRectangle rect = IRectangle(0,textY,gRenderer.getScreenX()-1, textY + 30);
      gRenderer.drawText("Press \"Space Bar\" to Respawn",&rect, eTextAlignModeCenter, false);
    }
  }

  // render FPS and console ontop of everything
  gGame.GameBase::renderConsoleAndFPS();
}
开发者ID:kmh0237,项目名称:GameProgramming2Project,代码行数:23,代码来源:StatePlaying.cpp

示例5: process

void StatePlaying::process(float dt)
{ 
  PlaneObject *planeObject = m_objects->getPlaneObject();

  // this should never happen but if it does leave
  if (planeObject == NULL) 
    return; 
    
  gConsole.process();
  
  // call process and move on all objects in the object manager
  m_objects->update(dt); 
    
  // process escape key and space bar
  processInput();

  // update location of camera
  processCamera(dt);
    
  // allow water to process per frame movements
  water->process(dt);
 
  // as soon as the plane crashes, start the timer
  if (planeObject->isPlaneAlive() == false && m_planeCrashed == false)
  {
    m_planeCrashed = true; // set that the plane has crashed
    m_timeSinceCrashed = 0.0f;
    m_crowID = -1;   
  }

  // once the timer hits 3 seconds, make the camera follow a crow
  if (m_planeCrashed)
  {
    m_timeSinceCrashed += dt;
    if (m_timeSinceCrashed >= 3.0f && m_crowID == -1)
    {
      // make the camera follow a crow around
      m_crowID = m_objects->getCrow();
      if (m_crowID != -1)
        m_tetherCamera->setTargetObject(m_crowID);

      // play the failed sound
      m_failedSound = gSoundManager.requestSoundHandle("Failed.wav");
      m_failedInstance = gSoundManager.requestInstance(m_failedSound);
      if(m_failedInstance != SoundManager::NOINSTANCE)
      {
        gSoundManager.setToListener(m_failedSound,m_failedInstance);
        gSoundManager.play(m_failedSound,m_failedInstance);
      }
    }
    else if(m_failedInstance != SoundManager::NOINSTANCE)
      gSoundManager.setToListener(m_failedSound,m_failedInstance);
  }

  // render reflection
  if (Water::m_bReflection)
  {
    // render water reflection    
    Plane plane( 0, 1, 0, -water->getWaterHeight());
    //get water texture ready  
    water->m_reflection.beginReflectedScene(plane);
    renderScene(true);
    water->m_reflection.endReflectedScene();    
  }

}
开发者ID:kmh0237,项目名称:GameProgramming2Project,代码行数:66,代码来源:StatePlaying.cpp


注:本文中的PlaneObject::isPlaneAlive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。