mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-25 15:39:50 +00:00
system basic
This commit is contained in:
@@ -5,7 +5,7 @@ namespace BBM
|
||||
{
|
||||
ScoreComponent::ScoreComponent(WAL::Entity &entity)
|
||||
: Component(entity),
|
||||
position()
|
||||
score(PLAYING)
|
||||
{}
|
||||
|
||||
WAL::Component *ScoreComponent::clone(WAL::Entity &entity) const
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>()
|
||||
|
||||
@@ -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>())
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user