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


C++ Orientation::SetX方法代码示例

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


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

示例1: SetActive

void EngineStatePoolShowShot::SetActive(bool active)
{
  if (active)
  {
    GetEngine()->SetLetterbox(true);

    m_pLevel = LevelServer::Instance()->GetCurrentLevel();

    // The "take shot" animation expects the ball to be at the (x, z) origin.
    Orientation o = *(GetActivePlayer()->GetOrientation());
    Vec3f v = GetBall()->GetOrientation()->GetVertex();
    o.SetX(v.x);
    o.SetZ(v.z);

    GetActivePlayer()->SetOrientation(o); 

    if (IsOnlineGame() && 
        Engine::Instance()->GetGameState()->GetCurrentPlayerInfo()->m_isOnline) // TEST
    {
      // Player character was hidden, so unhide
      GetActivePlayer()->SetAlpha(1.0f); 
    }
    GetActivePlayer()->SetActionGo();

    Assert(GetCamera().GetPtr());    
   
    // For testing, allow user to cycle through all valid shots. 
    // Don't play on until key is pressed.
#ifdef SHOW_VALID_SHOTS
    SetMaxTime(99999.9f);
    // Debug print info on current shot
    m_validShotNum = -1;
    Blue(true);
#else
    // POOL - immediately play shot, as the use has already swing the cue.
    // But do wait if player is not user controlled, so we see the swing
    // animation.
    if (IsUserControlled())
    {
      SetMaxTime(0); 
    }
    else
    {
      SetMaxTime(GetEngine()->GetConfigFloat("golf_swing_time"));
      // Pull the camera back so we can see where the AI player is aiming.
      Camera* pCam = GetCamera().GetPtr();
      PoolCamera* pPoolCam = dynamic_cast<PoolCamera*>(pCam);
      if (pPoolCam)
      {
        pPoolCam->SetIsAiPlayer(true);
      }
      // If online player is taking shot we want the camera to be looking
      // at the player character, not behind her.
      if (IsOnlineGame())
      {
#ifdef _DEBUG
std::cout << "*** IS ONLINE, setting camera...\n";
#endif

        Orientation o = *(GetActivePlayer()->GetOrientation());
        Orientation o2 = *(GetBall()->GetOrientation());
        o2.SetYRot(o.GetYRot() + 180.0f); // look at from front
        GetBall()->SetOrientation(o2);
        GetCamera()->Reset();
      }
    }
#endif
    m_time = 0;
  }
  else
  {
    GetEngine()->SetLetterbox(false);
  }
}
开发者ID:jason-amju,项目名称:amju-scp,代码行数:74,代码来源:EngineStatePoolShowShot.cpp


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