mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-02 10:15:32 +00:00
adding a speed component
This commit is contained in:
+1
-1
@@ -181,7 +181,7 @@ set(SOURCES
|
||||
sources/Component/Color/ColorComponent.cpp
|
||||
sources/Component/Stat/StatComponent.cpp
|
||||
sources/Component/Stat/StatComponent.hpp
|
||||
)
|
||||
sources/Component/Speed/SpeedComponent.cpp sources/Component/Speed/SpeedComponent.hpp)
|
||||
|
||||
add_executable(bomberman
|
||||
sources/main.cpp
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Created by cbihan on 18/06/2021.
|
||||
//
|
||||
|
||||
#include "SpeedComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
SpeedComponent::SpeedComponent(WAL::Entity &entity) :
|
||||
WAL::Component(entity)
|
||||
{
|
||||
}
|
||||
|
||||
WAL::Component *SpeedComponent::clone(WAL::Entity &entity) const
|
||||
{
|
||||
return new SpeedComponent(this->_entity, this->speed);
|
||||
}
|
||||
|
||||
SpeedComponent::SpeedComponent(WAL::Entity &entity, float entitySpeed) :
|
||||
WAL::Component(entity),
|
||||
speed(entitySpeed)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by cbihan on 18/06/2021.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Component/Component.hpp>
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
class SpeedComponent : WAL::Component
|
||||
{
|
||||
public:
|
||||
//! @brief entity speed
|
||||
float speed = .15f;
|
||||
|
||||
//! @inherit
|
||||
WAL::Component *clone(WAL::Entity &entity) const override;
|
||||
|
||||
//! @brief Initialize a new controllable component.
|
||||
explicit SpeedComponent(WAL::Entity &entity);
|
||||
|
||||
//! @brief Initialize a new controllable component.
|
||||
explicit SpeedComponent(WAL::Entity &entity, float entitySpeed);
|
||||
//! @brief A Controllable component is copy constructable.
|
||||
SpeedComponent(const SpeedComponent &) = default;
|
||||
//! @brief default destructor
|
||||
~SpeedComponent() override = default;
|
||||
//! @brief A Controllable component can't be assigned
|
||||
SpeedComponent &operator=(const SpeedComponent &) = delete;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user