예제 #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;



}