Counter Strike : Global Offensive Source Code
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.

98 lines
2.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Deal intelligently with an enemy that we're afraid of
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #ifndef AI_BEHAVIOR_FEAR_H
  14. #define AI_BEHAVIOR_FEAR_H
  15. #ifdef _WIN32
  16. #pragma once
  17. #endif
  18. #include "ai_behavior.h"
  19. class CAI_FearBehavior : public CAI_SimpleBehavior
  20. {
  21. DECLARE_CLASS( CAI_FearBehavior, CAI_SimpleBehavior );
  22. public:
  23. CAI_FearBehavior();
  24. void Precache( void );
  25. virtual const char *GetName() { return "Fear"; }
  26. virtual bool CanSelectSchedule();
  27. void GatherConditions();
  28. virtual void BeginScheduleSelection();
  29. virtual void EndScheduleSelection();
  30. void StartTask( const Task_t *pTask );
  31. void RunTask( const Task_t *pTask );
  32. //void BuildScheduleTestBits();
  33. //int TranslateSchedule( int scheduleType );
  34. //void OnStartSchedule( int scheduleType );
  35. //void InitializeBehavior();
  36. bool EnemyDislikesMe();
  37. void MarkAsUnsafe();
  38. bool IsInASafePlace();
  39. void SpoilSafePlace();
  40. void ReleaseAllHints();
  41. CAI_Hint *FindFearWithdrawalDest();
  42. void BuildScheduleTestBits();
  43. int TranslateSchedule( int scheduleType );
  44. enum
  45. {
  46. SCHED_FEAR_MOVE_TO_SAFE_PLACE = BaseClass::NEXT_SCHEDULE,
  47. SCHED_FEAR_MOVE_TO_SAFE_PLACE_RETRY,
  48. SCHED_FEAR_STAY_IN_SAFE_PLACE,
  49. NEXT_SCHEDULE,
  50. TASK_FEAR_GET_PATH_TO_SAFETY_HINT = BaseClass::NEXT_TASK,
  51. TASK_FEAR_WAIT_FOR_SAFETY,
  52. TASK_FEAR_IN_SAFE_PLACE,
  53. NEXT_TASK,
  54. COND_FEAR_ENEMY_CLOSE = BaseClass::NEXT_CONDITION, // within 30 feet
  55. COND_FEAR_ENEMY_TOO_CLOSE, // within 5 feet
  56. COND_FEAR_SEPARATED_FROM_PLAYER,
  57. NEXT_CONDITION,
  58. };
  59. DEFINE_CUSTOM_SCHEDULE_PROVIDER;
  60. public:
  61. private:
  62. virtual int SelectSchedule();
  63. float m_flTimeToSafety;
  64. float m_flTimePlayerLastVisible;
  65. float m_flDeferUntil;
  66. CAI_MoveMonitor m_SafePlaceMoveMonitor;
  67. CHandle<CAI_Hint> m_hSafePlaceHint;
  68. CHandle<CAI_Hint> m_hMovingToHint;
  69. DECLARE_DATADESC();
  70. };
  71. #endif // AI_BEHAVIOR_FEAR_H