40 lines
885 B
C++
40 lines
885 B
C++
|
|
#ifndef CABSTRACTCUSTOMCOMPONENT_HPP
|
||
|
|
#define CABSTRACTCUSTOMCOMPONENT_HPP
|
||
|
|
|
||
|
|
#include "../CAbstractComponent.hpp"
|
||
|
|
#include <unordered_map>
|
||
|
|
|
||
|
|
namespace CosmicCore {
|
||
|
|
/**
|
||
|
|
* @brief Class representing a Data Dictonnary. Is a component.
|
||
|
|
*/
|
||
|
|
class CAbstractCustomComponent : public CAbstractComponent{
|
||
|
|
private:
|
||
|
|
std::unordered_map<std::string, float> m_properties;
|
||
|
|
public:
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief CData's default constructor, disabled.
|
||
|
|
*/
|
||
|
|
CAbstractCustomComponent() = delete;
|
||
|
|
virtual ~CAbstractCustomComponent() = default;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief CData's constructor.
|
||
|
|
* @param[in, out] entity The entity to which we want to attach specific informations.
|
||
|
|
*/
|
||
|
|
CAbstractCustomComponent(CEntity& entity);
|
||
|
|
|
||
|
|
|
||
|
|
void addProperty(std::string name, float value);
|
||
|
|
|
||
|
|
float getProperty(std::string name);
|
||
|
|
|
||
|
|
void setProperty(std::string name, float value);
|
||
|
|
|
||
|
|
nlohmann::json to_json();
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
#endif
|