From 86e4bf684c3ef92ad31d18f3a4680ebd1f3ebba7 Mon Sep 17 00:00:00 2001 From: "arthur.jamet" Date: Tue, 15 Jun 2021 10:11:14 +0200 Subject: [PATCH] system basic --- sources/Component/Score/ScoreComponent.cpp | 2 +- sources/Component/Score/ScoreComponent.hpp | 2 +- sources/Runner/GameScene.cpp | 2 ++ sources/System/Score/ScoreSystem.cpp | 20 +++++++++++++++++ sources/System/Score/ScoreSystem.hpp | 26 ++++++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 sources/System/Score/ScoreSystem.cpp create mode 100644 sources/System/Score/ScoreSystem.hpp diff --git a/sources/Component/Score/ScoreComponent.cpp b/sources/Component/Score/ScoreComponent.cpp index 6fa3d776..a1e833a6 100644 --- a/sources/Component/Score/ScoreComponent.cpp +++ b/sources/Component/Score/ScoreComponent.cpp @@ -5,7 +5,7 @@ namespace BBM { ScoreComponent::ScoreComponent(WAL::Entity &entity) : Component(entity), - position() + score(PLAYING) {} WAL::Component *ScoreComponent::clone(WAL::Entity &entity) const diff --git a/sources/Component/Score/ScoreComponent.hpp b/sources/Component/Score/ScoreComponent.hpp index f44d0015..d36c0a6f 100644 --- a/sources/Component/Score/ScoreComponent.hpp +++ b/sources/Component/Score/ScoreComponent.hpp @@ -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; diff --git a/sources/Runner/GameScene.cpp b/sources/Runner/GameScene.cpp index 7668a043..3743f559 100644 --- a/sources/Runner/GameScene.cpp +++ b/sources/Runner/GameScene.cpp @@ -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(0, 1.01, 0) .addComponent("assets/player/player.iqm", true, std::make_pair(MAP_DIFFUSE, "assets/player/blue.png")) .addComponent() + .addComponent() .addComponent() .addComponent() .addComponent() diff --git a/sources/System/Score/ScoreSystem.cpp b/sources/System/Score/ScoreSystem.cpp new file mode 100644 index 00000000..02d21c23 --- /dev/null +++ b/sources/System/Score/ScoreSystem.cpp @@ -0,0 +1,20 @@ +// +// Created by Tom Augier on 05/06/2021 +// + +#include "ScoreSystem.hpp" +#include + +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()) + } +} \ No newline at end of file diff --git a/sources/System/Score/ScoreSystem.hpp b/sources/System/Score/ScoreSystem.hpp new file mode 100644 index 00000000..94d51ed6 --- /dev/null +++ b/sources/System/Score/ScoreSystem.hpp @@ -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 + { + public: + //! @inherit + void onFixedUpdate(WAL::ViewEntity &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; + }; +}