Exemplo n.º 1
0
    def units_in_sight(self, unit: Soldier):
        """

                :param unit:
                :return: units_to_distances
                """

        sight_range = unit.get_sight_range()
        origin = self._map.get_point(unit)
        distance_to_points = self._rf.get_sight_ranges_units_only(
            origin, sight_range)
        del distance_to_points[0]
        return {
            self._map.get_unit(point): distance
            for distance, points in distance_to_points.items()
            for point in points
        }
Exemplo n.º 2
0
 def test_get_sight_rangs(self):
     unit = Soldier()
     self.assertEqual(unit.get_sight_range(), 10)