本文整理汇总了C++中IScriptSystem::ExecuteFile方法的典型用法代码示例。如果您正苦于以下问题:C++ IScriptSystem::ExecuteFile方法的具体用法?C++ IScriptSystem::ExecuteFile怎么用?C++ IScriptSystem::ExecuteFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScriptSystem
的用法示例。
在下文中一共展示了IScriptSystem::ExecuteFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
bool CScriptSurfaceType::Load( int nId )
{
m_nId = nId;
IScriptSystem *pScriptSystem = gEnv->pScriptSystem;
SmartScriptTable mtlTable;
if (!pScriptSystem->GetGlobalValue("Materials", mtlTable))
{
return false;
}
//////////////////////////////////////////////////////////////////////////
if (!pScriptSystem->ExecuteFile( m_script,true ))
{
GetISystem()->Warning(
VALIDATOR_MODULE_3DENGINE,VALIDATOR_WARNING,
VALIDATOR_FLAG_FILE|VALIDATOR_FLAG_SCRIPT,
m_script.c_str(),
"'%s' failed to load surface type definition script",m_name.c_str() );
return false;
}
if (!mtlTable->GetValue( m_name,m_pScriptTable ))
return false;
XmlNodeRef matNode = m_root->newChild("SurfaceType");
matNode->setAttr( "name",m_name );
// Load physics params.
SmartScriptTable pPhysicsTable,props;
float fBouncyness = 0.0f;
float fFriction = 1.0f;
int iPiercingResistence = sf_max_pierceable; // physics traces range 0-15
int imatBreakable = -1, bManuallyBreakable=0;
m_iBreakability=0; m_nHitpoints=0; m_breakEnergy=0;
if (m_pScriptTable->GetValue("physics",pPhysicsTable))
{
pPhysicsTable->GetValue("friction",fFriction);
pPhysicsTable->GetValue("bouncyness",fBouncyness);
pPhysicsTable->GetValue("breakable_id",imatBreakable);
if (pPhysicsTable->GetValue("pierceability",iPiercingResistence))
{
if(iPiercingResistence>sf_max_pierceable)
iPiercingResistence = sf_max_pierceable;
}
int nBreakable2d = 0;
int bNoCollide = 0;
pPhysicsTable->GetValue("no_collide", bNoCollide);
if (pPhysicsTable->GetValue("break_energy",m_breakEnergy))
{
bManuallyBreakable = sf_manually_breakable;
m_iBreakability = 2;
pPhysicsTable->GetValue("hit_points",m_nHitpoints);
} else if (m_pScriptTable->GetValue("breakable_2d",props))
{
nBreakable2d = 1;
bManuallyBreakable = sf_manually_breakable;
m_iBreakability = 1;
props->GetValue("break_energy",m_breakEnergy);
props->GetValue("hit_points",m_nHitpoints);
}
m_nFlags &= ~SURFACE_TYPE_NO_COLLIDE;
if (bNoCollide)
m_nFlags |= SURFACE_TYPE_NO_COLLIDE;
XmlNodeRef physNode = matNode->newChild("Physics");
physNode->setAttr( "friction",fFriction );
physNode->setAttr( "elasticity",fBouncyness );
physNode->setAttr( "breakable_id",imatBreakable );
physNode->setAttr( "pierceability",iPiercingResistence );
physNode->setAttr( "no_collide",bNoCollide );
physNode->setAttr( "break_energy",m_breakEnergy );
physNode->setAttr( "hit_points",m_nHitpoints );
physNode->setAttr( "breakable_2d",nBreakable2d );
}
SmartScriptTable pAITable;
if (m_pScriptTable->GetValue("AI",pAITable))
{
XmlNodeRef aiNode = matNode->newChild("AI");
float fImpactRadius = 1;
float fFootStepRadius = 1;
float proneMult = 1;
float crouchMult = 1;
float movingMult = 1;
pAITable->GetValue( "fImpactRadius",fImpactRadius );
pAITable->GetValue( "fFootStepRadius",fFootStepRadius );
pAITable->GetValue( "proneMult",proneMult );
pAITable->GetValue( "crouchMult",crouchMult );
pAITable->GetValue( "movingMult",movingMult );
aiNode->setAttr( "fImpactRadius",fImpactRadius );
aiNode->setAttr( "fFootStepRadius",fFootStepRadius );
aiNode->setAttr( "proneMult",proneMult );
aiNode->setAttr( "crouchMult",crouchMult );
aiNode->setAttr( "movingMult",movingMult );
}
gEnv->pPhysicalWorld->SetSurfaceParameters(m_nId,fBouncyness,fFriction,
//.........这里部分代码省略.........
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:101,代码来源:SurfaceTypes.cpp