Main menu finished

This commit is contained in:
2014-06-04 16:59:30 +02:00
parent 7b90e54899
commit 5f1feffe0d
21 changed files with 506 additions and 45 deletions
+19
View File
@@ -0,0 +1,19 @@
#include "PrecompiledHeader.h"
#include "GameStateSystem.h"
#include "World.h"
void Systems::GameStateSystem::Initialize()
{
EVENT_SUBSCRIBE_MEMBER(m_EFlagCaptured, &Systems::GameStateSystem::OnFlagCaptured);
}
bool Systems::GameStateSystem::OnFlagCaptured(const Events::FlagCaptured &event)
{
m_InGame = false;
Events::GameOver e;
e.Winner = event.Player;
EventBroker->Publish(e);
return true;
}
+37
View File
@@ -0,0 +1,37 @@
#ifndef GameStateSystem_h__
#define GameStateSystem_h__
#include <set>
#include "System.h"
#include "Components/Transform.h"
#include "Components/Player.h"
#include "Events/FlagCaptured.h"
#include "Events/GameOver.h"
namespace Systems
{
class GameStateSystem : public System
{
public:
GameStateSystem(World* world, std::shared_ptr<::EventBroker> eventBroker, std::shared_ptr<::ResourceManager> resourceManager)
: System(world, eventBroker, resourceManager)
, m_InGame(true)
{ }
void Initialize() override;
bool InGame() const { return m_InGame; }
private:
bool m_InGame;
EventRelay<GameStateSystem, Events::FlagCaptured> m_EFlagCaptured;
bool OnFlagCaptured(const Events::FlagCaptured &event);
};
}
#endif // GameStateSystem_h__
+1
View File
@@ -48,6 +48,7 @@
#include "Components/Input.h"
#include "Events/SetViewportCamera.h"
#include "Events/GameOver.h"
namespace Systems
{