Polarith AI
1.8

◆ FindGreedy()

static int [] FindGreedy ( List< AIMFormation agents,
List< Vector3 >  targetPositions,
int  maxTargets = 0 
)
static

Finds assignments for a list of agents and target positions in a greedy manner.

The optimization looks iteratively for the best available assignment to the current agent.

Parameters
agentsA list of the agents AIMFormation that should be assigned to positions inside the formation.
targetPositionsA list of Vector3 positions inside the formation that are available to the agents.
maxTargetsDetermines the maximum number of available targets. Note that this must be less or equal to the real number of available targets to split computation into a greedy and an optimal part.
Returns
An array of assignments; element i is the index of the assigned position from the targets list for the agent on position i of the agents list.
Imprint