示例#1
0
void
CMole::AppendHuntTask(const CFVec2& _kvrTargetPosition)
{
	// Remove all hunt tasks before this
	while (m_Tasks.top().GetType() == CTask::TYPE_HUNT)
	{
		m_Tasks.pop();
	}



	CTask tHunt;
	tHunt.Initialise(CTask::TYPE_HUNT);


	int iTargetNode = s_pSharedPath->GenerateNodeId(s_pSharedPath->GetNode(_kvrTargetPosition));


	std::vector<int> aNodeIdsPath;
	bool bPathFound = s_pSharedPath->FindPath(m_vPosition, iTargetNode, aNodeIdsPath);


	if (bPathFound)
	{
		tHunt.SetTargetNodeId(iTargetNode);
		tHunt.SetNodeIdsPath(aNodeIdsPath);
		m_Tasks.push(tHunt);
	}
	else
	{
		// Cannot reach target
		assert(false);
	}
}
示例#2
0
void
CMole::AppendExploreTask()
{
	CTask tExplore;
	tExplore.Initialise(CTask::TYPE_EXPLORE);


	m_Tasks.push(tExplore);
}
示例#3
0
void
CMole::AppendStuckTask(float _fTime)
{
	CTask tStuck;
	tStuck.Initialise(CTask::TYPE_STUCK);
	tStuck.SetStuckTimeLeft(_fTime);


	m_Tasks.push(tStuck);
}
示例#4
0
void
CMole::AppendSnoozeTask(float _fTime)
{
	CTask tSleep;
	tSleep.Initialise(CTask::TYPE_SNOOZE);
	tSleep.SetSnoozeTimeLeft(_fTime);


	m_Tasks.push(tSleep);
}
示例#5
0
void
CMole::AppendPatrolTask(CAcorn* _pAcorn)
{
	CTask tPatrol;
	tPatrol.Initialise(CTask::TYPE_PATROL);
	tPatrol.SetAcorn(_pAcorn);


	m_Tasks.push(tPatrol);


	m_bHasPatrolTask = true;



}