2023-01-13 22:04:30 +01:00
|
|
|
#ifndef GSAI_PROXIMITY_H
|
|
|
|
#define GSAI_PROXIMITY_H
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
#include "core/int_types.h"
|
|
|
|
#include "core/math/vector3.h"
|
|
|
|
|
|
|
|
#include "core/object/func_ref.h"
|
|
|
|
#include "core/object/reference.h"
|
|
|
|
|
|
|
|
class GSAISteeringAgent;
|
|
|
|
|
2023-01-13 21:13:57 +01:00
|
|
|
class GSAIProximity : public Reference {
|
2023-01-13 21:35:07 +01:00
|
|
|
GDCLASS(GSAIProximity, Reference);
|
|
|
|
|
|
|
|
public:
|
2023-01-13 23:01:38 +01:00
|
|
|
Ref<GSAISteeringAgent> get_agent();
|
|
|
|
void set_agent(const Ref<GSAISteeringAgent> &val);
|
2023-01-13 21:35:07 +01:00
|
|
|
|
2023-01-13 23:37:52 +01:00
|
|
|
Vector<Ref<GSAISteeringAgent>> get_agents();
|
|
|
|
void set_agents(const Vector<Ref<GSAISteeringAgent>> &arr);
|
|
|
|
|
|
|
|
Array get_agents_arr();
|
|
|
|
void set_agents_arr(const Array &arr);
|
2023-01-13 21:35:07 +01:00
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
int find_neighbors(const Ref<FuncRef> &callback);
|
2023-01-13 23:53:46 +01:00
|
|
|
virtual int _find_neighbors(Ref<FuncRef> callback);
|
2023-01-13 21:35:07 +01:00
|
|
|
|
|
|
|
GSAIProximity();
|
|
|
|
~GSAIProximity();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
// Base container type that stores data to find the neighbors of an agent.
|
|
|
|
// @category - Proximities
|
|
|
|
// @tags - abstract
|
|
|
|
// The owning agent whose neighbors are found in the group
|
2023-01-13 23:01:38 +01:00
|
|
|
Ref<GSAISteeringAgent> agent;
|
2023-01-13 21:35:07 +01:00
|
|
|
// The agents who are part of this group and could be potential neighbors
|
2023-01-13 23:01:38 +01:00
|
|
|
Vector<Ref<GSAISteeringAgent>> agents;
|
2023-01-13 21:35:07 +01:00
|
|
|
// Returns a number of neighbors based on a `callback` function.
|
|
|
|
//
|
|
|
|
// `_find_neighbors` calls `callback` for each agent in the `agents` array and
|
|
|
|
// adds one to the count if its `callback` returns true.
|
|
|
|
// @tags - virtual
|
2023-01-13 21:13:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|