Started on CollisionSystem and TriggerSystem. Moved collision code to Collision folder.

This commit is contained in:
William Moberg
2015-12-14 17:08:00 +01:00
parent 8d87841691
commit 59095c2ce5
13 changed files with 162 additions and 2 deletions
+22
View File
@@ -0,0 +1,22 @@
#include "Collision/TriggerSystem.h"
#include "Core/AABB.h"
void TriggerSystem::Update(World* world, ComponentWrapper& trigger, double dt)
{
auto players = world->GetComponents("Player");
if (players == nullptr) {
return;
}
//WTODO: Assumes box exists.
ComponentWrapper& cBox = world->GetComponent(trigger.EntityID, "AABB");
AABB aabb;
aabb.CreateFromCenter(cBox["BoxCenter"], cBox["BoxSize"]);
for (auto& c : *players) {
Events::TriggerEnter e;
e.Trigger = trigger.EntityID;
e.Entity = 41;
m_EventBroker->Publish(e);
}
}