-
Notifications
You must be signed in to change notification settings - Fork 0
/
Action.h
53 lines (42 loc) · 1.38 KB
/
Action.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
#pragma once
#include "GameCompetitor.h"
#include <initializer_list>
class Action
{
public:
Action(const initializer_list< pair<Action*, float> >& initializer = {});
void initAfterActions( const initializer_list< pair<Action*, float> >& initializer )
{
for each(auto it in initializer)
{
afterActions.push_back(it.first);
afterProbablites.push_back(it.second);
}
}
// this event should tell what will hapened if the bot will use the action
virtual void update(float dt);
// this event tells whether or not action is ended up
// if yes then will be choosen next action from list
virtual bool done();
// when this action is chosen to execute
// there could be need of reset some propertites
virtual void reset();
virtual Action* getNextAction();
virtual void setOwner( Game::Competitor* s)
{
owner = s;
}
// competitor who the action will take control on
Game::Competitor *owner;
void addAfterAction(Action* action, float probablity)
{
afterActions.push_back(action);
afterProbablites.push_back(probablity);
}
// both after actions and probablites sets have equal size
// first one represents action that is possible to be next executed after this one
// secound tels how big is probablity to occur it
// probablity should be an positive value
vector<Action*> afterActions;
vector<float> afterProbablites;
};