From 09204179b53e864aefe1868a8792b37c5490a824 Mon Sep 17 00:00:00 2001 From: Askou Date: Thu, 3 Jun 2021 15:54:13 +0200 Subject: [PATCH] basic bot_ia class template --- CMakeLists.txt | 2 + sources/Component/IA/IAComponent.cpp | 37 +++++++++++++++++++ sources/Component/IA/IAComponent.hpp | 55 ++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 sources/Component/IA/IAComponent.cpp create mode 100644 sources/Component/IA/IAComponent.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index fd2543bf..ee6fe4ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,8 @@ set(SOURCES sources/Component/Collision/CollisionComponent.hpp sources/System/Collision/CollisionSystem.hpp sources/System/Collision/CollisionSystem.cpp + sources/Component/IA/IAComponent.hpp + sources/Component/IA/IAComponent.cpp ) add_executable(bomberman diff --git a/sources/Component/IA/IAComponent.cpp b/sources/Component/IA/IAComponent.cpp new file mode 100644 index 00000000..063467d6 --- /dev/null +++ b/sources/Component/IA/IAComponent.cpp @@ -0,0 +1,37 @@ +/* +** EPITECH PROJECT, 2021 +** Bomberman +** File description: +** IAComponent +*/ + +#include "IAComponent.hpp" +#include + +namespace BBM +{ + IAComponent::IAComponent(WAL::Entity &entity, std::string scriptPath) + : Component(entity), + _scriptPath(scriptPath) + { } + + IAComponent::IAComponent(WAL::Entity &entity) + : Component(entity), + _scriptPath() + { } + + WAL::Component *IAComponent::clone(WAL::Entity &entity) const + { + return new IAComponent(entity); + } + + Vector3f IAComponent::getPosition(void) const + { + return (this->_pos); + } + + void IAComponent::setPosition(Vector3f &pos) + { + this->_pos = pos; + } +} diff --git a/sources/Component/IA/IAComponent.hpp b/sources/Component/IA/IAComponent.hpp new file mode 100644 index 00000000..fdc1ed4a --- /dev/null +++ b/sources/Component/IA/IAComponent.hpp @@ -0,0 +1,55 @@ +/* +** EPITECH PROJECT, 2021 +** Bomberman +** File description: +** IAComponent +*/ + +#ifndef IACOMPONENT_HPP_ +#define IACOMPONENT_HPP_ + +#include "Component/Component.hpp" +#include "Entity/Entity.hpp" +#include "Models/Vector3.hpp" + +namespace BBM +{ + class IAComponent : public WAL::Component + { + private: + + Vector3f _pos; + const std::string _scriptPath; + + public: + + //! @brief get IA Position + Vector3f getPosition(void) const; + + //! @param pos Position of the player + //! @brief set IA position + void setPosition(Vector3f &); + + //! @inherit + WAL::Component *clone(WAL::Entity &entity) const override; + + //! @brief A IA component can't be instantiated, it should be derived. + explicit IAComponent(WAL::Entity &entity); + + //! @brief Constructor + IAComponent(WAL::Entity &entity, std::string scripPath); + + //! @brief A IA component can't be instantiated, it should be derived. + IAComponent(const IAComponent &) = default; + + //! @brief default destructor + ~IAComponent() override = default; + + //! @brief A IA component can't be assigned + IAComponent &operator=(const IAComponent &) = delete; + protected: + }; +} + + +#endif /* !IACOMPONENT_HPP_ */