TravellingSystem uses EMove. EMove and ERotate copied from Returngeance into TransportSystem.

This commit is contained in:
PlatinumSkink
2015-10-15 13:44:16 +02:00
parent 4abce7b17f
commit 927c96d863
14 changed files with 347 additions and 25 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ namespace Components
struct Background : Component
{
float distanceLeftToCorrectTravelPosition;
};
}
+26
View File
@@ -0,0 +1,26 @@
//
// Created by Adniklastrator on 2015-09-15.
//
#ifndef DAYDREAM_CLIFE_H
#define DAYDREAM_CLIFE_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Life : Component {
int Number = 0;
};
}
}
#endif //DAYDREAM_CLIFE_H
+2
View File
@@ -17,6 +17,8 @@ struct Travels : Component
{
//This indicates that the object moves upon moving to the next stage. Place this on an object that is to move.
//The camera does not move. Things that are to follow the camera should not have this component.
bool CurrentlyTraveling = false;
};
}
+51
View File
@@ -0,0 +1,51 @@
//
// Created by Adniklastrator on 2015-10-15.
//
#ifndef DAYDREAM_KRAKENSYSTEM_H
#define DAYDREAM_KRAKENSYSTEM_H
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Game/EPause.h"
//#include "Core/Camera.h" Camera Component
namespace dd
{
namespace Systems
{
class KrakenSystem : public System
{
public:
KrakenSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override;
void InitializeObjects();
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
dd::EventRelay<KrakenSystem, dd::Events::Pause> m_EPause;
bool OnPause(const dd::Events::Pause &event);
};
}
}
#endif //DAYDREAM_KRAKENSYSTEM_H
+2
View File
@@ -18,6 +18,8 @@
#include "Rendering/CModel.h"
#include "Rendering/CPointLight.h"
#include "Transform/EMove.h"
#include "Game/CBrick.h"
#include "Game/CBall.h"
#include "Game/CLife.h"
+7
View File
@@ -13,15 +13,22 @@
#include "Core/EventBroker.h"
#include "Core/EKeyDown.h"
#include "Core/EKeyUp.h"
#include "Input/EBindKey.h"
#include "Physics/EContact.h"
#include "Physics/CRectangleShape.h"
#include "Physics/CWaterVolume.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/ESetImpulse.h"
#include "Rendering/CSprite.h"
#include "Rendering/CModel.h"
#include "Transform/EMove.h"
#include "Transform/ERotate.h"
#include "Game/CBall.h"
#include "Game/CPad.h"
#include "Game/CPowerUp.h"
+5
View File
@@ -8,12 +8,15 @@
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Transform/EMove.h"
#include "Game/EPause.h"
#include "Game/EArrivedAtNewStage.h"
#include "Game/EStageCleared.h"
#include "Game/CTravels.h"
#include "Game/CBackground.h"
namespace dd
@@ -45,9 +48,11 @@ private:
dd::EventRelay<TravellingSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<TravellingSystem, dd::Events::StageCleared> m_EStageCleared;
dd::EventRelay<TravellingSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
bool OnPause(const dd::Events::Pause &event);
bool OnStageCleared(const dd::Events::StageCleared &event);
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
};
}
+24
View File
@@ -39,14 +39,38 @@ public:
TransformSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
Components::Transform AbsoluteTransform(EntityID entity);
glm::vec3 AbsolutePosition(EntityID entity);
glm::quat AbsoluteOrientation(EntityID entity);
glm::vec3 AbsoluteScale(EntityID entity);
// Events
EventRelay<TransformSystem, Events::Move> m_EMove;
bool OnMove(const Events::Move &event);
EventRelay<TransformSystem, Events::Rotate> m_ERotate;
bool OnRotate(const Events::Rotate &event);
private:
struct MoveItems
{
EntityID Entity;
glm::vec3 GoalPosition;
float Speed;
};
std::unordered_map<EntityID, MoveItems> m_MoveItems;
std::multimap<EntityID, MoveItems> m_QueuedMoveItems;
struct RotationItems
{
EntityID Entity;
glm::quat GoalRotation;
double Time;
};
std::unordered_map<EntityID, RotationItems> m_RotationItems;
std::multimap<EntityID, RotationItems> m_QueuedRotationItems;
};
}