Пример #1
0
        protected virtual IEnumerable <TMobile> AcquireTargets <TMobile>(
            BaseAspect aspect,
            Point3D p,
            int range,
            bool cache = true,
            Func <TMobile, bool> filter = null) where TMobile : Mobile
        {
            if (aspect == null || aspect.Deleted || aspect.Map == null || aspect.Map == Map.Internal)
            {
                yield break;
            }

            var targets = aspect.AcquireTargets <TMobile>(p, range);

            foreach (var t in (filter != null ? targets.Where(filter) : targets))
            {
                if (cache && Duration > TimeSpan.Zero)
                {
                    SetTargetState(aspect, t, Duration);
                }

                yield return(t);
            }
        }