system basic

This commit is contained in:
arthur.jamet
2021-06-15 10:11:14 +02:00
parent 41d8369ba5
commit 86e4bf684c
5 changed files with 50 additions and 2 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ namespace BBM
{
ScoreComponent::ScoreComponent(WAL::Entity &entity)
: Component(entity),
position()
score(PLAYING)
{}
WAL::Component *ScoreComponent::clone(WAL::Entity &entity) const
+1 -1
View File
@@ -12,7 +12,7 @@ namespace BBM
//! @brief score of player (4 is the looser, 1 is the winner)
enum Score {FIRST = 1, SECOND = 2, THIRD = 3, FOURTH = 4, PLAYING = -1};
//! @brief the score of the player
enum Score position;
enum Score score;
//! @inherit
WAL::Component *clone(WAL::Entity &entity) const override;
+2
View File
@@ -24,6 +24,7 @@
#include "Component/BumperTimer/BumperTimerComponent.hpp"
#include "Model/Model.hpp"
#include "Map/Map.hpp"
#include "Component/Score/ScoreComponent.hpp"
namespace RAY3D = RAY::Drawables::Drawables3D;
@@ -45,6 +46,7 @@ namespace BBM
.addComponent<PositionComponent>(0, 1.01, 0)
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/player/player.iqm", true, std::make_pair(MAP_DIFFUSE, "assets/player/blue.png"))
.addComponent<ControllableComponent>()
.addComponent<ScoreComponent>()
.addComponent<AnimatorComponent>()
.addComponent<GravityComponent>()
.addComponent<BumperTimerComponent>()
+20
View File
@@ -0,0 +1,20 @@
//
// Created by Tom Augier on 05/06/2021
//
#include "ScoreSystem.hpp"
#include <map>
namespace BBM {
ScoreSystem::ScoreSystem(WAL::Wal &wal)
: System(wal)
{}
void ScoreSystem::onSelfUpdate()
{
ScoreComponent::Score maxScore = ScoreComponent::Score::PLAYING;
for (auto &[_, score, _], this->_wal.getScene()->view<PositionComponent, CollisionComponent>())
}
}
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include "System/System.hpp"
#include "Component/Score/ScoreComponent.hpp"
#include "Component/Health/HealthComponent.hpp"
#include "Wal.hpp"
namespace BBM
{
class ScoreSystem : public WAL::System<ScoreComponent, HealthComponent>
{
public:
//! @inherit
void onFixedUpdate(WAL::ViewEntity<ScoreComponent, HealthComponent> &entity) override;
//! @brief ctor
ScoreSystem(WAL::Wal &wal);
//! @brief Default copy ctor
ScoreSystem(const ScoreSystem &) = default;
//! @brief Default dtor
~ScoreSystem() override = default;
//! @brief A SoundManager screen system can't be assigned.
ScoreSystem &operator=(const ScoreSystem &) = delete;
};
}