Merge remote-tracking branch 'origin/master' into havok

Conflicts:
	src/GameWorld.cpp
	vs11/Returngeance/Returngeance.vcxproj.filters
This commit is contained in:
ViktorLjung
2014-06-05 06:01:49 +02:00
parent 56e6545f0f
commit e4a59cec61
31 changed files with 288 additions and 130 deletions
+1
View File
@@ -11,6 +11,7 @@
#include "GameWorld.h"
#include "Events/GameStart.h"
#include "Events/GameOver.h"
#include "Events/Dead.h"
namespace GUI
{
+1 -1
View File
@@ -37,7 +37,7 @@ namespace GUI
if (!health)
return false;
SetColor(glm::vec4(1.f, 1.f, 1.f, 1 - health->Amount / 100.f));
SetColor(glm::vec4(1.f, 1.f, 1.f, 1 - (health->Amount / 100.f * 2)));
return true;
}
+15 -11
View File
@@ -7,6 +7,7 @@
#include "GUI/GameOverFrame.h"
#include "Events/GameOver.h"
#include "Events/Dead.h"
#include "Components/Player.h"
namespace GUI
@@ -20,7 +21,8 @@ namespace GUI
, m_World(world)
, m_PlayerID(playerID)
{
EVENT_SUBSCRIBE_MEMBER(m_EGameOver, &GUI::PlayerHUD::OnGameOver)
EVENT_SUBSCRIBE_MEMBER(m_EGameOver, &GUI::PlayerHUD::OnGameOver);
EVENT_SUBSCRIBE_MEMBER(m_EDead, &GUI::PlayerHUD::OnDead);
m_HealthOverlay = new HealthOverlay(this, "HealthOverlay", m_World, m_PlayerID);
@@ -35,6 +37,7 @@ namespace GUI
m_VehicleSelection = new VehicleSelection(this, "VehicleSelection", m_World, m_PlayerID);
m_GameOverFrame = new GameOverFrame(this, "GameOver");
m_GameOverFrame->Hide();
}
protected:
@@ -49,14 +52,7 @@ namespace GUI
EventRelay<Frame, Events::GameOver> m_EGameOver;
bool OnGameOver(const Events::GameOver &event)
{
auto playerComponent = m_World->GetComponent<Components::Player>(event.Winner);
if (!playerComponent)
{
LOG_ERROR("Winner is not a valid player!");
return false;
}
if (m_PlayerID == playerComponent->ID)
if (m_PlayerID == event.Player)
m_GameOverFrame->Show(true);
else
m_GameOverFrame->Show(false);
@@ -64,6 +60,14 @@ namespace GUI
return true;
}
EventRelay<Frame, Events::Dead> m_EDead;
bool OnDead(const Events::Dead &event)
{
m_VehicleSelection->Show();
m_HealthOverlay->SetColor(glm::vec4(1, 1, 1, 0));
return true;
}
bool OnCommand(const Events::InputCommand &event)
{
if (event.PlayerID != m_PlayerID)
@@ -71,10 +75,10 @@ namespace GUI
if (event.Command == "interface_confirm" && event.Value > 0)
{
if (m_GameOverFrame->Visible())
/*if (m_GameOverFrame->Visible())
{
m_GameOverFrame->Hide();
}
}*/
}
return true;
+1 -1
View File
@@ -51,7 +51,7 @@ public:
return;
Components::Transform absoluteTransform = m_TransformSystem->AbsoluteTransform(m_CameraEntity);
m_Camera->SetFOV(cameraComponent->FOV);
m_Camera->SetNearClip(cameraComponent->NearClip);
m_Camera->SetFarClip(cameraComponent->FarClip);