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(); }
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 ); } } }
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 ); } } } } }
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; } }