-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFSMState.h
112 lines (97 loc) · 2.27 KB
/
FSMState.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
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
/*
* AIState.h
* tractionedge
*
* Created by Steven Hamilton on 28/09/10.
* Copyright 2010 n/a. All rights reserved.
*
*/
#ifndef FSMSTATE_H__
#define FSMSTATE_H__
#include "defines.h"
#include "Position.h"
#include <vector>
class FSM;
class Creature;
class FSMState {
private:
public:
int type;
FSM *fsm;
FSMState(){};
FSMState(FSM *fsm){};
virtual ~FSMState(){};
virtual void enter() {}
virtual void enter(Creature* creature) {}
virtual void update() {}
virtual void update(Creature* creature) {}
virtual void exit() {}
virtual void exit(Creature* creature) {}
};
enum aiState_t {
AI_STATE_NONE,
AI_STATE_PATROL,
AI_STATE_ATTACK,
AI_STATE_ATTACK_MELEE,
AI_STATE_RUN,
AI_STATE_CHARGE
};
class Creature;
class AIStatePatrol : public FSMState {
private:
public:
AIStatePatrol();
virtual void enter(Creature* creature);
virtual void update(){};
virtual void update(Creature* creature);
virtual void exit(Creature* creature);
Position point;
std::vector<move_t> moves;
std::vector<move_t>::iterator movesIter;
};
class AIStateCharge : public FSMState {
private:
Creature * creature;
public:
AIStateCharge();
virtual void enter(Creature* creature);
virtual void update(){};
virtual void update(Creature* creature);
virtual void exit(Creature* creature);
Position point;
std::vector<move_t> moves;
std::vector<move_t>::iterator movesIter;
};
class AIStateAttack : public FSMState {
private:
Creature * creature;
public:
AIStateAttack();
virtual void enter(Creature* creature);
virtual void update(){};
virtual void update(Creature* creature);
virtual void exit(Creature* creature);
};
class AIStateAttackMelee : public FSMState {
private:
Creature * creature;
public:
AIStateAttackMelee();
virtual void enter(Creature* creature);
virtual void update(){};
virtual void update(Creature* creature);
virtual void exit(Creature* creature);
};
class AIStateRun : public FSMState {
private:
Creature * creature;
public:
AIStateRun();
virtual void enter(Creature* creature);
virtual void update(){};
virtual void update(Creature* creature);
virtual void exit(Creature* creature);
std::vector<move_t> moves;
std::vector<move_t>::iterator movesIter;
};
#endif