pandemonium_engine/modules/steering_ai/proximities/gsai_infinite_proximity.cpp

38 lines
758 B
C++
Raw Normal View History

2023-01-13 21:29:17 +01:00
#include "gsai_infinite_proximity.h"
#include "../gsai_steering_agent.h"
#include "scene/main/scene_tree.h"
int GSAIInfiniteProximity::_find_neighbors(Ref<FuncRef> callback) {
int neighbor_count = 0;
int agent_count = agents.size();
Variant arg;
const Variant *argptr[1];
argptr[0] = &arg;
Variant::CallError err;
for (int i = 0; i < agent_count; ++i) {
Ref<GSAISteeringAgent> current_agent = agents[i];
ERR_CONTINUE(!current_agent.is_valid());
if (current_agent != agent) {
if (callback->call_func(argptr, 1, err)) {
neighbor_count += 1;
}
}
}
return neighbor_count;
}
GSAIInfiniteProximity::GSAIInfiniteProximity() {
}
GSAIInfiniteProximity::~GSAIInfiniteProximity() {
}
void GSAIInfiniteProximity::_bind_methods() {
}