Example #1
0
 async def obs_move_camera(self, position: Union[Unit, Units, Point2,
                                                 Point3]):
     """ Moves observer camera to the target position """
     assert isinstance(position, (Unit, Units, Point2, Point3))
     if isinstance(position, Units):
         position = position.center
     if isinstance(position, Unit):
         position = position.position
     await self._execute(obs_action=sc_pb.RequestObserverAction(actions=[
         sc_pb.ObserverAction(camera_move=sc_pb.ActionObserverCameraMove(
             world_pos=common_pb.Point2D(x=position.x, y=position.y)))
     ]))
Example #2
0
    async def obs_move_camera(self, position: Union[Unit, Units, Point2,
                                                    Point3]):
        """Moves observer camera to the target position. Only works when observing (e.g. watching the replay).

        :param position:"""
        assert isinstance(position, (Unit, Units, Point2, Point3))
        if isinstance(position, Units):
            position = position.center
        if isinstance(position, Unit):
            position = position.position
        await self._execute(obs_action=sc_pb.RequestObserverAction(actions=[
            sc_pb.ObserverAction(camera_move=sc_pb.ActionObserverCameraMove(
                world_pos=position.as_Point2D))
        ]))
Example #3
0
 def observer_act(self, action):
     """Send a single observer action. A shortcut for `observer_actions`."""
     if action and action.ListFields():  # Skip no-ops.
         return self.observer_actions(
             sc_pb.RequestObserverAction(actions=[action]))