summaryrefslogtreecommitdiff
path: root/replay/basethinker.h
blob: e6a53b85f18478bee1cb7ab4d1f7f8ce5d42a27f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//

#ifndef BASETHINKER_H
#define BASETHINKER_H
#ifdef _WIN32
#pragma once
#endif

//----------------------------------------------------------------------------------------

#include "ithinker.h"

//----------------------------------------------------------------------------------------

//
// Adds/removes itself from think manager and implements a default ShouldThink().
//
class CBaseThinker : public IThinker
{
public:
					CBaseThinker();
	virtual			~CBaseThinker();

protected:
	virtual void	Think();
	virtual bool	ShouldThink() const;
	virtual void	PostThink();

	// Derived classes must implement this.
	// Return 0 to think every frame.
	// Return -1 to never think.
	virtual float	GetNextThinkTime() const = 0;

private:
	float			m_flNextThinkTime;
};

//----------------------------------------------------------------------------------------

#endif // BASETHINKER_H