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


C++ IScriptSystem::ReleaseFunc方法代码示例

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


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

示例1: CallCustomExecutionFunction

bool CCustomReactionFunctions::CallCustomExecutionFunction(ScriptTablePtr hitDeathReactionsTable, CActor& actor, const SReactionParams& reactionParams, const HitInfo& hitInfo) const
{
	CRY_ASSERT(!reactionParams.sCustomExecutionFunc.empty());

	bool bSuccess = false;

	// try LUA first. This is so overriding C++ functions can be easily done on LUA, without the need to recompile or to change 
	// the name of the LUA methods in both reactionParams and script code
	HSCRIPTFUNCTION executionFunc = NULL;
	if (hitDeathReactionsTable->GetValue(reactionParams.sCustomExecutionFunc.c_str(), executionFunc))
	{
		IScriptSystem* pScriptSystem = hitDeathReactionsTable->GetScriptSystem();
		bSuccess = Script::Call(pScriptSystem, executionFunc, hitDeathReactionsTable, reactionParams.reactionScriptTable);
		pScriptSystem->ReleaseFunc(executionFunc);
	}

	// Try C++ now
	if (!bSuccess)
	{
		// C++ custom execution
		ExecutionFncContainer::const_iterator itFind = m_executionFunctors.find(reactionParams.sCustomExecutionFunc);
		if (itFind != m_executionFunctors.end())
		{
			// [*DavidR | 21/Oct/2010] C++ custom functions have the advantage of receiving a reference to the hitinfo, LUA methods can get the "lastHit" so we
			// avoid the expensive construction of the hitInfo table
			itFind->second(actor, reactionParams, hitInfo);
			bSuccess = true;
		}
		else
			CHitDeathReactionsSystem::Warning("Couldn't find custom execution function (%s)", reactionParams.sCustomExecutionFunc.c_str());
	}

	return bSuccess;
}
开发者ID:Adi0927,项目名称:alecmercer-origins,代码行数:34,代码来源:CustomReactionFunctions.cpp

示例2: OnCheckpointLoaded

void CCheckpointSystem::OnCheckpointLoaded(SCheckpointData metaData)
{
	IEntity *pCheckpoint = gEnv->pEntitySystem->GetEntity(metaData.m_checkPointId);
	if(pCheckpoint)
	{
		//Trigger OnLoad
		IScriptTable *pScript = pCheckpoint->GetScriptTable();
		if (pScript)
		{
			HSCRIPTFUNCTION hScriptFunc(NULL);
			pScript->GetValue("Event_OnLoadCheckpoint", hScriptFunc);

			if (hScriptFunc) //this will trigger the flowgraph output
			{
				IScriptSystem *pIScriptSystem = gEnv->pScriptSystem;
				Script::Call(pIScriptSystem,hScriptFunc,pScript);
				pIScriptSystem->ReleaseFunc(hScriptFunc);
			}
		}
	}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:21,代码来源:CheckPointSystem.cpp


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