private void SelectUnitToShift(AIData_Army army, float maxCost, out float cost, out GameEntityGUID[] shiftingUnitGuids) { cost = 0f; List <GameEntityGUID> list = new List <GameEntityGUID>(); DepartmentOfTheTreasury agency = army.Army.Empire.GetAgency <DepartmentOfTheTreasury>(); foreach (Unit unit in army.Army.Units) { if (this.aiDataRepositoryHelper.IsGUIDValid(unit.GUID)) { if (unit.CanShift()) { ConstructionCost unitForceShiftingCost = agency.GetUnitForceShiftingCost(unit); float value = unitForceShiftingCost.Value; if (cost + value > maxCost) { break; } cost += value; list.Add(unit.GUID); } } } shiftingUnitGuids = list.ToArray(); }