private static void EvaluateAttackMove( Actor enemyActor, List <GameObject> myActorGameObjectsSaw, List <Actor> myActorsSaw) { // Evaluating Attack Move for (var myActorIndex = 0; myActorIndex < myActorsSaw.Count; myActorIndex++) { var myActorSaw = myActorsSaw[myActorIndex]; // Only Units can respond to seeing an enemy by Attack Move if (!(myActorSaw is IUnit)) { continue; } // TODO: optimize performance by not requesting the component every time var myUnitController = myActorGameObjectsSaw[myActorIndex].GetComponent <UnitController>(); if (!myUnitController.IsAttackMove || myUnitController.AttackMoveTarget != null) { continue; } // A new target causes Attack to be performed before continuing the queue Attack.AttackUnitOrBuilding(enemyActor, myUnitController); myUnitController.AttackMoveTarget = enemyActor; } }