mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-04 18:46:22 +00:00
create score component
This commit is contained in:
@@ -130,6 +130,8 @@ set(SOURCES
|
||||
sources/Runner/PauseMenuScene.cpp
|
||||
sources/Runner/SettingsMenuScene.cpp
|
||||
sources/Runner/CreditScene.cpp
|
||||
sources/Component/Score/ScoreComponent.cpp
|
||||
sources/Component/Score/ScoreComponent.hpp
|
||||
)
|
||||
add_executable(bomberman
|
||||
sources/main.cpp
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
#include "ScoreComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
ScoreComponent::ScoreComponent(WAL::Entity &entity)
|
||||
: Component(entity),
|
||||
position()
|
||||
{}
|
||||
|
||||
WAL::Component *ScoreComponent::clone(WAL::Entity &entity) const
|
||||
{
|
||||
return new ScoreComponent(entity);
|
||||
}
|
||||
|
||||
} // namespace WAL
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Component/Component.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
//! @brief A basic position component
|
||||
class ScoreComponent : public WAL::Component
|
||||
{
|
||||
public:
|
||||
//! @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;
|
||||
|
||||
//! @inherit
|
||||
WAL::Component *clone(WAL::Entity &entity) const override;
|
||||
|
||||
//! @brief Create a new ScoreComponent linked to a specific entity
|
||||
explicit ScoreComponent(WAL::Entity &entity);
|
||||
//! @brief A position component is copy constructable
|
||||
ScoreComponent(const ScoreComponent &) = default;
|
||||
//! @brief A default destructor
|
||||
~ScoreComponent() override = default;
|
||||
//! @brief A position component is not assignable
|
||||
ScoreComponent &operator=(const ScoreComponent &) = delete;
|
||||
};
|
||||
} // namespace WAL
|
||||
Reference in New Issue
Block a user