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


C++ CGameObject::getObjectType方法代码示例

本文整理汇总了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 );
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:51,代码来源:CWayPoint.cpp

示例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 );
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:10,代码来源:CPlayerComponent.cpp

示例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);
		
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:44,代码来源:CPlayerComponent.cpp

示例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;	
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:69,代码来源:CHistoryManager.cpp


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