forked from mangos/MaNGOS
/
PointMovementGenerator.h
79 lines (68 loc) · 2.75 KB
/
PointMovementGenerator.h
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
/*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOS_POINTMOVEMENTGENERATOR_H
#define MANGOS_POINTMOVEMENTGENERATOR_H
#include "MovementGenerator.h"
#include "FollowerReference.h"
#include "Creature.h"
template<class T>
class MANGOS_DLL_SPEC PointMovementGenerator
: public MovementGeneratorMedium< T, PointMovementGenerator<T> >
{
public:
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, bool _generatePath) :
id(_id), i_x(_x), i_y(_y), i_z(_z), m_generatePath(_generatePath) {}
void Initialize(T &);
void Finalize(T &);
void Interrupt(T &);
void Reset(T &unit);
bool Update(T &, const uint32 &diff);
void MovementInform(T &);
MovementGeneratorType GetMovementGeneratorType() const { return POINT_MOTION_TYPE; }
const char* Name() const { return "<Point>"; }
bool GetDestination(float& x, float& y, float& z) const { x=i_x; y=i_y; z=i_z; return true; }
private:
uint32 id;
float i_x,i_y,i_z;
bool m_generatePath;
};
class MANGOS_DLL_SPEC AssistanceMovementGenerator
: public PointMovementGenerator<Creature>
{
public:
AssistanceMovementGenerator(float _x, float _y, float _z) :
PointMovementGenerator<Creature>(0, _x, _y, _z, true) {}
MovementGeneratorType GetMovementGeneratorType() const { return ASSISTANCE_MOTION_TYPE; }
void Finalize(Unit &);
};
// Does almost nothing - just doesn't allows previous movegen interrupt current effect. Can be reused for charge effect
class EffectMovementGenerator : public MovementGenerator
{
public:
explicit EffectMovementGenerator(uint32 Id) : m_Id(Id) {}
void Initialize(Unit &) {}
void Finalize(Unit &unit);
void Interrupt(Unit &) {}
void Reset(Unit &) {}
bool Update(Unit &u, const uint32 &);
MovementGeneratorType GetMovementGeneratorType() const { return EFFECT_MOTION_TYPE; }
const char* Name() const { return "<Effect>"; }
private:
uint32 m_Id;
};
#endif