Пример #1
0
    bool ReferencedBehaviorTask::onenter(Agent* pAgent)
    {
        BEHAVIAC_UNUSED_VAR(pAgent);
		BEHAVIAC_ASSERT(ReferencedBehavior::DynamicCast(this->m_node) != 0);
		ReferencedBehavior* pNode = (ReferencedBehavior*)this->m_node;

		BEHAVIAC_ASSERT(pNode != 0);

		this->m_nextStateId = -1;

		pNode->SetTaskParams(pAgent);

		this->m_subTree = Workspace::GetInstance()->CreateBehaviorTreeTask(pNode->m_referencedBehaviorPath.c_str());

		{
			const char* pThisTree = pAgent->btgetcurrent()->GetName().c_str();
			const char* pReferencedTree = pNode->m_referencedBehaviorPath.c_str();

			behaviac::string msg = FormatString("%s[%d] %s", pThisTree, pNode->GetId(), pReferencedTree);

			LogManager::GetInstance()->Log(pAgent, msg.c_str(), EAR_none, ELM_jump);
		}

        return true;
    }