本文整理汇总了C++中CGameObject::SendEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::SendEvent方法的具体用法?C++ CGameObject::SendEvent怎么用?C++ CGameObject::SendEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::SendEvent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendEventToGameObject
int CScriptBind_Game::SendEventToGameObject( IFunctionHandler* pH, ScriptHandle entityId, char* event )
{
IEntity* pEntity = gEnv->pEntitySystem->GetEntity( (EntityId)entityId.n );
if (pEntity != NULL)
{
CGameObject* pGameObject = static_cast<CGameObject*>(pEntity->GetProxy(ENTITY_PROXY_USER));
if (pGameObject != NULL)
{
SGameObjectEvent goEvent( (uint32)eGFE_ScriptEvent, eGOEF_ToExtensions, IGameObjectSystem::InvalidExtensionID, event );
pGameObject->SendEvent( goEvent );
}
}
return pH->EndFunction();
}
示例2: NotifyMineEvent
void CMineField::NotifyMineEvent( const EntityId targetEntity, const EMineGameObjectEvent event )
{
IEntity* pEntity = gEnv->pEntitySystem->GetEntity( targetEntity );
if (pEntity)
{
CGameObject* pGameObject = static_cast<CGameObject*>(pEntity->GetComponent<IComponentUser>().get());
if (pGameObject != NULL)
{
const EntityId thisEntityId = GetEntityId();
SGameObjectEvent goEvent( (uint32)event, eGOEF_ToExtensions, IGameObjectSystem::InvalidExtensionID, (void*)(&(thisEntityId)) ); // This entity's id is sent as parameter
pGameObject->SendEvent( goEvent );
}
}
}
示例3: NotifyScreenSharingEvent
void CDoorPanel::NotifyScreenSharingEvent(const EDoorPanelGameObjectEvent event)
{
if (m_screenSharingEntities.size() > 0)
{
const EntityId thisEntityId = GetEntityId();
for (size_t i = 0; i < m_screenSharingEntities.size(); i++)
{
const EntityId entityId = m_screenSharingEntities[i];
IEntity* pEntity = gEnv->pEntitySystem->GetEntity( entityId );
if (pEntity)
{
CGameObject* pGameObject = static_cast<CGameObject*>(pEntity->GetProxy(ENTITY_PROXY_USER));
if (pGameObject != NULL)
{
SGameObjectEvent goEvent( (uint32)event, eGOEF_ToExtensions, IGameObjectSystem::InvalidExtensionID, (void*)(&(thisEntityId)) );
pGameObject->SendEvent( goEvent );
}
}
}
}
}
示例4: NotifyMineListenersEvent
void CSmartMine::NotifyMineListenersEvent( const EMineEventListenerGameObjectEvent event )
{
const EntityId thisEntityId = GetEntityId();
TMineEventListeners::iterator iter = m_mineEventListeners.begin();
const TMineEventListeners::const_iterator iterEnd = m_mineEventListeners.end();
while (iter != iterEnd)
{
const EntityId entityId = *iter;
IEntity* pEntity = gEnv->pEntitySystem->GetEntity( entityId );
if (pEntity)
{
CGameObject* pGameObject = static_cast<CGameObject*>(pEntity->GetProxy(ENTITY_PROXY_USER));
if (pGameObject != NULL)
{
SGameObjectEvent goEvent( (uint32)event, eGOEF_ToExtensions, IGameObjectSystem::InvalidExtensionID, (void*)(&(thisEntityId)) ); // This entity's id is sent as parameter
pGameObject->SendEvent( goEvent );
}
}
++iter;
}
}