public Unit PrevTarget() { var index = VisibleUnits.IndexOf(ActiveUnit.ActiveTarget); var _targetType = ActiveUnit.ActiveTarget.targetType; if (index > 0) { for (int i = index - 1; i >= 0; i--) { var _Target = VisibleUnits [i]; if (_Target.targetType == _targetType) { return(_Target); } } for (int i = VisibleUnits.Count() - 1; i > index; i--) { var _Target = VisibleUnits [i]; if (_Target.targetType == _targetType) { return(_Target); } } } return(getClosestTarget(_targetType)); }
public Unit NextTarget() { var index = VisibleUnits.IndexOf(ActiveUnit.ActiveTarget); var _targetType = ActiveUnit.ActiveTarget.targetType; if (index < VisibleUnits.Count() - 1) { for (int i = index + 1; i < VisibleUnits.Count(); i++) { var _Target = VisibleUnits [i]; if (_Target.targetType == _targetType) { return(_Target); } } } return(getClosestTarget(_targetType)); }