Пример #1
0
    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));
    }
Пример #2
0
    public Unit getClosestTarget(TargetType _targetType)
    {
        for (int i = 0; i < VisibleUnits.Count(); i++)
        {
            var _Target = VisibleUnits [i];

            if (_Target.targetType == _targetType)
            {
                return(_Target);
            }
        }
        return(null);
    }
Пример #3
0
    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));
    }