コード例 #1
0
ファイル: build_grid.py プロジェクト: merfolk/sharpy-sc2
 def fill_line(self, ai, mining_filler, neutral_unit):
     pos: Point2 = neutral_unit.position
     closest_expansion = pos.closest(ai.expansion_locations.keys())
     direction = closest_expansion - neutral_unit.position
     direction = sc2math.point_normalize(direction)
     i = 1
     while i < 5:
         self.fill_area(neutral_unit.position + direction * i, BlockerType.Building2x2, mining_filler)
         i += 1
コード例 #2
0
    def find_low_inside_air(self, start: Point2, target: Point2, distance: float) -> Point2:
        result = self.map.find_low_inside_walk(MapType.Air, start, target, distance)
        result = result[0]  # strip distance
        end_point = Point2((result[0], result[1]))
        result_distance = target.distance_to_point2(end_point)

        if result_distance > distance:
            # Shorten result to be in range for the target
            vector = end_point - target
            normal_vector = point_normalize(vector)
            end_point = normal_vector * distance + target

        return end_point