2020-01-08 18:46:42 +01:00
|
|
|
extends GSTProximity
|
|
|
|
class_name GSTInfiniteProximity
|
2020-01-10 18:15:50 +01:00
|
|
|
# Determines any agent that is in the specified list as being neighbors with the owner agent.
|
2020-01-08 18:46:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _init(agent: GSTSteeringAgent, agents: Array).(agent, agents) -> void:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
func find_neighbors(callback: FuncRef) -> int:
|
2020-01-16 09:44:44 +01:00
|
|
|
var neighbor_count := 0
|
|
|
|
var agent_count := agents.size()
|
2020-01-08 18:46:42 +01:00
|
|
|
for i in range(agent_count):
|
2020-01-16 09:44:44 +01:00
|
|
|
var current_agent := agents[i] as GSTSteeringAgent
|
2020-01-08 18:46:42 +01:00
|
|
|
|
|
|
|
if current_agent != agent:
|
|
|
|
if callback.call_func(current_agent):
|
|
|
|
neighbor_count += 1
|
|
|
|
|
|
|
|
return neighbor_count
|