2020-01-29 05:56:10 +01:00
|
|
|
# Base container type that stores data to find the neighbors of an agent.
|
2020-04-03 02:31:59 +02:00
|
|
|
# @category - Proximities
|
|
|
|
# @tags - abstract
|
2020-01-09 18:24:55 +01:00
|
|
|
extends Reference
|
2020-02-11 18:33:25 +01:00
|
|
|
class_name GSAIProximity
|
2020-01-09 18:24:55 +01:00
|
|
|
|
2020-01-29 05:56:10 +01:00
|
|
|
# The owning agent whose neighbors are found in the group
|
2023-01-13 13:09:18 +01:00
|
|
|
var agent : GSAISteeringAgent
|
2020-01-29 05:56:10 +01:00
|
|
|
# The agents who are part of this group and could be potential neighbors
|
2023-01-13 13:09:18 +01:00
|
|
|
var agents : Array = Array()
|
2020-01-09 18:24:55 +01:00
|
|
|
|
2023-01-13 20:08:32 +01:00
|
|
|
func find_neighbors(_callback: FuncRef) -> int:
|
|
|
|
return call("_find_neighbors", _callback)
|
2020-01-09 18:24:55 +01:00
|
|
|
|
2020-01-29 05:56:10 +01:00
|
|
|
# Returns a number of neighbors based on a `callback` function.
|
|
|
|
#
|
2020-01-29 22:53:57 +01:00
|
|
|
# `_find_neighbors` calls `callback` for each agent in the `agents` array and
|
2020-01-29 05:56:10 +01:00
|
|
|
# adds one to the count if its `callback` returns true.
|
2020-04-03 02:31:59 +02:00
|
|
|
# @tags - virtual
|
2020-02-11 20:18:22 +01:00
|
|
|
func _find_neighbors(_callback: FuncRef) -> int:
|
2020-01-09 18:24:55 +01:00
|
|
|
return 0
|