summaryrefslogtreecommitdiff
path: root/game/client/tf/bot_npc/c_bot_npc_minion.cpp
blob: 4302b7a4d890c5dd9a62ce14da4aefb167b8f2c7 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//========= Copyright Valve Corporation, All rights reserved. ============//
// c_bot_npc_minion.cpp

#include "cbase.h"
#include "NextBot/C_NextBot.h"
#include "c_bot_npc_minion.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

#undef NextBot

//-----------------------------------------------------------------------------
IMPLEMENT_CLIENTCLASS_DT( C_BotNPCMinion, DT_BotNPCMinion, CBotNPCMinion )

	RecvPropEHandle( RECVINFO( m_stunTarget ) ),

END_RECV_TABLE()


//-----------------------------------------------------------------------------
C_BotNPCMinion::C_BotNPCMinion()
{
	m_stunEffect = NULL;
	m_stunBeamEffect = NULL;
	m_scanEffect = NULL;
}


//-----------------------------------------------------------------------------
C_BotNPCMinion::~C_BotNPCMinion()
{
	if ( m_stunEffect )
	{
		ParticleProp()->StopEmissionAndDestroyImmediately( m_stunEffect );
		m_stunEffect = NULL;
	}

	if ( m_stunBeamEffect )
	{
		ParticleProp()->StopEmissionAndDestroyImmediately( m_stunBeamEffect );
		m_stunBeamEffect = NULL;
	}

	if ( m_scanEffect )
	{
		ParticleProp()->StopEmissionAndDestroyImmediately( m_scanEffect );
		m_scanEffect = NULL;
	}
}


//-----------------------------------------------------------------------------
void C_BotNPCMinion::Spawn( void )
{
	BaseClass::Spawn();

	SetNextClientThink( CLIENT_THINK_ALWAYS );

	//m_scanEffect = ParticleProp()->Create( "minion_scan", PATTACH_ABSORIGIN_FOLLOW );
}


//-----------------------------------------------------------------------------
void C_BotNPCMinion::ClientThink( void )
{
	if ( m_stunTarget )
	{
		if ( !m_stunEffect )
		{
			m_stunEffect = ParticleProp()->Create( "cart_flashinglight", PATTACH_ABSORIGIN_FOLLOW );
		}

		if ( !m_stunBeamEffect )
		{
			m_stunBeamEffect = ParticleProp()->Create( "laser_sight_beam", PATTACH_ABSORIGIN_FOLLOW );
		}

		if ( m_stunBeamEffect )
		{
			m_stunBeamEffect->SetSortOrigin( m_stunBeamEffect->GetRenderOrigin() );
			m_stunBeamEffect->SetControlPoint( 2, Vector( 255, 0, 255 ) );
			m_stunBeamEffect->SetControlPoint( 1, m_stunTarget->WorldSpaceCenter() );
		}
	}
	else
	{
		// shut off the effect
		if ( m_stunEffect )
		{
			ParticleProp()->StopEmissionAndDestroyImmediately( m_stunEffect );
			m_stunEffect = NULL;
		}

		if ( m_stunBeamEffect )
		{
			ParticleProp()->StopEmissionAndDestroyImmediately( m_stunBeamEffect );
			m_stunBeamEffect = NULL;
		}
	}
}


//-----------------------------------------------------------------------------
// Return the origin for player observers tracking this target
Vector C_BotNPCMinion::GetObserverCamOrigin( void ) 
{ 
	return GetAbsOrigin();
}


//-----------------------------------------------------------------------------
void C_BotNPCMinion::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
{
}