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.

86 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. // ghost.h
  3. // A spooky halloween ghost bot
  4. // Michael Booth, October 2011
  5. #ifndef GHOST_H
  6. #define GHOST_H
  7. #include "NextBot.h"
  8. #include "NextBotBehavior.h"
  9. #include "NextBotGroundLocomotion.h"
  10. #include "Path/NextBotPathFollow.h"
  11. #define GHOST_SPEED 90
  12. #define GHOST_SCARE_RADIUS 192
  13. class CTFPlayer;
  14. //----------------------------------------------------------------------------
  15. class CGhostLocomotion : public NextBotGroundLocomotion
  16. {
  17. public:
  18. DECLARE_CLASS( CGhostLocomotion, NextBotGroundLocomotion );
  19. CGhostLocomotion( INextBot *bot ) : NextBotGroundLocomotion( bot ) { }
  20. virtual ~CGhostLocomotion() { }
  21. virtual float GetRunSpeed( void ) const; // get maximum running speed
  22. virtual float GetMaxAcceleration( void ) const; // return maximum acceleration of locomotor
  23. virtual float GetMaxDeceleration( void ) const; // return maximum deceleration of locomotor
  24. };
  25. //----------------------------------------------------------------------------
  26. class CGhost : public NextBotCombatCharacter
  27. {
  28. public:
  29. DECLARE_CLASS( CGhost, NextBotCombatCharacter );
  30. CGhost();
  31. virtual ~CGhost();
  32. static void PrecacheGhost();
  33. virtual void Precache();
  34. virtual void Spawn( void );
  35. void SetLifetime( float duration );
  36. float GetLifetime( void ) const;
  37. // INextBot
  38. DECLARE_INTENTION_INTERFACE( CGhost );
  39. virtual CGhostLocomotion *GetLocomotionInterface( void ) const { return m_locomotor; }
  40. virtual Vector EyePosition( void );
  41. virtual bool ShouldCollide( int collisionGroup, int contentsMask ) const;
  42. private:
  43. CGhostLocomotion *m_locomotor;
  44. Vector m_eyeOffset;
  45. Vector m_homePos;
  46. float m_lifetime;
  47. };
  48. inline void CGhost::SetLifetime( float duration )
  49. {
  50. m_lifetime = duration;
  51. }
  52. inline float CGhost::GetLifetime( void ) const
  53. {
  54. return m_lifetime;
  55. }
  56. inline Vector CGhost::EyePosition( void )
  57. {
  58. return GetAbsOrigin() + m_eyeOffset;
  59. }
  60. extern CGhost *SpawnGhost( const Vector &spot, const QAngle &angles, float lifetime = 10.0f );
  61. #endif // GHOST_H