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


C++ VisBaseEntity_cl类代码示例

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


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

示例1: SpawnPlayer

void RPG_GameManager::OnAfterSceneLoaded()
{
  RPG_RendererUtil::StoreViewParams(m_storedViewParams);

  // Set up game view params
  RPG_ViewParams viewParams = m_storedViewParams;
  {
    viewParams.m_projectionType = VIS_PROJECTIONTYPE_PERSPECTIVE;
    viewParams.m_nearClip = 50.f;
    viewParams.m_farClip = 2500.f;
    viewParams.m_fovX = 0.f;
    viewParams.m_fovY = 50.f;
  }

  RPG_RendererUtil::LoadViewParams(viewParams);

  // Local player
  VisBaseEntity_cl* playerEntity = SpawnPlayer("Prefabs\\Demo_Player_Hero.vprefab");

  if(playerEntity)
  {
    RPG_PlayerControllerComponent *const playerController = static_cast<RPG_PlayerControllerComponent*>
      (playerEntity->Components().GetComponentOfBaseType(V_RUNTIME_CLASS(RPG_PlayerControllerComponent)));

    VASSERT(playerController);
    if(playerController)
    {
      RPG_PlayerUI::s_instance.SetController(playerController);
    }
  }
}
开发者ID:Bewolf2,项目名称:projectanarchy,代码行数:31,代码来源:GameManager.cpp

示例2: OnAnimationEvent

void VAnimationEventEffectTrigger::OnAnimationEvent() 
{
  // Get the active event trigger info
  VEventEffectTriggerInfo_t* info = (VEventEffectTriggerInfo_t*) m_pActiveTriggerInfo;

  // Check if effect file is specified
  if (info == NULL || info->m_spEffectFile == NULL)
    return;
  
  // Get bone translation and orientation (if bone ID is 0 no bone has been specified)
  VisBaseEntity_cl* pEntity = (VisBaseEntity_cl *)m_pOwner;
  hkvVec3 vPos = pEntity->GetPosition() + info->m_vPositionOffset;
  hkvVec3 vOri = pEntity->GetOrientation() + info->m_vOrientationOffset;
  if (info->m_iAttachToBone != -1)
  {
    hkvQuat vRot;
    pEntity->GetBoneCurrentWorldSpaceTransformation(info->m_iAttachToBone, vPos, vRot);

    // Add position and orientation offset
    vPos = PositionOffset + vPos;
    hkvQuat vOffsetRot; vOffsetRot.setFromEulerAngles (vOri.data[2], vOri.data[1], vOri.data[0]); 
    vRot = vRot.multiplyReverse (vOffsetRot);

    vRot.getAsEulerAngles (vOri.z, vOri.y, vOri.x);
  }

  // Trigger effect
  VisParticleEffect_cl* pEffectInstance = info->m_spEffectFile->CreateParticleEffectInstance(vPos, vOri);
  pEffectInstance->SetRemoveWhenFinished(true);
}
开发者ID:Bewolf2,项目名称:projectanarchy,代码行数:30,代码来源:VAnimationEventEffectTrigger.cpp

示例3: ResetWorld

// ---------------------------------------------------------------------------------
// Method: ResetWorld
// Notes: This function is used by the LoadGame function to get rid of all
//        serializeable entities.
// ---------------------------------------------------------------------------------
void ResetWorld()
{
  int i;
  int iNumOfAllEntities = VisBaseEntity_cl::ElementManagerGetSize();
  
  // send CLEANUP messages to all the entities that are about to be freed, so
  // that they have a chance of cleaning up whatever is necessary before the
  // world is destroyed
  for (i = 0; i < iNumOfAllEntities; i++)
  {
    VisBaseEntity_cl *pEnt = VisBaseEntity_cl::ElementManagerGet(i);
    if ( pEnt )
    {
      if ( pEnt->IsOfType(SerializeBaseEntity_cl::GetClassTypeId()) )
      {
        Vision::Game.SendMsg(pEnt, MSG_SER_CLEANUP, 0, 0 );
      }
    }
  }

  // now actually free all the serializeable entities
  for (i = 0; i < iNumOfAllEntities; i++)
  {
    VisBaseEntity_cl *pEnt = VisBaseEntity_cl::ElementManagerGet(i);
    if ( pEnt )
    {
      if ( pEnt->IsOfType(SerializeBaseEntity_cl::GetClassTypeId()) )
      {
        pEnt->DisposeObject();
      }
    }
  }
}
开发者ID:cDoru,项目名称:projectanarchy,代码行数:38,代码来源:main.cpp

示例4: CreateEntityFromPrefab

VisBaseEntity_cl* MyGameManager::SpawnPlayer(const VString& prefabName, hkvVec3 const& position, hkvVec3 const& orientation)
{
	
    VisBaseEntity_cl* playerEntity = CreateEntityFromPrefab(prefabName, position, orientation);
    playerEntity->InitFunction();
    
    if(playerEntity)
    {
        PlayerComponent *const playerController = static_cast<PlayerComponent*>
        (playerEntity->Components().GetComponentOfBaseType(V_RUNTIME_CLASS(PlayerComponent)));
        
        //VASSERT(playerController);
        if(playerController)
        {
            spGUIContext = new VGUIMainContext(NULL);
            // Create a GUI context
            mDialog = new PlayerDialog(playerController);
            mDialog->InitDialog(spGUIContext, NULL, NULL);
            spGUIContext->ShowDialog(mDialog);
            spGUIContext->SetActivate(true);
        }
        
        m_playerEntity = playerEntity->GetWeakReference();
        //Vision::Message.Add(1, "Spawn");
    }
    
    return playerEntity;
}
开发者ID:KingdomKatie,项目名称:FYP_IOS_2.5,代码行数:28,代码来源:GameManager.cpp

示例5: GetComponentOfBaseType

 inline ComponentType* GetComponentOfBaseType() const 
 { 
   VisBaseEntity_cl* pEntity = GetEntity();
   if (pEntity == NULL)
     return NULL;
   return pEntity->Components().GetComponentOfBaseType<ComponentType>();
 }
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:7,代码来源:VCameraHandling.hpp

示例6: MessageFunction

void VAnimationEventEffectTrigger::MessageFunction( int iID, INT_PTR iParamA, INT_PTR iParamB )
{  
  IVTransitionEventTrigger::MessageFunction(iID, iParamA, iParamB);

#ifdef WIN32
  if (iID == VIS_MSG_EDITOR_GETSTANDARDVALUES)
  {
    // Get bone names
    const char *szKey = (const char *)iParamA;
    if (!strcmp(szKey,"Bone"))
    {
      // Check for model and skeleton
      VisBaseEntity_cl* pEntity = (VisBaseEntity_cl *)m_pOwner;
      if (pEntity == NULL)
        return;
      VDynamicMesh* pMesh = pEntity->GetMesh();
      if (pMesh == NULL)
        return;
      VisSkeleton_cl *pSkeleton = pMesh->GetSkeleton();
      if (pSkeleton == NULL)
        return;

      // Fill list with bone names (first entry is empty)
      VStrList *pDestList = (VStrList*) iParamB;
      pDestList->AddString(" ");
      for (int i = 0; i < pSkeleton->GetBoneCount(); i++)
        pDestList->AddString(pSkeleton->GetBone(i)->m_sBoneName.AsChar());
    }
  }
#endif
}
开发者ID:Bewolf2,项目名称:projectanarchy,代码行数:31,代码来源:VAnimationEventEffectTrigger.cpp

示例7: DeactivateAllCameras

void VCameraHandling::DeactivateAllCameras()
{
  // Deactivate all orbit and path cameras.
  const unsigned int uiNumEntities = VisBaseEntity_cl::ElementManagerGetSize();

  for (unsigned int uiElementIndex = 0; uiElementIndex < uiNumEntities; uiElementIndex++)
  {
    VisBaseEntity_cl* pEntity = VisBaseEntity_cl::ElementManagerGet(uiElementIndex);
    if (pEntity == NULL)
      continue;

    VFreeCamera* pFreeCamera = vdynamic_cast<VFreeCamera*>(pEntity);
    VOrbitCamera* pOrbitCamera = pEntity->Components().GetComponentOfBaseType<VOrbitCamera>();
    PathCameraEntity* pPathCamera = vdynamic_cast<PathCameraEntity*>(pEntity);

    if (pFreeCamera != NULL)
      pFreeCamera->SetThinkFunctionStatus(FALSE);

    if (pOrbitCamera != NULL)
      pOrbitCamera->SetEnabled(false);

    if (pPathCamera != NULL)
      pPathCamera->Stop();
  }
}
开发者ID:Superdenny,项目名称:peggle,代码行数:25,代码来源:VCameraHandling.cpp

示例8: RemoveLast

void IController::RemoveLast(void)
{
    VisBaseEntity_cl *ent = entityStack->pop();
    if (ent != NULL)
    {
        ent->DisposeObject();
    }
}
开发者ID:josh-nitzahn,项目名称:ScenesOfAnarchy,代码行数:8,代码来源:IController.cpp

示例9: CommonInit

bool VAnimationEventEffectTrigger::CommonInit()
{
  // Initialize base component
  if (!IVTransitionEventTrigger::CommonInit())
    return false;
  
  // Get owner entity
  VisBaseEntity_cl *pEntity = (VisBaseEntity_cl *)m_pOwner;
  if (pEntity == NULL)
    return false;

  // Fill the event trigger info
  if (m_iEventTriggerInfoCount <= 0)
  {
    VEventEffectTriggerInfo_t* info = NULL;
    if(m_pActiveTriggerInfo == NULL) //make sure it does not get created more than once
    {
      // Create new list with only one entry and set properties
      info = new VEventEffectTriggerInfo_t();
    }
    else
    {
      info = (VEventEffectTriggerInfo_t*)m_pActiveTriggerInfo;
    }

    info->m_vPositionOffset = PositionOffset;
    info->m_vOrientationOffset= OrientationOffset;


    // Get effect file
    info->m_spEffectFile = VisParticleGroupManager_cl::GlobalManager().LoadFromFile(EffectFilename);
    if (info->m_spEffectFile == NULL || !GetEventTriggerInfoBaseData(info))
    {
      V_SAFE_DELETE(info);
      m_pActiveTriggerInfo = NULL;
      return false;
    }

    // Get Bone Index if specified
    if (!AttachToBone.IsEmpty())
    {
      VDynamicMesh* pMesh = pEntity->GetMesh();
      if (pMesh == NULL)
        return false;
      VisSkeleton_cl *pSkeleton = pMesh->GetSkeleton();
      if (pSkeleton == NULL)
        return false;

      info->m_iAttachToBone = pSkeleton->GetBoneIndexByName(AttachToBone);
    }

    // Set it as the active event trigger info
    m_pActiveTriggerInfo = info;
  }

  return true;
}
开发者ID:Bewolf2,项目名称:projectanarchy,代码行数:57,代码来源:VAnimationEventEffectTrigger.cpp

示例10: hkvVec3

VisBaseEntity_cl* IController::AddCube(float x, float y, float z) {
    VisBaseEntity_cl *ent = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3(x, y, z), "Models\\Misc\\Cube.Model");
    vHavokRigidBody *cube = new vHavokRigidBody();
    cube->Havok_TightFit = true;
    ent->AddComponent(cube);
    //EntityStack stack = *entityStack;
    //stack.push(ent);
    entityStack->push(ent);
    return ent;
}
开发者ID:josh-nitzahn,项目名称:ScenesOfAnarchy,代码行数:10,代码来源:IController.cpp

示例11: FindLevelInfo

/// Finds and stores the level info object.
void RPG_GameManager::FindLevelInfo()
{
  // find the level info object
  VisBaseEntity_cl* levelInfo = Vision::Game.SearchEntity(RPG_LevelInfo::GetStaticKey());

  if(levelInfo &&
    levelInfo->IsOfType(V_RUNTIME_CLASS(RPG_LevelInfo)))
  {
    // store the level info object if we found one
    m_levelInfo = static_cast<RPG_LevelInfo*>(levelInfo);
  }
}
开发者ID:Bewolf2,项目名称:projectanarchy,代码行数:13,代码来源:GameManager.cpp

示例12: DeactivatePathCameraEntities

// Some sample scenes create an automatic path camera, which doesn't work with
// our multi-context approach to rendering stereoscopic images, so we'll have to
// find and deactivate them.
void DeactivatePathCameraEntities()
{
  for (unsigned int i=0;i<VisBaseEntity_cl::ElementManagerGetSize();i++)
  {
    VisBaseEntity_cl *pEnt = VisBaseEntity_cl::ElementManagerGet(i);
    if ( pEnt && pEnt->GetTypeId() == PathCameraEntity::GetClassTypeId() )
    {
      PathCameraEntity* pPathCam = ( PathCameraEntity* ) pEnt;
      pPathCam->Stop();
    }
  }
}
开发者ID:cDoru,项目名称:projectanarchy,代码行数:15,代码来源:OculusVR.cpp

示例13:

  EngineInstancePathCamera::EngineInstancePathCamera()
  {
    VisBaseEntity_cl *pEntity = Vision::Game.CreateEntity("PathCameraEntity",hkvVec3(0,0,0));
    Debug::Assert(pEntity!=nullptr,"Could not create Cloth entity!");

    // reference the entity with a weak pointer. This will make sure that we correctly get a null pointer
    // if the entity gets deleted in the engine
    m_pEntityWP = new VWeakPtr<VisBaseEntity_cl>(pEntity->GetWeakReference());

    m_pSpriteTex = Vision::TextureManager.Load2DTexture("textures\\videoCamera.dds",VTM_FLAG_DEFAULT_NON_MIPMAPPED);
    m_pSpriteTex->AddRef();

  }
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:13,代码来源:EngineInstancePathCamera.cpp

示例14: VISION_PROFILE_FUNCTION

// Helper for OnRunGameLoop
// Post-physics loop: posthink & modulesystem-notifications
void VisionApp_cl::RunThink(float fElapsedTime)
{
  const VisEntityCollection_cl &relevantEntities = Vision::Game.GetThinkingEntities();

  VISION_PROFILE_FUNCTION(VIS_PROFILE_GAMELOOP_THINKFUNCTION);

  int &i = relevantEntities.m_iIterator; // use this iterator to keep counter in-sync if collection changes during loop
  for (i=0; i<relevantEntities.GetNumEntries(); i++)
  {
    VisBaseEntity_cl *pEntity = relevantEntities.GetEntry(relevantEntities.m_iIterator);
    VASSERT(pEntity->GetThinkFunctionStatus());

    // entity code postthink
    pEntity->ThinkFunction();
  }
}
开发者ID:Bewolf2,项目名称:projectanarchy,代码行数:18,代码来源:VisionApp.cpp

示例15: GetPosition

///< Spawn the Ai Character and perform any setup we need to of them.
void RPG_AiSpawnPoint::OnSpawn()
{
  // only spawn if we haven't already. @todo: add support for spawning waves of characters.
  if(m_spawned)
  {
    return;
  }

  m_spawned = true;

  bool success = false;

  if(!m_prefabName.IsEmpty())
  {
    VisBaseEntity_cl* entity = RPG_GameManager::s_instance.CreateEntityFromPrefab(m_prefabName, GetPosition(), GetOrientation());
    
    if(entity)
    {
      if(entity->IsOfType(V_RUNTIME_CLASS(RPG_Character)))
      {
        m_character = static_cast<RPG_Character*>(entity);
      }

      success = true;
    }
  }
  else if(!m_spawnScript.IsEmpty())
  {
    VisBaseEntity_cl* entity = RPG_GameManager::s_instance.CreateEntityFromScript(m_spawnScript, GetPosition(), GetOrientation());
    VASSERT(entity);

    if(entity)
    {
      if(entity->IsOfType(V_RUNTIME_CLASS(RPG_Character)))
      {
        m_character = static_cast<RPG_Character*>(entity);
      }

      success = true;
    }
  }

  if(!success)  
  {
    hkvLog::Warning("Ai Spawner has no Prefab defined, and no valid Script definition!");
  }
}
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:48,代码来源:AiSpawnPoint.cpp


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