本文整理汇总了C++中CGameObject::getObjectType方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::getObjectType方法的具体用法?C++ CGameObject::getObjectType怎么用?C++ CGameObject::getObjectType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::getObjectType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateData
// updateData
// update data
void CWayPoint::updateData( CSerializable* pObj )
{
pObj->nextRecord();
CZone* pZone = (CZone*) getParent();
// next waypoint
long id = pObj->readLong();
CGameObject *p = pZone->searchObject( id );
if ( id != -1 && p )
{
if ( p && p->getObjectType() == CGameObject::WaypointObject )
{
((CWayPoint*)p)->setBack( this );
setNext( (CWayPoint*)p );
}
}
else
{
if ( m_next )
m_next->setBack( NULL );
setNext(NULL);
}
// prev waypoint
id = pObj->readLong();
p = pZone->searchObject( id );
if ( id != -1 && p )
{
if ( p && p->getObjectType() == CGameObject::WaypointObject )
{
((CWayPoint*)p)->setNext( this );
setBack( (CWayPoint*)p );
}
}
else
{
if ( m_back )
m_back->setNext( NULL );
setBack(NULL);
}
// wait time
m_timeWait = pObj->readLong();
CGameObject::updateData( pObj );
}
示例2:
CPlayerComponent::~CPlayerComponent()
{
// unregister collide obj
CGameObject *zone = (CGameObject*)m_gameObject->getParent();
if ( zone && zone->getObjectType() == CGameObject::ZoneObject )
((CZone*)zone)->unRegisterCollideObj( m_gameObject);
// unregister event
getIView()->unRegisterEvent( this );
}
示例3: initComponent
// init
// run when init object
void CPlayerComponent::initComponent()
{
m_collada = (CColladaMeshComponent*)m_gameObject->getComponent( IObjectComponent::ColladaMesh );
// load model by character id
CGameConfig::SCharacterInfo *charInfo = CGameConfig::getInstance()->getCharacterInfo(m_charID);
// load model
m_collada->loadScene(charInfo->model.c_str() );
// load animation
CColladaAnimationFactory* animFactory = CColladaAnimationFactory::getInstance();
m_animationPackage = animFactory->getAnimation( charInfo->name.c_str() );
if ( m_animationPackage == NULL )
m_animationPackage = animFactory->loadAnimation( charInfo->name.c_str(), getIView()->getPath(charInfo->anim));
m_collada->setAnimationPackage( m_animationPackage );
// apply lod
for (int i = 0, n = (int)charInfo->lods.size(); i < n; i++)
m_collada->addLodData( charInfo->lods[i].distance, charInfo->lods[i].node.c_str() );
init(m_gameObject);
// register event
getIView()->registerEvent("CPlayerComponent", this);
// init lua player component
char luaObjName[64];
sprintf(luaObjName, "CPlayerComp_%ld", m_gameObject->getID());
m_luaObjName = luaObjName;
// init collision
ISceneManager *smgr = getIView()->getSceneMgr();
ITriangleSelector *selector = smgr->createTriangleSelectorFromBoundingBox(m_gameObject->getSceneNode());
m_gameObject->getSceneNode()->setTriangleSelector(selector);
selector->drop();
CGameObject *zone = (CGameObject*)m_gameObject->getParent();
if ( zone && zone->getObjectType() == CGameObject::ZoneObject )
((CZone*)zone)->registerCollideObj( m_gameObject);
}
示例4: doCreate
bool CHistoryManager::doCreate( SAction* action, bool redo )
{
IDoc *pDoc = getIView()->getDocument();
CSerializable *pObject = &action->object1;
pObject->setCursorRecord(0);
if ( redo == false )
{
SSerializableRec *pObjectID = pObject->getProperty("objectID");
if ( pObjectID == NULL )
return false;
long objID = -1;
sscanf( pObjectID->data, "%ld", &objID );
CGameObject* pObj = pDoc->searchObject( objID );
if ( pObj == NULL )
return false;
CZone *pZone = (CZone*) pObj->getParent();
pZone->removeObject( pObj );
}
else
{
SSerializableRec *pParentID = pObject->getProperty("parentID");
SSerializableRec *pObjectTemplate = pObject->getProperty("objectTemplate");
SSerializableRec *pObjectType = pObject->getProperty("objectType");
if ( pParentID == NULL )
return false;
long parentID = -1;
sscanf( pParentID->data, "%ld", &parentID );
CGameObject* pParent = pDoc->searchObject( parentID );
if ( pParent == NULL )
return false;
if ( pParent->getObjectType() != CGameObject::ZoneObject )
return false;
CZone *pZone = (CZone*) pParent;
wchar_t objTemplate[1024];
uiString::convertUTF8ToUnicode(pObjectTemplate->data, objTemplate);
CGameObject *pObj = NULL;
if ( strcmp( pObjectType->data, strOfObjType( CGameObject::GameObject ) ) == 0 )
pObj = pZone->createObject( objTemplate );
else if ( strcmp( pObjectType->data, strOfObjType( CGameObject::CameraObject ) ) == 0 )
pObj = pZone->createCamera();
else if ( strcmp( pObjectType->data, strOfObjType( CGameObject::WaypointObject ) ) == 0 )
pObj = pZone->createWaypoint();
else if ( strcmp( pObjectType->data, strOfObjType( CGameObject::TriggerObject ) ) == 0 )
pObj = pZone->createTrigger();
else if ( strcmp( pObjectType->data, strOfObjType( CGameObject::LightObject ) ) == 0 )
pObj = pZone->createLight();
if ( pObj )
{
pObj->updateData( pObject );
pZone->setSortObject( true );
}
}
return true;
}