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); } }
void CMole::AppendExploreTask() { CTask tExplore; tExplore.Initialise(CTask::TYPE_EXPLORE); m_Tasks.push(tExplore); }
void CMole::AppendStuckTask(float _fTime) { CTask tStuck; tStuck.Initialise(CTask::TYPE_STUCK); tStuck.SetStuckTimeLeft(_fTime); m_Tasks.push(tStuck); }
void CMole::AppendSnoozeTask(float _fTime) { CTask tSleep; tSleep.Initialise(CTask::TYPE_SNOOZE); tSleep.SetSnoozeTimeLeft(_fTime); m_Tasks.push(tSleep); }
void CMole::AppendPatrolTask(CAcorn* _pAcorn) { CTask tPatrol; tPatrol.Initialise(CTask::TYPE_PATROL); tPatrol.SetAcorn(_pAcorn); m_Tasks.push(tPatrol); m_bHasPatrolTask = true; }