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.

42 lines
1.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef BASETHINKER_H
  5. #define BASETHINKER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "ithinker.h"
  11. //----------------------------------------------------------------------------------------
  12. //
  13. // Adds/removes itself from think manager and implements a default ShouldThink().
  14. //
  15. class CBaseThinker : public IThinker
  16. {
  17. public:
  18. CBaseThinker();
  19. virtual ~CBaseThinker();
  20. protected:
  21. virtual void Think();
  22. virtual bool ShouldThink() const;
  23. virtual void PostThink();
  24. // Derived classes must implement this.
  25. // Return 0 to think every frame.
  26. // Return -1 to never think.
  27. virtual float GetNextThinkTime() const = 0;
  28. private:
  29. float m_flNextThinkTime;
  30. };
  31. //----------------------------------------------------------------------------------------
  32. #endif // BASETHINKER_H