forked from Dzejrou/tdt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomingHelper.cpp
More file actions
51 lines (45 loc) · 1.17 KB
/
Copy pathHomingHelper.cpp
File metadata and controls
51 lines (45 loc) · 1.17 KB
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
#include "HomingHelper.hpp"
#include "Components.hpp"
#include "EntitySystem.hpp"
void HomingHelper::set_source(EntitySystem& ents, std::size_t id, std::size_t source)
{
auto comp = ents.get_component<HomingComponent>(id);
if(comp)
comp->source = source;
}
std::size_t HomingHelper::get_source(EntitySystem& ents, std::size_t id)
{
auto comp = ents.get_component<HomingComponent>(id);
if(comp)
return comp->source;
else
return Component::NO_ENTITY;
}
void HomingHelper::set_target(EntitySystem& ents, std::size_t id, std::size_t target)
{
auto comp = ents.get_component<HomingComponent>(id);
if(comp)
comp->target = target;
}
std::size_t HomingHelper::get_target(EntitySystem& ents, std::size_t id)
{
auto comp = ents.get_component<HomingComponent>(id);
if(comp)
return comp->target;
else
return Component::NO_ENTITY;
}
void HomingHelper::set_dmg(EntitySystem& ents, std::size_t id, std::size_t dmg)
{
auto comp = ents.get_component<HomingComponent>(id);
if(comp)
comp->dmg = dmg;
}
std::size_t HomingHelper::get_dmg(EntitySystem& ents, std::size_t id)
{
auto comp = ents.get_component<HomingComponent>(id);
if(comp)
return comp->dmg;
else
return std::size_t{};
}