Damage and Spashdamage working, phantomShapes not really working

This commit is contained in:
ViktorLjung
2014-05-27 07:04:29 +02:00
parent a0ee235473
commit c37df5c178
27 changed files with 804 additions and 202 deletions
+38
View File
@@ -0,0 +1,38 @@
#include "PrecompiledHeader.h"
#include "TimerSystem.h"
#include "World.h"
void Systems::TimerSystem::RegisterComponents( ComponentFactory* cf )
{
cf->Register<Components::Timer>([]() { return new Components::Timer(); });
cf->Register<Components::FrameTimer>([]() { return new Components::FrameTimer(); });
}
void Systems::TimerSystem::UpdateEntity( double dt, EntityID entity, EntityID parent )
{
auto timer = m_World->GetComponent<Components::Timer>(entity);
if(timer)
{
timer->Time -= dt;
if(timer->Time <= 0)
{
m_World->RemoveEntity(entity);
}
}
auto frameTimer = m_World->GetComponent<Components::FrameTimer>(entity);
if(frameTimer)
{
frameTimer->Frames -= 1;
if(frameTimer->Frames <= 0)
{
m_World->RemoveEntity(entity);
}
}
}