This commit is contained in:
ViktorLjung
2014-05-20 03:41:10 +02:00
parent fe400e9af8
commit 7e5cf8efaa
13 changed files with 139 additions and 40 deletions
+28
View File
@@ -11,6 +11,8 @@ void Systems::TankSteeringSystem::RegisterComponents( ComponentFactory* cf )
void Systems::TankSteeringSystem::Initialize()
{
EVENT_SUBSCRIBE_MEMBER(m_ECollision, &Systems::TankSteeringSystem::OnCollision);
for (int i = 0; i < 4; i++)
{
m_TankInputControllers[i] = std::shared_ptr<TankSteeringInputController>(new TankSteeringInputController(EventBroker, i + 1));
@@ -93,6 +95,32 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit
}
}
bool Systems::TankSteeringSystem::OnCollision( const Events::Collision &e )
{
// TODO:
auto modelComponent = m_World->GetComponent<Components::Model>(e.Entity1);
if (modelComponent && modelComponent->ModelFile == "Models/Placeholders/rocket/Rocket.obj")
{
auto transform = m_World->GetComponent<Components::Transform>(e.Entity1);
m_World->GetSystem<Systems::ParticleSystem>()->CreateExplosion(
transform->Position,
1,
60,
"Textures/Sprites/NewtonTreeDeleteASAPPlease.png",
glm::angleAxis(glm::pi<float>()/2, glm::vec3(1,0,0)),
40,
glm::pi<float>(),
0.5f
);
//m_World->RemoveEntity(e.Entity1);
}
//LOG_INFO("Ent1 %i Ent2 %i", e.Entity1, e.Entity2);
return true;
}
void Systems::TankSteeringSystem::TankSteeringInputController::Update( double dt )
{
PositionX = m_Horizontal;