t
This commit is contained in:
20
include/object/components/boxcollider.hpp
Normal file
20
include/object/components/boxcollider.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <object/components/component.hpp>
|
||||
|
||||
namespace Game::Object::Components {
|
||||
class BoxCollider : public Component {
|
||||
public:
|
||||
BoxCollider() = default;
|
||||
BoxCollider(const BoxCollider&);
|
||||
BoxCollider& operator=(const BoxCollider&);
|
||||
BoxCollider(BoxCollider&&) noexcept;
|
||||
BoxCollider& operator=(BoxCollider&&) noexcept;
|
||||
~BoxCollider() override;
|
||||
|
||||
void start(Object::Entity* thisEntity) override;
|
||||
void update(float deltaTime, Object::Entity* thisEntity) override;
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace Game::Object::Components {
|
||||
Component& operator=(Component&&) noexcept;
|
||||
|
||||
virtual ~Component() = 0;
|
||||
virtual void start() = 0;
|
||||
virtual void start(Object::Entity* thisEntity) = 0;
|
||||
virtual void update(float deltaTime, Object::Entity* thisEntity) = 0;
|
||||
|
||||
// Getters and setters
|
||||
|
||||
35
src/object/components/boxcollider.cpp
Normal file
35
src/object/components/boxcollider.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <object/components/boxcollider.hpp>
|
||||
|
||||
namespace Game::Object::Components {
|
||||
BoxCollider::BoxCollider(const BoxCollider& other) : Component(other) {
|
||||
LOG("Copied BoxCollider Component: " << mName);
|
||||
}
|
||||
|
||||
BoxCollider& BoxCollider::operator=(const BoxCollider& other) {
|
||||
if (this != &other) {
|
||||
Component::operator=(other);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
BoxCollider::BoxCollider(BoxCollider&& other) noexcept : Component(std::move(other)) {
|
||||
LOG("Moved BoxCollider Component: " << mName);
|
||||
}
|
||||
|
||||
BoxCollider& BoxCollider::operator=(BoxCollider&& other) noexcept {
|
||||
if (this != &other) {
|
||||
Component::operator=(std::move(other));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
BoxCollider::~BoxCollider() = default;
|
||||
|
||||
void BoxCollider::start(Object::Entity* thisEntity) {
|
||||
// Initialization code for the box collider can go here
|
||||
}
|
||||
|
||||
void BoxCollider::update(float deltaTime, Object::Entity* thisEntity) {
|
||||
// Collision detection and response logic can go here
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user