summaryrefslogtreecommitdiff
path: root/game/server/tf/bot/map_entities/tf_spawner.h
blob: f57db8985492a7013f00a744f407771c9e1a3f20 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//========= Copyright Valve Corporation, All rights reserved. ============//
// tf_spawner.h
// Entity to spawn one or more templatized entities
// Michael Booth, April 2011

#ifndef TF_SPAWNER_H
#define TF_SPAWNER_H

//--------------------------------------------------------
/**
 * Each particular type of entity the tf_spawner can create
 * has an associated template (derived from this class)
 * which defines its spawning location and initial properties.
 */
class CTFSpawnTemplate : public CPointEntity
{
public:
	DECLARE_CLASS( CTFSpawnTemplate, CPointEntity );

	virtual ~CTFSpawnTemplate() { }

	virtual CBaseEntity *Instantiate( void ) const = 0;			// spawn an instance of this template
};


//--------------------------------------------------------
class CTFSpawner : public CPointEntity
{
public:
	DECLARE_CLASS( CTFSpawner, CPointEntity );
	DECLARE_DATADESC();

	CTFSpawner( void );
	virtual ~CTFSpawner() { }

	void SpawnerThink( void );

	// Input.
	void InputReset( inputdata_t &inputdata );
	void InputEnable( inputdata_t &inputdata );
	void InputDisable( inputdata_t &inputdata );

	// Output
	void OnKilled( CBaseEntity *dead );

private:
	void Reset( void );

	bool m_bExpended;
	int m_spawnCount;
	int m_spawnCountRemaining;
	int m_maxActiveCount;
	float m_spawnInterval;

	string_t m_templateName;
	CHandle< CTFSpawnTemplate > m_template;

	COutputEvent m_onSpawned;
	COutputEvent m_onExpended;
	COutputEvent m_onKilled;

	CUtlVector< CHandle< CBaseEntity > > m_spawnedVector;
};


#endif // TF_SPAWNER_H