/// <summary> /// Disables investigation mode and restores previously used patrol points /// </summary> public void StopInvestigating() { m_lPatrolPointList.Clear(); m_lPatrolPointList = new List <PatrolPoints>(m_lOriginalPatrolPoints); m_bInvestigationMode = false; m_fInvestigationTimer = m_fInvestigationTime; CS_GuardPatrolAction cGuardPatrol = GetComponent <CS_GuardPatrolAction>(); if (cGuardPatrol != null) { cGuardPatrol.InvestigationMode(false); } }
/// <summary> /// Tells the guard to investigate an area /// It will save the old patrol points and generate a smaller patrol path around the investigation point /// Use StopInvestigating() to halt /// </summary> /// <param name="a_tPositionToInvestigate">The exact point you want the guard to investigate</param> /// <param name="a_iAmountOfPoints">The amount of patrol points you want the guard to look around</param> /// <param name="a_fRangeToInvestigate">The range at which he should investigate around the center</param> public void InvestigateArea(Transform a_tPositionToInvestigate, int a_iAmountOfPoints, float a_fRangeToInvestigate) { if (!m_bInvestigationMode) { m_lOriginalPatrolPoints = new List <PatrolPoints>(m_lPatrolPointList); //Save the old patrol points } m_bInvestigationMode = true; //Set to investigation mode m_fInvestigationTimer = m_fInvestigationTime; //set the investigation timer m_v3PatrolCenter = a_tPositionToInvestigate.position; //Set the center m_lPatrolPointList.Clear(); //Clear the patrol list to start a new one GeneratePositions(a_iAmountOfPoints, a_fRangeToInvestigate); //Generate the positions for this new point ChooseRoute(); //Choose a "coherent" route around the points GetComponent <CS_Guard>().ResetPointsForInvestigating(); //Reset other variables CS_GuardPatrolAction cGuardPatrol = GetComponent <CS_GuardPatrolAction>(); //Get the patrol action if (cGuardPatrol != null) { cGuardPatrol.InvestigationMode(true);//Changes the cost of patrolling whilst investigating, to give it priority over other actions } }