2020-01-29 05:56:10 +01:00
|
|
|
# Base container type that stores data to find the neighbors of an agent.
|
2020-01-09 18:24:55 +01:00
|
|
|
extends Reference
|
|
|
|
class_name GSTProximity
|
|
|
|
|
|
|
|
|
2020-01-29 05:56:10 +01:00
|
|
|
# The owning agent whose neighbors are found in the group
|
2020-01-09 18:24:55 +01:00
|
|
|
var agent: GSTSteeringAgent
|
2020-01-29 05:56:10 +01:00
|
|
|
# The agents who are part of this group and could be potential neighbors
|
2020-01-16 09:44:44 +01:00
|
|
|
var agents := []
|
2020-01-09 18:24:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _init(agent: GSTSteeringAgent, agents: Array) -> void:
|
|
|
|
self.agent = agent
|
|
|
|
self.agents = agents
|
|
|
|
|
|
|
|
|
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-01-29 22:53:57 +01:00
|
|
|
func _find_neighbors(callback: FuncRef) -> int:
|
2020-01-09 18:24:55 +01:00
|
|
|
return 0
|