forked from Dzejrou/tdt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLimitedLifeSpanHelper.cpp
More file actions
35 lines (31 loc) · 920 Bytes
/
Copy pathLimitedLifeSpanHelper.cpp
File metadata and controls
35 lines (31 loc) · 920 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
#include "LimitedLifeSpanHelper.hpp"
#include "Components.hpp"
#include "EntitySystem.hpp"
void LimitedLifeSpanHelper::set_max_time(EntitySystem& ents, std::size_t id, Ogre::Real val)
{
auto comp = ents.get_component<LimitedLifeSpanComponent>(id);
if(comp)
comp->max_time = val;
}
Ogre::Real LimitedLifeSpanHelper::get_max_time(EntitySystem& ents, std::size_t id)
{
auto comp = ents.get_component<LimitedLifeSpanComponent>(id);
if(comp)
return comp->max_time;
else
return Ogre::Real{};
}
Ogre::Real LimitedLifeSpanHelper::get_curr_time(EntitySystem& ents, std::size_t id)
{
auto comp = ents.get_component<LimitedLifeSpanComponent>(id);
if(comp)
return comp->curr_time;
else
return Ogre::Real{};
}
void LimitedLifeSpanHelper::advance_curr_time(EntitySystem& ents, std::size_t id, Ogre::Real val)
{
auto comp = ents.get_component<LimitedLifeSpanComponent>(id);
if(comp)
comp->curr_time += val;
}