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


C++ VisBaseEntity_cl::GetEntityKey方法代码示例

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


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

示例1: OnHandleCallback

void VLineFollowerComponent::OnHandleCallback(IVisCallbackDataObject_cl *pData)
{
  VisBaseEntity_cl* pOwner = (VisBaseEntity_cl *)GetOwner();
  if (!pOwner)
    return;

  // Update callback
  if (pData->m_pSender == &Vision::Callbacks.OnUpdateSceneFinished) 
  {
    // Update
    PerFrameUpdate();

    // Debug Render
    if (!Vision::Editor.IsAnimatingOrPlaying())
    {
      if (Debug_RenderMesh)
      {
        hkvVec3 pos = pOwner->GetPosition();
        hkvMat3 rotMat;

        // Setup all coordinates of a single spline
        hkvVec3 p1(0,0,-Model_CapsuleHeight*0.5f-Model_CapsuleRadius);
        hkvVec3 p2(Model_CapsuleRadius*0.7f,0,-Model_CapsuleHeight*0.5f-Model_CapsuleRadius*0.7f);
        hkvVec3 p3(Model_CapsuleRadius,0,-Model_CapsuleHeight*0.5f);
        hkvVec3 p4(Model_CapsuleRadius,0,Model_CapsuleHeight*0.5f);
        hkvVec3 p5(Model_CapsuleRadius*0.7f,0,Model_CapsuleHeight*0.5f+Model_CapsuleRadius*0.7f);
        hkvVec3 p6(0,0,Model_CapsuleHeight*0.5f+Model_CapsuleRadius);

        rotMat.setRotationMatrix (hkvVec3(0,0,1), 60.f);
        pos.z -= Model_GroundOffset;

        // Draw and rotate the spline (6 times)
        int i;
        for(i=0;i<6;i++)
        {
          Vision::Game.DrawSingleLine(pos-p1, pos-p2,V_RGBA_RED);
          Vision::Game.DrawSingleLine(pos-p2, pos-p3,V_RGBA_RED);
          Vision::Game.DrawSingleLine(pos-p3, pos-p4,V_RGBA_RED);
          Vision::Game.DrawSingleLine(pos-p4, pos-p5,V_RGBA_RED);
          Vision::Game.DrawSingleLine(pos-p5, pos-p6,V_RGBA_RED);

          p1 = rotMat.transformDirection(p1);
          p2 = rotMat.transformDirection(p2);
          p3 = rotMat.transformDirection(p3);
          p4 = rotMat.transformDirection(p4);
          p5 = rotMat.transformDirection(p5);
          p6 = rotMat.transformDirection(p6);
        }  
      }
    }
  }

  // Initialization
  if (pData->m_pSender == &Vision::Callbacks.OnAfterSceneLoaded)
  {
    // Find the path to follow
    if (m_pFollowPath==NULL && Path_Key[0])
    {
      m_pFollowPath = Vision::Game.SearchPath(Path_Key);
      InitPhysics(hkvMath::mod (Path_InitialOffset, 1.f));
    }
    return;
  }

  // Event handling
  if (pData->m_pSender==&PathCameraAction::OnTriggerEvent)
  {
    TiXmlElement *pEventNode = ((VPathEventCallbackDataObject *)pData)->m_pEventNode;
    const char *szEntityKey = pEventNode->Attribute(ENTITY_PROPERTY);
    if (szEntityKey && pOwner->GetEntityKey() && !_stricmp(szEntityKey, pOwner->GetEntityKey()))
    {
      const char *szAction = pEventNode->Attribute(ACTION_PROPERTY);

      if(szAction && !_stricmp(szAction,RESET_ACTION))
      {
        InitPhysics(hkvMath::mod (Path_InitialOffset, 1.f));
      } 
      else if(szAction && !_stricmp(szAction,SET_ACTION))
      {
          const char *szPos = pEventNode->Attribute(TO_PROPERTY);
          float fPos = Path_InitialOffset;
          if(szPos) fPos = hkvMath::mod ((float)atof(szPos),1.f);
          InitPhysics(fPos);
      }      
    }
    return;
  }
}
开发者ID:Alagong,项目名称:projectanarchy,代码行数:88,代码来源:VLineFollowerComponent.cpp


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