2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:29:17 +01:00
|
|
|
#include "gsai_group_behavior.h"
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
#include "proximities/gsai_proximity.h"
|
|
|
|
#include "gsai_steering_agent.h"
|
|
|
|
|
|
|
|
Ref<GSAIProximity> GSAIGroupBehavior::get_proximity() {
|
|
|
|
return proximity;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
void GSAIGroupBehavior::set_proximity(const Ref<GSAIProximity> &val) {
|
|
|
|
proximity = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
Ref<FuncRef> GSAIGroupBehavior::get_callback() {
|
2023-01-13 21:35:07 +01:00
|
|
|
return _callback;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
void GSAIGroupBehavior::set_callback(const Ref<FuncRef> &val) {
|
2023-01-13 21:35:07 +01:00
|
|
|
_callback = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
bool GSAIGroupBehavior::_report_neighbor(const Ref<GSAISteeringAgent> &neighbor) {
|
2023-01-13 21:35:07 +01:00
|
|
|
return false;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
GSAIGroupBehavior::GSAIGroupBehavior() {
|
2023-01-13 23:01:38 +01:00
|
|
|
_callback.instance();
|
|
|
|
_callback->set_instance(this);
|
|
|
|
_callback->set_function("_report_neighbor");
|
2023-01-13 21:35:07 +01:00
|
|
|
}
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
GSAIGroupBehavior::~GSAIGroupBehavior() {
|
|
|
|
}
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
void GSAIGroupBehavior::_bind_methods() {
|
|
|
|
ClassDB::bind_method(D_METHOD("get_proximity"), &GSAIGroupBehavior::get_proximity);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_proximity", "value"), &GSAIGroupBehavior::set_proximity);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "proximity", PROPERTY_HINT_RESOURCE_TYPE, "GSAIProximity"), "set_proximity", "get_proximity");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_callback"), &GSAIGroupBehavior::get_callback);
|
2023-01-13 23:01:38 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_callback", "value"), &GSAIGroupBehavior::set_callback);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "_callback", PROPERTY_HINT_RESOURCE_TYPE, "FuncRef"), "set_callback", "get_callback");
|
|
|
|
|
2023-01-13 23:07:52 +01:00
|
|
|
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_report_neighbor", PropertyInfo(Variant::OBJECT, "neighbor", PROPERTY_HINT_RESOURCE_TYPE, "GSAISteeringAgent")));
|
2023-01-13 23:01:38 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("_report_neighbor", "neighbor"), &GSAIGroupBehavior::_report_neighbor);
|
2023-01-13 21:35:07 +01:00
|
|
|
}
|