Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef AI_LOCALNAVIGATOR_H
  7. #define AI_LOCALNAVIGATOR_H
  8. #include "simtimer.h"
  9. #include "ai_component.h"
  10. #include "ai_movetypes.h"
  11. #include "ai_obstacle_type.h"
  12. #if defined( _WIN32 )
  13. #pragma once
  14. #endif
  15. class CAI_PlaneSolver;
  16. class CAI_MoveProbe;
  17. //-----------------------------------------------------------------------------
  18. // CAI_LocalNavigator
  19. //
  20. // Purpose: Handles all the immediate tasks of navigation, independent of
  21. // path. Implements steering.
  22. //-----------------------------------------------------------------------------
  23. class CAI_LocalNavigator : public CAI_Component,
  24. public CAI_ProxyMovementSink
  25. {
  26. public:
  27. CAI_LocalNavigator(CAI_BaseNPC *pOuter);
  28. virtual ~CAI_LocalNavigator();
  29. void Init( IAI_MovementSink *pMovementServices );
  30. //---------------------------------
  31. AIMoveResult_t MoveCalc( AILocalMoveGoal_t *pResult, bool bPreviouslyValidated = false );
  32. void ResetMoveCalculations();
  33. //---------------------------------
  34. void AddObstacle( const Vector &pos, float radius, AI_MoveSuggType_t type = AIMST_AVOID_OBJECT );
  35. bool HaveObstacles();
  36. protected:
  37. AIMoveResult_t MoveCalcRaw( AILocalMoveGoal_t *pResult, bool bOnlyCurThink );
  38. bool MoveCalcDirect( AILocalMoveGoal_t *pMoveGoal, bool bOnlyCurThink, float *pDistClear, AIMoveResult_t *pResult );
  39. bool MoveCalcSteer( AILocalMoveGoal_t *pMoveGoal, float distClear, AIMoveResult_t *pResult );
  40. bool MoveCalcStop( AILocalMoveGoal_t *pMoveGoal, float distClear, AIMoveResult_t *pResult );
  41. CAI_MoveProbe * GetMoveProbe() { return m_pMoveProbe; }
  42. const CAI_MoveProbe *GetMoveProbe() const { return m_pMoveProbe; }
  43. private:
  44. // --------------------------------
  45. bool m_fLastWasClear;
  46. AILocalMoveGoal_t m_LastMoveGoal;
  47. CSimpleSimTimer m_FullDirectTimer;
  48. CAI_PlaneSolver * m_pPlaneSolver;
  49. CAI_MoveProbe * m_pMoveProbe;
  50. DECLARE_SIMPLE_DATADESC();
  51. };
  52. #endif // AI_LOCALNAVIGATOR_H