Ejemplo n.º 1
0
 def map_covered(self, nodes):
     """
     Args:
         nodes (list): Contains str.
     """
     self._map_covered = SelectedGrids(
         [self[node2location(node)] for node in nodes])
Ejemplo n.º 2
0
 def camera_data_spawn_point(self, nodes):
     """
     Args:
         nodes (list): Contains str.
     """
     self._camera_data_spawn_point = SelectedGrids(
         [self[node2location(node)] for node in nodes])
Ejemplo n.º 3
0
def location_ensure(location):
    if isinstance(location, GridInfo):
        return location.location
    elif isinstance(location, str):
        return node2location(location)
    else:
        return location
Ejemplo n.º 4
0
    def shape(self, scale):
        self._shape = node2location(scale.upper())
        for y in range(self._shape[1] + 1):
            for x in range(self._shape[0] + 1):
                grid = GridInfo()
                grid.location = (x, y)
                self.grids[(x, y)] = grid

        # camera_data can be generate automatically, but it's better to set it manually.
        self.camera_data = [location2node(loca) for loca in camera_2d((0, 0, *self._shape), sight=self.camera_sight)]
        self.camera_data_spawn_point = []
        # weight_data set to 10.
        for grid in self:
            grid.weight = 10.
Ejemplo n.º 5
0
def location_ensure(location):
    """
    Args:
        location: Grid.

    Returns:
        tuple(int): Location, such as (4, 3)
    """
    if isinstance(location, GridInfo):
        return location.location
    elif isinstance(location, str):
        return node2location(location)
    else:
        return location
Ejemplo n.º 6
0
    def shape(self, scale):
        self._shape = node2location(scale.upper())
        for y in range(self._shape[1] + 1):
            for x in range(self._shape[0] + 1):
                grid = GridInfo()
                grid.location = (x, y)
                self.grids[(x, y)] = grid

        # camera_data can be generate automatically, but it's better to set it manually.
        self.camera_data = [
            location2node(loca)
            for loca in camera_2d(self._shape, sight=self.camera_sight)
        ]
        # weight_data set to 10.
        for grid in self:
            grid.weight = 10.
        # Initialize grid connection.
        self.grid_connection_initial()