This commit is contained in:
2014-06-05 16:45:15 +02:00
parent 2f617727a4
commit 428ad2bae0
6 changed files with 16 additions and 5 deletions
+1 -1
Submodule assets updated: c44c64df2b...de87617060
+1 -1
View File
@@ -37,7 +37,7 @@ namespace GUI
if (!health) if (!health)
return false; return false;
SetColor(glm::vec4(1.f, 1.f, 1.f, 1 - (health->Amount / 100.f * 2))); SetColor(glm::vec4(1.f, 1.f, 1.f, 1 - (health->Amount / 100.f / 2.f)));
return true; return true;
} }
+4
View File
@@ -63,6 +63,10 @@ namespace GUI
EventRelay<Frame, Events::Dead> m_EDead; EventRelay<Frame, Events::Dead> m_EDead;
bool OnDead(const Events::Dead &event) bool OnDead(const Events::Dead &event)
{ {
auto playerCo = m_World->GetComponent<Components::Player>(event.Entity);
if (!playerCo || m_PlayerID != playerCo->ID)
return false;
m_VehicleSelection->Show(); m_VehicleSelection->Show();
m_HealthOverlay->SetColor(glm::vec4(1, 1, 1, 0)); m_HealthOverlay->SetColor(glm::vec4(1, 1, 1, 0));
return true; return true;
+6
View File
@@ -920,6 +920,12 @@ bool Systems::PhysicsSystem::OnDead( const Events::Dead &e )
m_World->RemoveComponent<Components::TankSteering>(e.Entity); m_World->RemoveComponent<Components::TankSteering>(e.Entity);
} }
auto listener = m_World->GetComponent<Components::Listener>(e.Entity);
if (listener)
{
m_World->RemoveComponent<Components::Listener>(e.Entity);
}
} }
return true; return true;
} }
+1
View File
@@ -87,6 +87,7 @@
#include "Components/Trigger.h" #include "Components/Trigger.h"
#include "Components/Template.h" #include "Components/Template.h"
#include "Components/Camera.h" #include "Components/Camera.h"
#include "Components/Listener.h"
#include "Events/EnterTrigger.h" #include "Events/EnterTrigger.h"
#include "Events/JeepSteer.h" #include "Events/JeepSteer.h"
#include "Events/Dead.h" #include "Events/Dead.h"
+3 -3
View File
@@ -61,7 +61,7 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit
if(vehicleComp) if(vehicleComp)
{ {
auto transform = m_World->GetComponent<Components::Transform>(entity); auto transform = m_World->GetComponent<Components::Transform>(entity);
if(transform->Position.y < 0) if (transform->Position.y < -15 && transform->Position.y > -100)
{ {
Events::Dead e; Events::Dead e;
e.Entity = entity; e.Entity = entity;
@@ -596,8 +596,8 @@ EntityID Systems::TankSteeringSystem::CreateTank(int playerID)
auto shape = m_World->CreateEntity(shot); auto shape = m_World->CreateEntity(shot);
auto transform = m_World->AddComponent<Components::Transform>(shape); auto transform = m_World->AddComponent<Components::Transform>(shape);
auto boxShape = m_World->AddComponent<Components::BoxShape>(shape); auto boxShape = m_World->AddComponent<Components::BoxShape>(shape);
boxShape->Width = 0.5f; boxShape->Width = 0.1f;
boxShape->Height = 0.5f; boxShape->Height = 0.1f;
boxShape->Depth = 0.5f; boxShape->Depth = 0.5f;
m_World->CommitEntity(shape); m_World->CommitEntity(shape);
} }