adding on collided callback

This commit is contained in:
Bluub
2021-06-01 14:43:48 +02:00
parent ef492f3b57
commit b3dd001532
5 changed files with 62 additions and 24 deletions
@@ -16,27 +16,38 @@ namespace BBM
return new CollisionComponent(entity);
}
CollisionComponent::CollisionComponent(WAL::Entity &entity, std::function<void (WAL::Entity &, const WAL::Entity &)> callback, Vector3f bound)
: WAL::Component(entity), onCollide(callback), bound(bound)
CollisionComponent::CollisionComponent(WAL::Entity &entity, std::function<void (WAL::Entity &, const WAL::Entity &)> onCollide, std::function<void (WAL::Entity &, const WAL::Entity &)> onCollided, Vector3f bound)
: WAL::Component(entity), _onCollide(onCollide), _onCollided(onCollided), bound(bound)
{ }
CollisionComponent::CollisionComponent(WAL::Entity &entity, std::function<void (WAL::Entity &, const WAL::Entity &)> callback, float boundSize)
: WAL::Component(entity), onCollide(callback), bound({boundSize, boundSize, boundSize})
CollisionComponent::CollisionComponent(WAL::Entity &entity, std::function<void (WAL::Entity &, const WAL::Entity &)> onCollide, std::function<void (WAL::Entity &, const WAL::Entity &)> onCollided, float boundSize)
: WAL::Component(entity), _onCollide(onCollide), _onCollided(onCollided), bound({boundSize, boundSize, boundSize})
{ }
CollisionComponent::CollisionComponent(WAL::Entity &entity, WAL::Callback<WAL::Entity &, const WAL::Entity &> callback, Vector3f bound)
: WAL::Component(entity), onCollide(callback), bound(bound)
CollisionComponent::CollisionComponent(WAL::Entity &entity, WAL::Callback<WAL::Entity &, const WAL::Entity &> onCollide, WAL::Callback<WAL::Entity &, const WAL::Entity &> onCollided, Vector3f bound)
: WAL::Component(entity), _onCollide(onCollide), _onCollided(onCollided), bound(bound)
{ }
CollisionComponent::CollisionComponent(WAL::Entity &entity, WAL::Callback<WAL::Entity &, const WAL::Entity &> callback, float boundSize)
: WAL::Component(entity), onCollide(callback), bound({boundSize, boundSize, boundSize})
CollisionComponent::CollisionComponent(WAL::Entity &entity, WAL::Callback<WAL::Entity &, const WAL::Entity &> onCollide, WAL::Callback<WAL::Entity &, const WAL::Entity &> onCollided, float boundSize)
: WAL::Component(entity), _onCollide(onCollide), _onCollided(onCollided), bound({boundSize, boundSize, boundSize})
{ }
CollisionComponent::CollisionComponent(WAL::Entity &entity, Vector3f bound)
: WAL::Component(entity), onCollide(), bound(bound)
: WAL::Component(entity), _onCollide(), _onCollided(), bound(bound)
{ }
CollisionComponent::CollisionComponent(WAL::Entity &entity, float boundSize)
: WAL::Component(entity), onCollide(), bound({boundSize, boundSize, boundSize})
: WAL::Component(entity), _onCollide(), _onCollided(), bound({boundSize, boundSize, boundSize})
{ }
const WAL::Callback<WAL::Entity &, const WAL::Entity &> &CollisionComponent::getOnCollide(void) const
{
return _onCollide;
}
const WAL::Callback<WAL::Entity &, const WAL::Entity &> &CollisionComponent::getOnCollided(void) const
{
return _onCollided;
}
}