本文整理汇总了C++中Agent::GetContextId方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::GetContextId方法的具体用法?C++ Agent::GetContextId怎么用?C++ Agent::GetContextId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::GetContextId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFrames
int WaitFramesState::GetFrames(Agent* pAgent) const
{
if (this->m_frames_var)
{
BEHAVIAC_ASSERT(this->m_frames_var);
TProperty<int>* pP = (TProperty<int>*)this->m_frames_var;
uint64_t frames = pP->GetValue(pAgent);
return (frames == ((uint64_t)-1) ? -1 : (int)frames);
}
else if (this->m_frames_method)
{
//ParentType pt = this->m_frames_method->GetParentType();
Agent* pParent = pAgent;
/*if (pt == PT_INSTANCE)
{*/
pParent = Agent::GetInstance(this->m_frames_method->GetInstanceNameString(), pParent->GetContextId());
BEHAVIAC_ASSERT(pParent);
/*}*/
this->m_frames_method->run(pParent, pAgent);
int frames = this->m_frames_method->GetReturnValue<int>(pParent);
return frames;
}
return 0;
}
示例2: update
EBTStatus ActionTask::update(Agent* pAgent, EBTStatus childStatus)
{
BEHAVIAC_UNUSED_VAR(pAgent);
BEHAVIAC_UNUSED_VAR(childStatus);
BEHAVIAC_ASSERT(Action::DynamicCast(this->GetNode()));
Action* pActionNode = (Action*)(this->GetNode());
if (!this->CheckPredicates(pAgent))
{
return pActionNode->m_resultPreconditionFail;
}
EBTStatus result = BT_SUCCESS;
if (pActionNode->m_method)
{
//#if BEHAVIAC_ENABLE_PROFILING
// BEHAVIAC_PROFILE("Node");
//#endif
ParentType pt = pActionNode->m_method->GetParentType();
Agent* pParent = pAgent;
if (pt == PT_INSTANCE)
{
pParent = Agent::GetInstance(pActionNode->m_method->GetInstanceNameString(), pParent->GetContextId());
BEHAVIAC_ASSERT(pParent);
}
int nodeId = this->GetId();
int slot = SetNodeId(nodeId);
BEHAVIAC_ASSERT(slot != -1, "no empty slot found!");
pActionNode->m_method->run(pParent, pAgent);
if (pActionNode->m_resultOption != BT_INVALID)
{
result = pActionNode->m_resultOption;
}
else if (pActionNode->m_resultFunctor)
{
ParentType pt = pActionNode->m_resultFunctor->GetParentType();
Agent* pParentCheckResult = pAgent;
if (pt == PT_INSTANCE)
{
pParentCheckResult = Agent::GetInstance(pActionNode->m_resultFunctor->GetInstanceNameString(), pParentCheckResult->GetContextId());
BEHAVIAC_ASSERT(pParentCheckResult);
}
result = (EBTStatus)pActionNode->m_method->CheckReturn(pParent, pParentCheckResult, pActionNode->m_resultFunctor);
}
else
{
pActionNode->m_method->CheckReturn(pParent, result);
}
ClearNodeId(slot);
}
else
{
//#if BEHAVIAC_ENABLE_PROFILING
// BEHAVIAC_PROFILE("ActionGenerated");
//#endif
result = pActionNode->update_impl(pAgent, childStatus);
}
return result;
}