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.

90 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef NPC_ASSASSIN_H
  8. #define NPC_ASSASSIN_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "ai_basenpc.h"
  13. #include "Sprite.h"
  14. #include "SpriteTrail.h"
  15. #include "soundent.h"
  16. //Eye states
  17. enum eyeState_t
  18. {
  19. ASSASSIN_EYE_SEE_TARGET = 0, //Sees the target, bright and big
  20. ASSASSIN_EYE_SEEKING_TARGET, //Looking for a target, blinking (bright)
  21. ASSASSIN_EYE_ACTIVE, //Actively looking
  22. ASSASSIN_EYE_DORMANT, //Not active
  23. ASSASSIN_EYE_DEAD, //Completely invisible
  24. };
  25. //=========================================================
  26. //=========================================================
  27. class CNPC_Assassin : public CAI_BaseNPC
  28. {
  29. public:
  30. DECLARE_CLASS( CNPC_Assassin, CAI_BaseNPC );
  31. // DECLARE_SERVERCLASS();
  32. DECLARE_DATADESC();
  33. CNPC_Assassin( void );
  34. Class_T Classify( void ) { return CLASS_COMBINE; }
  35. int GetSoundInterests ( void ) { return (SOUND_WORLD|SOUND_COMBAT|SOUND_PLAYER); }
  36. int SelectSchedule ( void );
  37. int MeleeAttack1Conditions ( float flDot, float flDist );
  38. int RangeAttack1Conditions ( float flDot, float flDist );
  39. int RangeAttack2Conditions ( float flDot, float flDist );
  40. void Precache( void );
  41. void Spawn( void );
  42. void PrescheduleThink( void );
  43. void HandleAnimEvent( animevent_t *pEvent );
  44. void StartTask( const Task_t *pTask );
  45. void RunTask( const Task_t *pTask );
  46. void OnScheduleChange( void );
  47. void GatherEnemyConditions( CBaseEntity *pEnemy );
  48. void BuildScheduleTestBits( void );
  49. void Event_Killed( const CTakeDamageInfo &info );
  50. bool FValidateHintType ( CAI_Hint *pHint );
  51. bool IsJumpLegal(const Vector &startPos, const Vector &apex, const Vector &endPos) const;
  52. bool MovementCost( int moveType, const Vector &vecStart, const Vector &vecEnd, float *pCost );
  53. float MaxYawSpeed( void );
  54. const Vector &GetViewOffset( void );
  55. private:
  56. void SetEyeState( eyeState_t state );
  57. void FirePistol( int hand );
  58. bool CanFlip( int flipType, Activity &activity, const Vector *avoidPosition );
  59. int m_nNumFlips;
  60. int m_nLastFlipType;
  61. float m_flNextFlipTime; //Next earliest time the assassin can flip again
  62. float m_flNextLungeTime;
  63. float m_flNextShotTime;
  64. bool m_bEvade;
  65. bool m_bAggressive; // Sets certain state, including whether or not her eye is visible
  66. bool m_bBlinkState;
  67. CSprite *m_pEyeSprite;
  68. CSpriteTrail *m_pEyeTrail;
  69. DEFINE_CUSTOM_AI;
  70. };
  71. #endif // NPC_ASSASSIN_H