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 21:35:07 +01:00
|
|
|
GSAIProximity GSAIGroupBehavior::get_ *proximity() {
|
|
|
|
return *proximity;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
void GSAIGroupBehavior::set_ *proximity(const GSAIProximity &val) {
|
|
|
|
*proximity = val;
|
2023-01-13 21:13:57 +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
|
|
|
}
|
|
|
|
|
|
|
|
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 21:35:07 +01:00
|
|
|
// Base type for group-based steering behaviors.;
|
|
|
|
// @category - Base types;
|
|
|
|
// Container to find neighbors of the agent and calculate group behavior.;
|
|
|
|
GSAIProximity *proximity;
|
|
|
|
Ref<FuncRef> _callback = funcref(self, "_report_neighbor");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
FuncRef GSAIGroupBehavior::get_callback() {
|
|
|
|
return _callback;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
// Internal callback for the behavior to define whether or not a member is;
|
|
|
|
// relevant;
|
|
|
|
// @tags - virtual;
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
bool GSAIGroupBehavior::_report_neighbor(const GSAISteeringAgent &_neighbor) {
|
|
|
|
return false;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
GSAIGroupBehavior::GSAIGroupBehavior() {
|
|
|
|
*proximity;
|
|
|
|
_callback = funcref(self, "_report_neighbor");
|
|
|
|
}
|
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 21:35:07 +01:00
|
|
|
static 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);
|
|
|
|
ClassDB::bind_method(D_METHOD("set__callback", "value"), &GSAIGroupBehavior::set__callback);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "_callback", PROPERTY_HINT_RESOURCE_TYPE, "Ref<FuncRef>"), "set__callback", "get__callback");
|
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);
|
|
|
|
ClassDB::bind_method(D_METHOD("_report_neighbor", "_neighbor"), &GSAIGroupBehavior::_report_neighbor);
|
|
|
|
}
|