本文整理汇总了C++中VisBaseEntity_cl::IsOfType方法的典型用法代码示例。如果您正苦于以下问题:C++ VisBaseEntity_cl::IsOfType方法的具体用法?C++ VisBaseEntity_cl::IsOfType怎么用?C++ VisBaseEntity_cl::IsOfType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisBaseEntity_cl
的用法示例。
在下文中一共展示了VisBaseEntity_cl::IsOfType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}
}
示例2: OnSpawn
///< 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!");
}
}
示例3: 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);
}
}
示例4: CreateEntityFromScript
/// Creates an entity from a Lua script definition.
VisBaseEntity_cl* RPG_GameManager::CreateEntityFromScript(const VString& scriptName, const hkvVec3& position, const hkvVec3& orientation)
{
VScriptResourceManager* scriptManager = static_cast<VScriptResourceManager*>(Vision::GetScriptManager());
VScriptResource* scriptRes = scriptManager->LoadScriptFile(scriptName);
IVScriptInstance* script = scriptRes->CreateScriptInstance();
VASSERT(script);
if(script)
{
// get the entity class type to create
char* className = NULL;
script->ExecuteFunctionArg("GetEntityClassType", "*>s", &className);
// create the entity
VisBaseEntity_cl* entity = Vision::Game.CreateEntity(className, position);
VASSERT(entity);
if(entity)
{
entity->SetOrientation(orientation);
// attach the script
scriptManager->SetScriptInstance(entity, script);
if(entity->IsOfType(V_RUNTIME_CLASS(RPG_BaseEntity)))
{
RPG_BaseEntity* rpgEntity = static_cast<RPG_BaseEntity*>(entity);
#if (RPG_SERIALIZATION_SCRIPT_PROPERTIES)
rpgEntity->InitializeProperties();
#endif
rpgEntity->PostInitialize();
}
return entity;
}
}
return NULL;
}
示例5: SaveGame
VBool SaveGame(int iNum)
{
if ( (iNum < 1) || (iNum > 4) )
{
// we just allow 4 save games
return FALSE;
}
int i;
char pszSaveFileName[FS_MAX_PATH];
sprintf(pszSaveFileName,SAVEGAME_NAME, iNum);
IVFileOutStream* pOut = Vision::File.Create(pszSaveFileName);
// creating the file didn't work!
if (!pOut)
{
return FALSE;
}
VArchive ar( pszSaveFileName, pOut, Vision::GetTypeManager() );
// serialize global game data
ar << ARCHIVE_START_TAG; // magic number
int iSavingVersion = Vision::GetArchiveVersion();
ar << iSavingVersion; // archive class version
ar << g_iCurrentMap; // current map number
ar << Vision::GetTimer()->GetTime(); // current time
// count entities
SerializeBaseEntity_cl *pSerEnt = NULL;
VisBaseEntity_cl *pEnt = NULL;
int iFullCtr = 0;
int iReCreateCtr = 0;
int iNumOfAllEntities = VisBaseEntity_cl::ElementManagerGetSize();
for (i = 0; i < iNumOfAllEntities; i++)
{
pEnt = VisBaseEntity_cl::ElementManagerGet(i);
if ( pEnt )
{
if ( pEnt->IsOfType(SerializeBaseEntity_cl::GetClassTypeId()) )
{
pSerEnt = static_cast<SerializeBaseEntity_cl*>(pEnt);
if ( pSerEnt->GetSerializeType() == SERIALIZE_FULL )
iFullCtr++;
else
iReCreateCtr++;
}
}
}
// serialize number of entities
ar << iReCreateCtr;
ar << iFullCtr;
hkvVec3 vTemp;
// do ReCreate serialization of entities
for (i = 0; i < iNumOfAllEntities; i++)
{
pEnt = VisBaseEntity_cl::ElementManagerGet(i);
if ( pEnt )
{
if ( pEnt->IsOfType(SerializeBaseEntity_cl::GetClassTypeId()) )
{
pSerEnt = (SerializeBaseEntity_cl *) pEnt;
if ( pSerEnt->GetSerializeType() == SERIALIZE_RECREATE )
{
char pszEntityParams[4000];
GetEntityParameters( pSerEnt, pszEntityParams );
VDynamicMesh* pMesh = pSerEnt->GetMesh();
ar << pSerEnt->GetClassFullName() << pSerEnt->GetEntityKey();
vTemp = pSerEnt->GetPosition();
vTemp.SerializeAsVisVector (ar);
vTemp = pSerEnt->GetOrientation();
vTemp.SerializeAsVisVector (ar);
const char *szFilename = pMesh ? pMesh->GetFilename() : NULL;
ar << szFilename << pszEntityParams;
}
}
}
}
// do full serialization of entities
for (i = 0; i < iNumOfAllEntities; i++)
{
pEnt = VisBaseEntity_cl::ElementManagerGet(i);
if ( pEnt )
{
if ( pEnt->IsOfType(SerializeBaseEntity_cl::GetClassTypeId()) )
{
pSerEnt = (SerializeBaseEntity_cl *) pEnt;
if ( pSerEnt->GetSerializeType() == SERIALIZE_FULL )
{
ar << pSerEnt;
}
}
}
}
// store end tag - useful to verify a valid archive
//.........这里部分代码省略.........