blob: 23e9e3602afeef3d446da0949432fc7e114daff9 (
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
// ghost.h
// A spooky halloween ghost bot
// Michael Booth, October 2011
#ifndef GHOST_H
#define GHOST_H
#include "NextBot.h"
#include "NextBotBehavior.h"
#include "NextBotGroundLocomotion.h"
#include "Path/NextBotPathFollow.h"
#define GHOST_SPEED 90
#define GHOST_SCARE_RADIUS 192
class CTFPlayer;
//----------------------------------------------------------------------------
class CGhostLocomotion : public NextBotGroundLocomotion
{
public:
DECLARE_CLASS( CGhostLocomotion, NextBotGroundLocomotion );
CGhostLocomotion( INextBot *bot ) : NextBotGroundLocomotion( bot ) { }
virtual ~CGhostLocomotion() { }
virtual float GetRunSpeed( void ) const; // get maximum running speed
virtual float GetMaxAcceleration( void ) const; // return maximum acceleration of locomotor
virtual float GetMaxDeceleration( void ) const; // return maximum deceleration of locomotor
};
//----------------------------------------------------------------------------
class CGhost : public NextBotCombatCharacter
{
public:
DECLARE_CLASS( CGhost, NextBotCombatCharacter );
CGhost();
virtual ~CGhost();
static void PrecacheGhost();
virtual void Precache();
virtual void Spawn( void );
void SetLifetime( float duration );
float GetLifetime( void ) const;
// INextBot
DECLARE_INTENTION_INTERFACE( CGhost );
virtual CGhostLocomotion *GetLocomotionInterface( void ) const { return m_locomotor; }
virtual Vector EyePosition( void );
virtual bool ShouldCollide( int collisionGroup, int contentsMask ) const;
private:
CGhostLocomotion *m_locomotor;
Vector m_eyeOffset;
Vector m_homePos;
float m_lifetime;
};
inline void CGhost::SetLifetime( float duration )
{
m_lifetime = duration;
}
inline float CGhost::GetLifetime( void ) const
{
return m_lifetime;
}
inline Vector CGhost::EyePosition( void )
{
return GetAbsOrigin() + m_eyeOffset;
}
extern CGhost *SpawnGhost( const Vector &spot, const QAngle &angles, float lifetime = 10.0f );
#endif // GHOST_H
|