if (aiSensor1.Target != null)
MoveEnemyToDestination(aiSensor1.Target.position, aiSensor1, EnemyAgentCache, EnemyUnitCache, MarkerEnemyUnits, GlobalEnemyUnitIndex);
CheckPlanetOwner(2, EnemyAgentCache);
Both of these use a for for different arrays.
void CheckPlanetOwner(int owner, NavMeshAgent[] enemyAgent)
{
for (int i = 0; i < planetInfo.Length; i++)
{
if (planetInfo_.PlanetOwner == owner && planetInfo*.PlanetUnderAttack)*_
{
for (int y = 0; y < GlobalLimit; y++)
{
if (enemyAgent[y].isActiveAndEnabled)
enemyAgent[y].destination = planetInfoGO*.transform.position;*
}
}
}
}
void MoveEnemyToDestination(Vector3 aiSensorPOS, GlobalAISensor aiSensor, NavMeshAgent[] agentCache, GameObject[] unitCache, GameObject[] markerUnits, int globalIndex)
{
for (int i = 0; i < globalIndex; i++)
{
if (aiSensor.haveTarget && agentCache*.destination != aiSensor.Target.position)*
{
if (unitCache*.activeSelf)*
{
if (markerUnits.Length > 1)
CreateConcentricCircles(i + 1);
if (unitCache.transform.position.x != markerUnits.transform.position.x && unitCache_.transform.position.z != markerUnits*.transform.position.z)
{
if (markerUnits.Length > 1)
{_
_markerUnits.transform.position = new Vector3(pos.x + aiSensorPOS.x, 0.012f, pos.y + aiSensorPOS.z);
}
else if (markerUnits.Length == 1)
{_
_markerUnits.transform.position = aiSensorPOS;
}
//SetDestination stops if something is blocking the path.
agentCache.destination = markerUnits.transform.position;
}
}
}
}
}*
I need to somehow say
if (planetunderattackbyenemy1) don’t do MoveEnemyToDestination(aiSensor1.Target.position, aiSensor1, EnemyAgentCache, EnemyUnitCache, MarkerEnemyUnits, GlobalEnemyUnitIndex);
else if (planetunderattackbyenemy2) ^
else if (planetunderattackbyenemy3) ^_