Lifebuoy updated, now dies after 4 hits

This commit is contained in:
viktorljung
2015-10-08 21:51:43 +02:00
parent d5e7481866
commit 9fe2324913
22 changed files with 12146 additions and 10 deletions
+2 -1
View File
@@ -28,7 +28,8 @@
#include "Game/EHitPad.h"
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
#include "Game/CLifebuoy.h"
#include "Game/CLifebuoy.h"
#include "Game/ELifebuoyHit.h"
namespace dd
{
+1 -1
View File
@@ -15,7 +15,7 @@ namespace Components
struct Lifebuoy : Component
{
int Hits = 4;
};
}
+26
View File
@@ -0,0 +1,26 @@
//
// Created by Adniklastrator on 2015-09-29.
//
#ifndef DAYDREAM_ELIFEBUOYHIT_H
#define DAYDREAM_ELIFEBUOYHIT_H
#include "Core/Entity.h"
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct LifebuoyHit : Event
{
EntityID Lifebuoy;
};
}
}
#endif //DAYDREAM_ELIFEBUOYHIT_H
+5 -1
View File
@@ -16,6 +16,7 @@
#include "Physics/CRectangleShape.h"
#include "Game/EPause.h"
#include "Game/ELifebuoy.h"
#include "Game/ELifebuoyHit.h"
#include "Game/CLifebuoy.h"
#include <fstream>
#include <iostream>
@@ -48,19 +49,22 @@ private:
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LifebuoySystem, dd::Events::Lifebuoy> m_ELifebuoy;
dd::EventRelay<LifebuoySystem, dd::Events::LifebuoyHit> m_ELifebuoyHit;
bool OnContact(const dd::Events::Contact &event);
bool OnPause(const dd::Events::Pause &event);
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
struct LifebuoyInfo
{
EntityID Entity;
float TimeToLive = 15.f;
//int Hits = 4;
};
float m_LeftEdge = -3.8f;
float m_RightEdge = 3.8f;
float m_DownLimit = -5.3f;
float m_DownEdge = -9.2f;
std::list<LifebuoyInfo> m_Lifebuoys;
};