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.

88 lines
2.0 KiB

  1. //========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Hooks and classes for the support of humanoid NPCs with
  4. // groovy facial animation capabilities, aka, "Actors"
  5. //
  6. //=============================================================================//
  7. #ifndef AI_INTEREST_TARGET_H
  8. #define AI_INTEREST_TARGET_H
  9. #if defined( _WIN32 )
  10. #pragma once
  11. #endif
  12. //-----------------------------------------------------------------------------
  13. // CAI_BaseActor
  14. //
  15. // Purpose: The base class for all facially expressive NPCS.
  16. //
  17. //-----------------------------------------------------------------------------
  18. class CAI_InterestTarget_t
  19. {
  20. public:
  21. enum CAI_InterestTarget_e
  22. {
  23. LOOKAT_ENTITY = 0,
  24. LOOKAT_POSITION,
  25. LOOKAT_BOTH
  26. };
  27. public:
  28. bool IsThis( CBaseEntity *pThis );
  29. const Vector &GetPosition( void );
  30. bool IsActive( void );
  31. float Interest( void );
  32. public:
  33. CAI_InterestTarget_e m_eType; // ????
  34. EHANDLE m_hTarget;
  35. Vector m_vecPosition;
  36. float m_flStartTime;
  37. float m_flEndTime;
  38. float m_flRamp;
  39. float m_flInterest;
  40. DECLARE_SIMPLE_DATADESC();
  41. };
  42. class CAI_InterestTarget : public CUtlVector<CAI_InterestTarget_t>
  43. {
  44. public:
  45. void Add( CBaseEntity *pTarget, float flImportance, float flDuration, float flRamp );
  46. void Add( const Vector &vecPosition, float flImportance, float flDuration, float flRamp );
  47. void Add( CBaseEntity *pTarget, const Vector &vecPosition, float flImportance, float flDuration, float flRamp );
  48. int Find( CBaseEntity *pTarget )
  49. {
  50. int i;
  51. for ( i = 0; i < Count(); i++)
  52. {
  53. if (pTarget == (*this)[i].m_hTarget)
  54. return i;
  55. }
  56. return InvalidIndex();
  57. }
  58. void Cleanup( void )
  59. {
  60. int i;
  61. for (i = Count() - 1; i >= 0; i--)
  62. {
  63. if (!Element(i).IsActive())
  64. {
  65. Remove( i );
  66. }
  67. }
  68. };
  69. private:
  70. void Add( CAI_InterestTarget_t::CAI_InterestTarget_e type, CBaseEntity *pTarget, const Vector &vecPosition, float flImportance, float flDuration, float flRamp );
  71. };
  72. //-----------------------------------------------------------------------------
  73. #endif // AI_INTEREST_TARGET_H