mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 07:53:43 +00:00
fix errors when building
This commit is contained in:
parent
7e0a2422bd
commit
b07d68b84b
@ -4,6 +4,7 @@
|
||||
#include "Entity.h"
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
class InteractionComponent : public Component
|
||||
{
|
||||
@ -12,7 +13,7 @@ public:
|
||||
~InteractionComponent();
|
||||
|
||||
void init() override;
|
||||
void update() override;
|
||||
void update();
|
||||
|
||||
bool interact(Entity* interactor, Entity* interactee);
|
||||
|
||||
|
||||
@ -44,18 +44,18 @@ Entity* InteractionComponent::findClosestEntity(std::vector<Entity*>& entities,
|
||||
auto isInDirection = getDirectionalCheck(direction, interactorT);
|
||||
|
||||
entities.erase(std::remove_if(entities.begin(), entities.end(), [&](Entity* e){
|
||||
auto& entityT = entity->getComponent<TransformComponent>();
|
||||
auto& entityT = e->getComponent<TransformComponent>();
|
||||
return !isInDirection(entityT) || !isEntityCloseEnough(interactorT, entityT, direction);
|
||||
}), entities.end());
|
||||
|
||||
for(auto e : entities)
|
||||
{
|
||||
auto& entityT = entity->getComponent<TransformComponent>();
|
||||
auto& entityT = e->getComponent<TransformComponent>();
|
||||
float distance = calculateDistance(interactorT.position, entityT.position);
|
||||
|
||||
if (distance < closestDistance) {
|
||||
closestDistance = distance;
|
||||
closestEntity = entity;
|
||||
closestEntity = e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user