summaryrefslogtreecommitdiff
path: root/game/shared/portal/env_lightrail_endpoint_shared.h
blob: 8b65883af1986585fc522afa6698729932012aaf (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
67
68
69
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

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

#define	SF_ENDPOINT_START_SMALLFX		(1<<0)		//Define spawnflags
//#define	SF_ENDPOINT_START_LARGEFX		(1<<1)

enum		//Enumeration of the 4 states the endpoints can be in.
{
	ENDPOINT_STATE_OFF,			//No FX displayed
	ENDPOINT_STATE_SMALLFX,		//Just the small particle trail is displayed and a faint glow		
	ENDPOINT_STATE_CHARGING,	//Ramp up over a certain amount of time to the large bright glow
	ENDPOINT_STATE_LARGEFX,		//Shows a particle trail and a large bright glow
	ENDPOINT_STATE_COUNT,
};

#ifndef CLIENT_DLL

// ============================================================================
//
//  Energy core - charges up and then releases energy from its position
//
// ============================================================================

class CEnv_Lightrail_Endpoint : public CBaseEntity
{
	DECLARE_CLASS( CEnv_Lightrail_Endpoint, CBaseEntity );
	DECLARE_SERVERCLASS();
	DECLARE_DATADESC();

public:
	void	InputStartCharge( inputdata_t &inputdata );
	void	InputStartSmallFX(inputdata_t &inputdata );
	void	InputStartLargeFX( inputdata_t &inputdata );
	void	InputStop( inputdata_t &inputdata );
	void	SetSmallFXScale( float flSmallScale ) { m_flSmallScale = flSmallScale; }
	void	SetLargeFXScale( float flLargeScale ) { m_flLargeScale = flLargeScale; }

	void	StartCharge( float flWarmUpTime );		//Charging difference between the small and large fx
	void	StartSmallFX();							//Start discharging the scaled down version of the FX
	void	StartLargeFX();							//Start discharging the larger brighter version of the FX
	void	StopSmallFX( float flCoolDownTime );	//Stop discharging the small fx
	void	StopLargeFX( float flCoolDownTime );	//Stop discharging the small fx

	virtual int	ShouldTransmit( const CCheckTransmitInfo *pInfo );
	virtual int UpdateTransmitState( void );

	virtual void Precache();
	void	Spawn( void );

private:
	CNetworkVar( float, m_flSmallScale );		//Scale of the small fx
	CNetworkVar( float, m_flLargeScale );		//Scale of the large fx
	CNetworkVar( int, m_nState );			//Current state of the fx
	CNetworkVar( float, m_flDuration );		
	CNetworkVar( float, m_flStartTime );
};

#endif

#endif // ENV_LIGHTRAIL_ENDPOINT_SHARED_H