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


C++ IEntityClass类代码示例

本文整理汇总了C++中IEntityClass的典型用法代码示例。如果您正苦于以下问题:C++ IEntityClass类的具体用法?C++ IEntityClass怎么用?C++ IEntityClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IEntityClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetEntityType

EEntityType GetEntityType(EntityId id)
{
	int type = eET_Unknown;

	IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
	if (pEntitySystem)
	{
		IEntity *pEntity = pEntitySystem->GetEntity(id);
		if (pEntity)
		{
			type = eET_Valid;

			IEntityClass *pClass = pEntity->GetClass();
			if (pClass)
			{
				const char* className = pClass->GetName();

				// Check AI
				if (pEntity->GetAI())
				{
					type |= eET_AI;
				}
				
				// Check actor
				IActorSystem *pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
				if (pActorSystem)
				{
					IActor *pActor = pActorSystem->GetActor(id);
					if (pActor)
					{
						type |= eET_Actor;
					}
				}

				// Check vehicle
				IVehicleSystem *pVehicleSystem = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem();
				if (pVehicleSystem)
				{
					if (pVehicleSystem->IsVehicleClass(className))
					{
						type |= eET_Vehicle;
					}
				}

				// Check item
				IItemSystem *pItemSystem = gEnv->pGame->GetIGameFramework()->GetIItemSystem();
				if (pItemSystem)
				{
					if (pItemSystem->IsItemClass(className))
					{
						type |= eET_Item;
					}
				}
			}
		}
	}

	return (EEntityType)type;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:59,代码来源:FlowEntityIterator.cpp

示例2: GetActor

//------------------------------------------------------------------------
int CScriptBind_Actor::AddInventoryAmmo(IFunctionHandler *pH, const char *ammo, int amount)
{
	CActor * pActor = GetActor(pH);
	if (!pActor)
		return pH->EndFunction();

	IInventory *pInventory=pActor->GetInventory();
	if (!pInventory)
		return pH->EndFunction();

	IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ammo);
	assert(pClass);

	int capacity = pInventory->GetAmmoCapacity(pClass);
	int current = pInventory->GetAmmoCount(pClass);
	if((!gEnv->pSystem->IsEditor()) && (amount > capacity))
	{
		if(pActor->IsClient())
			SAFE_HUD_FUNC(DisplayFlashMessage("@ammo_maxed_out", 2, ColorF(1.0f, 0,0), true, (string("@")+pClass->GetName()).c_str()));

		//If still there's some place, full inventory to maximum...

		if(current<capacity)
		{
			pInventory->SetAmmoCount(pClass,capacity);
			if(pActor->IsClient() && capacity - current > 0)
			{
				/*char buffer[5];
				itoa(capacity - current, buffer, 10);
				SAFE_HUD_FUNC(DisplayFlashMessage("@grab_ammo", 3, Col_Wheat, true, (string("@")+pClass->GetName()).c_str(), buffer));*/
				if(g_pGame->GetHUD())
					g_pGame->GetHUD()->DisplayAmmoPickup(pClass->GetName(), capacity - current);
			}
			if (gEnv->bServer)
				pActor->GetGameObject()->InvokeRMI(CActor::ClAddAmmo(), CActor::AmmoParams(ammo, amount), eRMI_ToRemoteClients);
		}
	}
	else
	{
		pInventory->SetAmmoCount(pClass, amount);
		if(pActor->IsClient() && amount - current > 0)
		{
			/*char buffer[5];
			itoa(amount - current, buffer, 10);
			SAFE_HUD_FUNC(DisplayFlashMessage("@grab_ammo", 3, Col_Wheat, true, (string("@")+pClass->GetName()).c_str(), buffer));*/
			if(g_pGame->GetHUD())
				g_pGame->GetHUD()->DisplayAmmoPickup(pClass->GetName(), amount - current);
		}
		if (gEnv->bServer)
			pActor->GetGameObject()->InvokeRMI(CActor::ClAddAmmo(), CActor::AmmoParams(ammo, amount), eRMI_ToRemoteClients);
	}

	return pH->EndFunction();
}
开发者ID:mrwonko,项目名称:CrysisVR,代码行数:55,代码来源:ScriptBind_Actor.cpp

示例3: GetOwnerActor

bool CJaw::OutOfAmmo(bool allFireModes) const
{
	CActor* pOwner = GetOwnerActor();
	IInventory* pOwnerInventory = pOwner ? pOwner->GetInventory() : 0;
	if (!pOwnerInventory)
		return true;

	IEntityClass* pJawClass = GetEntity()->GetClass();
	IItemSystem* pItemSystem = gEnv->pGame->GetIGameFramework()->GetIItemSystem();
	int jawUniqueId = pItemSystem->GetItemUniqueId(pJawClass->GetName());
	int currentNumJaws = pOwnerInventory->GetCountOfUniqueId(jawUniqueId);

	return currentNumJaws == 0;
}
开发者ID:amrhead,项目名称:eaascode,代码行数:14,代码来源:JAW.cpp

示例4: GetEntity

bool CJaw::GiveExtraTubeToInventory(IActor* pPickerActor, IItemSystem* pItemSystem) const
{
	if (m_weaponsharedparams->ammoParams.extraItems == 0 || !pPickerActor->IsPlayer())
		return false;

	if (m_extraTubesAdded)
		return false;

	IEntityClass* pJawClass = GetEntity()->GetClass();
	IInventory* pPickerInventory = pPickerActor ? pPickerActor->GetInventory() : 0;
	int jawUniqueId = pItemSystem->GetItemUniqueId(pJawClass->GetName());
	int currentNumJaws = pPickerInventory ? pPickerInventory->GetCountOfUniqueId(jawUniqueId) : 0;
	bool giveExtraTube = (currentNumJaws == 0);

	return giveExtraTube;
}
开发者ID:amrhead,项目名称:eaascode,代码行数:16,代码来源:JAW.cpp

示例5: execute

	void execute(CItem *_this)
	{
		CShotgun *fm = (CShotgun *)pWep->GetFireMode(pWep->GetCurrentFireMode());

		if(fm->m_reload_was_broken)
			return;

		IEntityClass *pAmmoType = fm->GetAmmoType();

		if(pWep->IsServer())
		{
			const int ammoCount = pWep->GetAmmoCount(pAmmoType);
			const int inventoryCount = pWep->GetInventoryAmmoCount(pAmmoType);

			const int refill = fm->m_pShared->shotgunparams.partial_reload ? 1 : min(inventoryCount, fm->GetClipSize() - ammoCount);

			pWep->SetAmmoCount(pAmmoType, ammoCount + refill);
			pWep->SetInventoryAmmoCount(pAmmoType, pWep->GetInventoryAmmoCount(pAmmoType) - refill);
		}

		g_pGame->GetIGameFramework()->GetIGameplayRecorder()->Event(pWep->GetOwner(), GameplayEvent(eGE_WeaponReload, pAmmoType->GetName(), 1, (void *)(pWep->GetEntityId())));

		if(!fm->m_break_reload)
			fm->ReloadShell(rzoomed);
		else
			fm->EndReload(rzoomed);
	}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:27,代码来源:Shotgun.cpp

示例6: ResetClient

void CEditorGame::ResetClient(IConsoleCmdArgs*)
{
	bool value = s_pEditorGame->m_bPlayer;
	s_pEditorGame->EnablePlayer(false);

	IEntityClass *pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("Player");
	if (pClass)	pClass->LoadScript(true);

	if (value)
	{
		s_pEditorGame->ConfigureNetContext(true);
		SetGameRules();
	}
	s_pEditorGame->EnablePlayer(value);
	s_pEditorGame->HidePlayer(true);
}
开发者ID:MrHankey,项目名称:Tanks,代码行数:16,代码来源:EditorGame.cpp

示例7: ToggleMultiplayerGameRules

//------------------------------------------------------------------------
void CEditorGame::ToggleMultiplayerGameRules()
{
	m_bUsingMultiplayerGameRules = !m_bUsingMultiplayerGameRules;
	bool value = s_pEditorGame->m_bPlayer;
	s_pEditorGame->EnablePlayer(false);
	s_pEditorGame->ConfigureNetContext(true);
	IEntityClass *pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("Player");

	if (pClass)
	{
		pClass->LoadScript(true);
	}

	SetGameRules();
	s_pEditorGame->EnablePlayer(value);
	s_pEditorGame->HidePlayer(true);
	gEnv->pConsole->ShowConsole(false);
}
开发者ID:Oliverreason,项目名称:bare-minimum-cryengine3,代码行数:19,代码来源:EditorGame.cpp

示例8: ResetClient

void CEditorGame::ResetClient(IConsoleCmdArgs*)
{
	g_pGame->ReloadPlayerParamFiles();

	bool value = s_pEditorGame->m_bPlayer;
	s_pEditorGame->EnablePlayer(false);

	IEntityClass *pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("Player");
	if (pClass)	pClass->LoadScript(true);

	if (value)
	{
		s_pEditorGame->ConfigureNetContext(true);
		const char *pGameRulesName = GetGameRulesName();
		s_pEditorGame->m_pGame->GetIGameFramework()->GetIGameRulesSystem()->CreateGameRules(pGameRulesName);
	}
	s_pEditorGame->EnablePlayer(value);
	s_pEditorGame->HidePlayer(true);
}
开发者ID:aronarts,项目名称:FireNET,代码行数:19,代码来源:EditorGame.cpp

示例9: assert

bool CEntityClassRegistry::RegisterEntityClass( IEntityClass *pClass )
{
	assert( pClass != NULL );

	bool	newClass = false;
	if ((pClass->GetFlags() & ECLF_MODIFY_EXISTING) == 0)
	{
		IEntityClass *pOldClass = FindClass(pClass->GetName());
		if (pOldClass)
		{
			EntityWarning( "CEntityClassRegistry::RegisterEntityClass failed, class with name %s already registered",
				pOldClass->GetName() );
			return false;
		}
		newClass = true;
	}
	m_mapClassName[pClass->GetName()] = pClass;
	NotifyListeners(newClass ? ECRE_CLASS_REGISTERED : ECRE_CLASS_MODIFIED, pClass);
	return true;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:20,代码来源:EntityClassRegistry.cpp

示例10: SetGameObject

bool CMonoEntityExtension::Init(IGameObject *pGameObject)
{
	SetGameObject(pGameObject);

	pGameObject->EnablePhysicsEvent( true, eEPE_OnPostStepImmediate );

	if (!GetGameObject()->BindToNetwork())
		return false;

	IEntity *pEntity = GetEntity();
	IEntityClass *pEntityClass = pEntity->GetClass();

	m_pScript = g_pScriptSystem->InstantiateScript(pEntityClass->GetName(), eScriptFlag_Entity);

	IMonoClass *pEntityInfoClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("EntityInitializationParams", "CryEngine.Native");

	SMonoEntityInfo entityInfo(pEntity);

	IMonoArray *pArgs = CreateMonoArray(1);
	pArgs->InsertMonoObject(pEntityInfoClass->BoxObject(&entityInfo));

	g_pScriptSystem->InitializeScriptInstance(m_pScript, pArgs);
	pArgs->Release();

	int numProperties;
	auto pProperties = static_cast<CEntityPropertyHandler *>(pEntityClass->GetPropertyHandler())->GetQueuedProperties(pEntity->GetId(), numProperties);

	if(pProperties)
	{
		for(int i = 0; i < numProperties; i++)
		{
			auto queuedProperty = pProperties[i];

			SetPropertyValue(queuedProperty.propertyInfo, queuedProperty.value.c_str());
		}
	}

	m_bInitialized = true;

	return true;
}
开发者ID:nathanpapke,项目名称:CryMono,代码行数:41,代码来源:MonoEntity.cpp

示例11: InitEntityClassesEnums

void CEditorGame::InitEntityClassesEnums(IGameToEditorInterface* pGTE)
{
	// init ActionFilter enums
	gEnv->pEntitySystem->GetClassRegistry()->IteratorMoveFirst();
	IEntityClass* entClass = gEnv->pEntitySystem->GetClassRegistry()->IteratorNext();
	const char** allEntities = new const char*[gEnv->pEntitySystem->GetClassRegistry()->GetClassCount()+2];

	allEntities[0] = "AllClasses";
	allEntities[1] = "CustomClasses";

	unsigned int numEnts = 2;
	while (entClass)
	{
		const char* classname = entClass->GetName();
		allEntities[numEnts++] = classname;
		entClass = gEnv->pEntitySystem->GetClassRegistry()->IteratorNext();
	}

	pGTE->SetUIEnums("entity_classes", allEntities, numEnts);
	delete[] allEntities;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:21,代码来源:EditorGame.cpp

示例12: CryWarning

// ===========================================================================
//	Cache the resources of an actor class (pre-load them).
//
//	In:		The LUA function handler.
//	In:		The name of the actor entity class that we should pre-load 
//			(case-sensitive) (NULL is invalid!)
//
int CScriptBind_Game::CacheActorClassResources(IFunctionHandler *pH, const char* actorEntityClassName)
{
	if (actorEntityClassName == NULL)
	{
		CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, 
			"CacheActorClassResources(): Invalid entity actor class name!");
	}
	else
	{
		IEntityClass* entityClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(actorEntityClassName);
		if (entityClass == NULL)
		{
			CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, 
				"CacheActorClassResources(): Unable to cache entity actor class resource '%s'!", actorEntityClassName);
		}	
		else
		{
			g_pGame->GetGameCache().CacheActorClass(entityClass, entityClass->GetScriptTable());
		}
	}		

	return pH->EndFunction();
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:30,代码来源:ScriptBind_Game.cpp

示例13: GetEntity

void CVicinityDependentObjectMover::ActivateOutputPortBool( const char* szPortName )
{
	IEntity* pEntity = GetEntity();
	CRY_ASSERT( pEntity );

	IEntityClass::SEventInfo eventInfo;
	IEntityClass *pEntityClass = pEntity->GetClass();
	if ( pEntityClass->FindEventInfo( szPortName,eventInfo ) )
	{
		SEntityEvent event( ENTITY_EVENT_SCRIPT_EVENT );
		event.nParam[0] = (INT_PTR)szPortName;
		event.nParam[1] = IEntityClass::EVT_BOOL;

		bool bValue = true;
		event.nParam[2] = (INT_PTR)&bValue;

		GetEntity()->SendEvent( event );
	}
	else
	{
		GameWarning( "CVicinityDependentObjectMover::ActivateOutputPortBool: Called with undefined port %s", szPortName );
	}
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:23,代码来源:VicinityDependentObjectMover.cpp

示例14: FUNCTION_PROFILER

void CScriptProxy::Reload( IEntity* pEntity,SEntitySpawnParams &params )
{
	FUNCTION_PROFILER( GetISystem(), PROFILE_ENTITY );

	IEntityClass*  pClass        = (pEntity ? pEntity->GetClass() : NULL);
	CEntityScript* pEntityScript = (pClass ? (CEntityScript*)pClass->GetIEntityScript() : NULL);
	if (pEntityScript && pEntityScript->LoadScript())
	{
		// Release current
		SAFE_RELEASE(m_pThis);

		m_pEntity                = (CEntity*)pEntity;
		m_pScript                = pEntityScript;
		m_nCurrStateId           = 0;
		m_fScriptUpdateRate      = 0;
		m_fScriptUpdateTimer     = 0;
		m_bEnableSoundAreaEvents = false;

		m_bUpdateScript = CurrentState()->IsStateFunctionImplemented(ScriptState_OnUpdate);

		// New object must be created here.
		CreateScriptTable(&params);
	}
}
开发者ID:joewan,项目名称:pycmake,代码行数:24,代码来源:ScriptProxy.cpp

示例15: if

//-----------------------------------------------------
void CThrow::ThrowGrenade()
{
	//Grenade speed scale is always one (for player)
	CPlayer *pPlayer = static_cast<CPlayer *>(m_pWeapon->GetOwnerActor());

	if(pPlayer)
	{
		if(pPlayer->IsPlayer())
		{
			m_speed_scale = 1.0f;
		}
		else if(pPlayer->GetHealth() <= 0 || pPlayer->GetGameObject()->GetAspectProfile(eEA_Physics) == eAP_Sleep)
		{
			return;    //Do not throw grenade is player is death (AI "ghost grenades")
		}

		//Hide grenade in hand (FP)
		if(pPlayer->IsClient() && m_pWeapon->GetEntity()->GetClass() == CItem::sOffHandClass)
		{
			if(COffHand *pOffHand = static_cast<COffHand *>(m_pWeapon))
			{
				pOffHand->AttachGrenadeToHand(pOffHand->GetCurrentFireMode());
			}
		}
	}

	m_pWeapon->SetBusy(false);
	Shoot(true);
	m_pWeapon->SetBusy(true);

	// Luciano - send ammo count game event
	if(pPlayer)
	{
		IEntityClass *pAmmo = m_pShared->fireparams.ammo_type_class;

		if(pAmmo)
		{
			int ammoCount = pPlayer->GetInventory()->GetAmmoCount(pAmmo);
			g_pGame->GetIGameFramework()->GetIGameplayRecorder()->Event(pPlayer->GetEntity(), GameplayEvent(eGE_AmmoCount, m_pWeapon->GetEntity()/*->GetClass()*/->GetName(), float(ammoCount), (void *)(pAmmo->GetName())));
		}
	}
}
开发者ID:Oliverreason,项目名称:bare-minimum-cryengine3,代码行数:43,代码来源:Throw.cpp


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