本文整理汇总了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);
}
}
}
示例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);
}
示例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();
}
}
}
}
示例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;
}
示例5: GetComponentOfBaseType
inline ComponentType* GetComponentOfBaseType() const
{
VisBaseEntity_cl* pEntity = GetEntity();
if (pEntity == NULL)
return NULL;
return pEntity->Components().GetComponentOfBaseType<ComponentType>();
}
示例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
}
示例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();
}
}
示例8: RemoveLast
void IController::RemoveLast(void)
{
VisBaseEntity_cl *ent = entityStack->pop();
if (ent != NULL)
{
ent->DisposeObject();
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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();
}
}
}
示例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();
}
示例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();
}
}
示例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!");
}
}