forked from Dzejrou/tdt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAIHelper.cpp
More file actions
38 lines (32 loc) · 864 Bytes
/
AIHelper.cpp
File metadata and controls
38 lines (32 loc) · 864 Bytes
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
#include "AIHelper.hpp"
#include "Components.hpp"
#include "EntitySystem.hpp"
void AIHelper::set_blueprint(EntitySystem& ents, std::size_t id, const std::string& val)
{
auto comp = ents.get_component<AIComponent>(id);
if(comp)
comp->blueprint = val;
}
const std::string & AIHelper::get_blueprint(EntitySystem& ents, std::size_t id)
{
static const std::string NO_BLUEPRINT{"ERROR"};
auto comp = ents.get_component<AIComponent>(id);
if(comp)
return comp->blueprint;
else
return NO_BLUEPRINT;
}
void AIHelper::set_state(EntitySystem& ents, std::size_t id, ENTITY_STATE val)
{
auto comp = ents.get_component<AIComponent>(id);
if(comp)
comp->state = val;
}
ENTITY_STATE AIHelper::get_state(EntitySystem& ents, std::size_t id)
{
auto comp = ents.get_component<AIComponent>(id);
if(comp)
return comp->state;
else
return ENTITY_STATE::NONE;
}