本文整理汇总了C++中IScriptTable类的典型用法代码示例。如果您正苦于以下问题:C++ IScriptTable类的具体用法?C++ IScriptTable怎么用?C++ IScriptTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IScriptTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: p
bool CScriptRMI::SerializeScript( TSerialize ser, IEntity * pEntity )
{
SSerializeFunctionParams p( ser, pEntity );
ScriptHandle hdl( &p );
IScriptTable * pTable = pEntity->GetScriptTable();
if (pTable)
{
SmartScriptTable serTable;
SmartScriptTable synchedTable;
pTable->GetValue( "synched", synchedTable );
if (synchedTable.GetPtr())
{
synchedTable->GetValue( HIDDEN_FIELD, serTable );
if (serTable.GetPtr())
{
IScriptSystem * pScriptSystem = pTable->GetScriptSystem();
pScriptSystem->BeginCall( serTable.GetPtr(), SERIALIZE_FUNCTION );
pScriptSystem->PushFuncParam( serTable );
pScriptSystem->PushFuncParam( hdl );
return pScriptSystem->EndCall();
}
}
}
return true;
}
示例2: OnSpawn
void CBaseManagerEntitySink::OnSpawn(IEntity *pEntity, SEntitySpawnParams ¶ms)
{
// Check if it has a CNC Table. If it does, manually add it to the controller
IScriptTable *pTable;
if (NULL != pEntity && NULL != (pTable = pEntity->GetScriptTable()))
{
// Get property table
SmartScriptTable props, cncbuilding;
if (true == pTable->GetValue("Properties", props) &&
true == props->GetValue("CNCBuilding", cncbuilding))
{
// Extract and build GUID
char const* szTeam = 0;
char const* szClass = 0;
cncbuilding->GetValue("Team", szTeam);
cncbuilding->GetValue("Class", szClass);
BuildingGUID GUID = m_pManager->GenerateGUID(szTeam, szClass);
if (GUID_INVALID != GUID)
{
// Get controller and manually add it
IBuildingController *pController = m_pManager->FindBuildingController(GUID);
if (NULL != pController)
pController->AddInterface(pEntity);
}
}
}
}
示例3: GetEntity
const char *CAnimatedCharacterSample::GetCharacterModelNameFromScriptTable() const
{
IEntity *pEntity = GetEntity();
IScriptTable *pScriptTable = pEntity->GetScriptTable();
if(pScriptTable == NULL)
{
return NULL;
}
SmartScriptTable propertiesTable;
const bool hasPropertiesTable = pScriptTable->GetValue("Properties", propertiesTable);
if(! hasPropertiesTable)
{
return NULL;
}
const char *modelName = NULL;
const bool hasModelName = propertiesTable->GetValue("objModel", modelName);
if(! hasModelName)
{
return NULL;
}
return modelName;
}
示例4: GetTeamRadioTable
static bool GetTeamRadioTable(CGameRules *gr, const string &team_name, SmartScriptTable &out_table)
{
if(!gr)
{
return false;
}
IScriptTable *pTable = gr->GetEntity()->GetScriptTable();
if(!pTable)
{
return false;
}
SmartScriptTable pTeamRadio;
if(!pTable->GetValue("teamRadio", pTeamRadio))
{
return false;
}
if(!pTeamRadio->GetValue(team_name, out_table))
{
return false;
}
return true;
}
示例5: DetachFrom
//------------------------------------------------------------------------
void CScriptBind_Inventory::DetachFrom(CInventory* pInventory)
{
IScriptTable *pScriptTable = pInventory->GetEntity()->GetScriptTable();
if (pScriptTable)
pScriptTable->SetToNull("inventory");
}
示例6: createScriptTable
IScriptTable* ScriptSystem::createScriptTable()
{
IScriptTable* table = new IScriptTable;
table->mKeyTable = &mKeyTable;
table->addRef();
return table;
}
示例7: CRY_ASSERT
void CProceduralContextAim::InitialisePoseBlenderAim()
{
CRY_ASSERT( m_entity );
const int slot = 0;
ICharacterInstance* pCharacterInstance = m_entity->GetCharacter( slot );
if ( pCharacterInstance == NULL )
{
return;
}
ISkeletonPose* pSkeletonPose = pCharacterInstance->GetISkeletonPose();
if ( pSkeletonPose == NULL )
{
return;
}
m_pPoseBlenderAim = pSkeletonPose->GetIPoseBlenderAim();
if ( m_pPoseBlenderAim )
{
m_defaultPolarCoordinatesSmoothTimeSeconds = 0.1f;
float polarCoordinatesMaxYawDegreesPerSecond = 360.f;
float polarCoordinatesMaxPitchDegreesPerSecond = 360.f;
float fadeInSeconds = 0.25f;
float fadeOutSeconds = 0.25f;
float fadeOutMinDistance = 0.f;
IScriptTable* pScriptTable = m_entity->GetScriptTable();
if ( pScriptTable )
{
SmartScriptTable pProceduralContextAimTable;
pScriptTable->GetValue( "ProceduralContextAim", pProceduralContextAimTable );
if ( pProceduralContextAimTable )
{
pProceduralContextAimTable->GetValue( "polarCoordinatesSmoothTimeSeconds", m_defaultPolarCoordinatesSmoothTimeSeconds );
pProceduralContextAimTable->GetValue( "polarCoordinatesMaxYawDegreesPerSecond", polarCoordinatesMaxYawDegreesPerSecond );
pProceduralContextAimTable->GetValue( "polarCoordinatesMaxPitchDegreesPerSecond", polarCoordinatesMaxPitchDegreesPerSecond );
pProceduralContextAimTable->GetValue( "fadeInSeconds", fadeInSeconds );
pProceduralContextAimTable->GetValue( "fadeOutSeconds", fadeOutSeconds );
pProceduralContextAimTable->GetValue( "fadeOutMinDistance", fadeOutMinDistance );
}
}
m_defaultPolarCoordinatesMaxSmoothRateRadiansPerSecond = Vec2( DEG2RAD( polarCoordinatesMaxYawDegreesPerSecond ), DEG2RAD( polarCoordinatesMaxPitchDegreesPerSecond ) );
m_pPoseBlenderAim->SetPolarCoordinatesSmoothTimeSeconds( m_defaultPolarCoordinatesSmoothTimeSeconds );
m_pPoseBlenderAim->SetPolarCoordinatesMaxRadiansPerSecond( m_defaultPolarCoordinatesMaxSmoothRateRadiansPerSecond );
m_pPoseBlenderAim->SetFadeInSpeed( fadeInSeconds );
m_pPoseBlenderAim->SetFadeOutSpeed( fadeOutSeconds );
m_pPoseBlenderAim->SetFadeOutMinDistance( fadeOutMinDistance );
m_pPoseBlenderAim->SetState( false );
}
}
示例8: GetEntity
bool CTornado::Reset()
{
//Initialize default values before (in case ScriptTable fails)
m_wanderSpeed = 10.0f;
m_cloudHeight = 376.0f;
m_radius = 300.0f;
m_spinImpulse = 9.0f;
m_attractionImpulse = 13.0f;
m_upImpulse = 18.0f;
const char* funnelEffect = 0;
SmartScriptTable props;
IScriptTable* pScriptTable = GetEntity()->GetScriptTable();
if(!pScriptTable || !pScriptTable->GetValue("Properties", props))
return false;
props->GetValue("fWanderSpeed", m_wanderSpeed);
props->GetValue("fCloudHeight", m_cloudHeight);
props->GetValue("Radius", m_radius);
props->GetValue("fSpinImpulse", m_spinImpulse);
props->GetValue("fAttractionImpulse", m_attractionImpulse);
props->GetValue("fUpImpulse", m_upImpulse);
props->GetValue("FunnelEffect", funnelEffect);
if (!UseFunnelEffect(funnelEffect))
return false;
Matrix34 m = GetEntity()->GetWorldTM();
m_wanderDir = m.GetColumn(1)*0.414214f;
m_isOnWater = false;
m_isInAir = false;
m_nextEntitiesCheck = 0;
Vec3 pos = GetEntity()->GetWorldPos();
gEnv->pLog->Log("TORNADO INIT POS: %f %f %f", pos.x, pos.y, pos.z);
m_points[0] = pos;
m_points[1] = pos + Vec3(0,0,m_cloudHeight/8.0f);
m_points[2] = pos + Vec3(0,0,m_cloudHeight/2.0f);
m_points[3] = pos + Vec3(0,0,m_cloudHeight);
for (int i=0; i<4; ++i)
m_oldPoints[i] = m_points[i];
m_currentPos = GetEntity()->GetWorldPos();
CHANGED_NETWORK_STATE(this, POSITION_ASPECT);
UpdateTornadoSpline();
return true;
}
示例9: AttachTo
//------------------------------------------------------------------------
void CScriptBind_MatchMaking::AttachTo( CMatchMakingHandler* pMatchMaking, CGameLobbyManager *pLobbyManager )
{
m_pLobbyManager = pLobbyManager;
IScriptTable *pScriptTable = pMatchMaking->GetScriptTable();
if (pScriptTable)
{
SmartScriptTable thisTable(m_pSS);
thisTable->Delegate(GetMethodsTable());
pScriptTable->SetValue("bindings", thisTable);
}
}
示例10: return
bool CSmartMine::ShouldStartTrackingEntity( const EntityId entityId ) const
{
// Always track player...
if (entityId == g_pGame->GetIGameFramework()->GetClientActorId())
{
return true;
}
// ... or any AI
const SAutoaimTarget* pTargetInfo = g_pGame->GetAutoAimManager().GetTargetInfo( entityId );
if(pTargetInfo != NULL)
{
return (pTargetInfo->pActorWeak.lock() != NULL);
}
// Also track kickable and pickable objects
IEntity* pEntity = gEnv->pEntitySystem->GetEntity( entityId );
IScriptTable* pScriptTable = (pEntity != NULL) ? pEntity->GetScriptTable() : NULL;
if(pScriptTable != NULL)
{
SmartScriptTable propertiesTable;
if(pScriptTable->GetValue("Properties", propertiesTable))
{
int pickable = 0, kickable = 0;
propertiesTable->GetValue("bPickable", pickable);
propertiesTable->GetValue("bInteractLargeObject", kickable);
if(pickable)
{
// Filter out items/weapons
pickable = (g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(entityId) == NULL);
}
if (pickable || kickable)
{
//Check if object is moving
IPhysicalEntity* pEntityPhysics = pEntity->GetPhysics();
if(pEntityPhysics != NULL)
{
pe_status_dynamics entityDynamics;
if(pEntityPhysics->GetStatus(&entityDynamics))
{
return (entityDynamics.v.len2() > 0.1f);
}
}
}
}
}
return false;
}
示例11: ProcessEvent
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
switch (event)
{
case eFE_Activate:
{
IActor* pActor = GetAIActor(pActInfo);
if (!pActor)
break;
IEntity* pEnt = pActor->GetEntity();
if (!pEnt)
break;
HSCRIPTFUNCTION func = 0;
int ret = 0;
IScriptTable* pTable = pEnt->GetScriptTable();
if (!pTable)
break;
if (IsPortActive(pActInfo, 1) && pTable->GetValue("GrabObject", func))
{
IEntity* pObj = gEnv->pEntitySystem->GetEntity( GetPortEntityId(pActInfo, 0) );
if (pObj)
{
IScriptTable* pObjTable = pObj->GetScriptTable();
Script::CallReturn(gEnv->pScriptSystem, func, pTable, pObjTable, ret);
}
ActivateOutput(pActInfo, 0, ret);
}
else if (IsPortActive(pActInfo, 2) && pTable->GetValue("DropObject", func))
{
bool bThrow = GetPortBool(pActInfo, 3);
Script::CallReturn(gEnv->pScriptSystem, func, pTable, bThrow, ret);
ActivateOutput(pActInfo, 0, ret);
}
if (pTable->GetValue("GetGrabbedObject", func))
{
ScriptHandle sH(0);
Script::CallReturn(gEnv->pScriptSystem, func, pTable, sH);
ActivateOutput(pActInfo, 1, EntityId(sH.n));
}
if(func)
gEnv->pScriptSystem->ReleaseFunc(func);
break;
}
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:51,代码来源:FlowGameNodes.cpp
示例12: OnSysSpecLightChange
// for editor only
static void OnSysSpecLightChange( ICVar *pVar )
{
IEntityItPtr it = GetIEntitySystem()->GetEntityIterator();
it->MoveFirst();
while(IEntity *pEntity = it->Next())
{
IScriptTable *pScriptTable = pEntity->GetScriptTable();
if (pScriptTable && pScriptTable->HaveValue("OnSysSpecLightChanged"))
{
Script::CallMethod( pScriptTable, "OnSysSpecLightChanged" );
}
}
}
示例13: GetEntity
void CVicinityDependentObjectMover::SetupEntity()
{
const char* szModelName = VICINITYDEPENDENTOBJECTMOVER_MODEL_NORMAL;
float fMoveToDistance = 10.0f;
float fAreaTriggerRange = 10.0f;
float fBackAreaTriggerRange = 10.0f;
float fForceMoveCompleteDistance = 1.0f;
IEntity* pEntity = GetEntity();
CRY_ASSERT( pEntity != NULL );
IScriptTable* pScriptTable = pEntity->GetScriptTable();
if ( pScriptTable != NULL )
{
SmartScriptTable propertiesTable;
if ( pScriptTable->GetValue( "Properties", propertiesTable) )
{
propertiesTable->GetValue( "objModel", szModelName );
propertiesTable->GetValue( "fMoveToDistance", fMoveToDistance );
propertiesTable->GetValue( "fMoveToSpeed", m_fMoveToSpeed );
propertiesTable->GetValue( "fMoveBackSpeed", m_fMoveBackSpeed );
propertiesTable->GetValue( "fAreaTriggerRange", fAreaTriggerRange );
propertiesTable->GetValue( "fBackAreaTriggerRange", fBackAreaTriggerRange );
propertiesTable->GetValue( "fForceMoveCompleteDistance", fForceMoveCompleteDistance );
propertiesTable->GetValue( "bUseAreaTrigger", m_bUseAreaTrigger );
propertiesTable->GetValue( "bDisableAreaTriggerOnMoveComplete", m_bDisableAreaTriggerOnMoveComplete );
}
}
m_fMoveToDistance = fMoveToDistance;
m_fMoveToDistanceSq = fMoveToDistance*fMoveToDistance;
m_fAreaTriggerRange = fAreaTriggerRange;
m_fAreaTriggerRangeSq = fAreaTriggerRange*fAreaTriggerRange;
m_fBackAreaTriggerRange = fBackAreaTriggerRange;
m_fBackAreaTriggerRangeSq = fBackAreaTriggerRange*fBackAreaTriggerRange;
m_fForceMoveCompleteDistanceSq = fForceMoveCompleteDistance*fForceMoveCompleteDistance;
// Load model
pEntity->LoadGeometry( VICINITYDEPENDENTOBJECTMOVER_MODEL_NORMAL_SLOT, szModelName );
// Draw slot and physicalize it
DrawSlot( VICINITYDEPENDENTOBJECTMOVER_MODEL_NORMAL_SLOT, true );
SEntityPhysicalizeParams physicalizeParams;
physicalizeParams.nSlot = VICINITYDEPENDENTOBJECTMOVER_MODEL_NORMAL_SLOT;
physicalizeParams.type = PE_RIGID;
physicalizeParams.mass = 0;
GetEntity()->Physicalize( physicalizeParams );
}
示例14: AttachTo
//------------------------------------------------------------------------
void CScriptBind_Item::AttachTo(CItem *pItem)
{
IScriptTable *pScriptTable = pItem->GetEntity()->GetScriptTable();
if (pScriptTable)
{
SmartScriptTable thisTable(m_pSS);
thisTable->SetValue("__this", ScriptHandle(pItem->GetEntityId()));
thisTable->Delegate(GetMethodsTable());
pScriptTable->SetValue("item", thisTable);
}
}
示例15: AttachTo
//------------------------------------------------------------------------
void CScriptBind_Actor::AttachTo(CActor *pActor)
{
IScriptTable *pScriptTable = pActor->GetEntity()->GetScriptTable();
if (pScriptTable)
{
SmartScriptTable thisTable(m_pSS);
thisTable->SetValue("__this", ScriptHandle(pActor->GetEntityId()));
thisTable->Delegate(GetMethodsTable());
pScriptTable->SetValue("actor", thisTable);
}
}