Example #1
0
        public static bool CanSee(this IUnit unit, ICoordinates targetCoords, IMathFunctions math)
        {
            int visionRange = unit.GetVisionRange();

            if (unit.Location.DistanceTo(targetCoords) > visionRange)
            {
                return(false);
            }
            var lineOfSight = unit.GetLineTo(targetCoords, math).Take(visionRange);

            return(unit.CanSee(lineOfSight));
        }