当前位置: 首页>>代码示例>>Python>>正文


Python WorldMap.pickup_cells方法代码示例

本文整理汇总了Python中simulation.world_map.WorldMap.pickup_cells方法的典型用法代码示例。如果您正苦于以下问题:Python WorldMap.pickup_cells方法的具体用法?Python WorldMap.pickup_cells怎么用?Python WorldMap.pickup_cells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在simulation.world_map.WorldMap的用法示例。


在下文中一共展示了WorldMap.pickup_cells方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_pickups_not_added_when_at_target

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
 def test_pickups_not_added_when_at_target(self):
     world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
     grid = self._generate_grid()
     grid[Location(0, 1)].pickup = MockPickup()
     map = WorldMap(grid)
     map.update(1)
     self.assertEqual(len(list(map.pickup_cells())), 1)
     self.assertIn(grid[Location(0, 1)], map.pickup_cells())
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:10,代码来源:test_world_map.py

示例2: test_pickups_added

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
    def test_pickups_added(self):
        world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
        world_map.PICKUP_SPAWN_CHANCE = 1
        map = WorldMap(self._generate_grid())
        map.update(1)
        self.assertEqual(len(list(map.pickup_cells())), 1)

        map.update(2)
        self.assertEqual(len(list(map.pickup_cells())), 2)
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:11,代码来源:test_world_map.py

示例3: test_not_enough_pickup_space

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
 def test_not_enough_pickup_space(self):
     world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
     grid = self._generate_grid(1, 1)
     grid[Location(0, 0)].generates_score = True
     map = WorldMap(grid)
     map.update(1)
     self.assertEqual(len(list(map.pickup_cells())), 0)
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:9,代码来源:test_world_map.py

示例4: test_pickup_spawn_chance

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
 def test_pickup_spawn_chance(self):
     world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 5
     world_map.PICKUP_SPAWN_CHANCE = 0
     grid = self._generate_grid()
     map = WorldMap(grid)
     map.update(1)
     self.assertEqual(len(list(map.pickup_cells())), 0)
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:9,代码来源:test_world_map.py

示例5: test_not_enough_pickup_space

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
 def test_not_enough_pickup_space(self):
     world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
     grid = self._generate_grid(1)
     grid = [[MockCell(avatar='avatar')]]
     map = WorldMap(grid)
     map.reconstruct_interactive_state(1)
     self.assertEqual(len(list(map.pickup_cells())), 0)
开发者ID:joshuablake,项目名称:aimmo,代码行数:9,代码来源:test_world_map.py

示例6: test_pickups_not_added_when_at_target

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
 def test_pickups_not_added_when_at_target(self):
     world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
     grid = self._generate_grid()
     grid[0][1].pickup = True
     map = WorldMap(grid)
     map.reconstruct_interactive_state(1)
     self.assertEqual(len(list(map.pickup_cells())), 1)
     self.assertIn(grid[0][1], map.pickup_cells())
开发者ID:joshuablake,项目名称:aimmo,代码行数:10,代码来源:test_world_map.py

示例7: test_pickup_cells

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
 def test_pickup_cells(self):
     pickup_cell1 = MockCell(pickup=MockPickup())
     pickup_cell2 = MockCell(pickup=MockPickup())
     no_pickup_cell = MockCell()
     grid = self._grid_from_list([[pickup_cell1, no_pickup_cell], [no_pickup_cell, pickup_cell2]])
     map = WorldMap(grid)
     cells = list(map.pickup_cells())
     self.assertIn(pickup_cell1, cells)
     self.assertIn(pickup_cell2, cells)
     self.assertEqual(len(cells), 2, "Non-pickup cells present")
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:12,代码来源:test_world_map.py

示例8: test_pickup_cells

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
 def test_pickup_cells(self):
     pickup_cell1 = MockCell(pickup='pickup1')
     pickup_cell2 = MockCell(pickup='pickup')
     no_pickup_cell = MockCell()
     grid = [[pickup_cell1, no_pickup_cell], [no_pickup_cell, pickup_cell2]]
     map = WorldMap(grid)
     cells = list(map.pickup_cells())
     self.assertIn(pickup_cell1, cells)
     self.assertIn(pickup_cell2, cells)
     self.assertEqual(len(cells), 2, "Non-pickup cells present")
开发者ID:joshuablake,项目名称:aimmo,代码行数:12,代码来源:test_world_map.py

示例9: test_pickup_cells

# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
 def test_pickup_cells(self):
     cells = self._generate_cells()
     cells[0]['pickup'] = {'health_restored': 5}
     cells[8]['pickup'] = {'health_restored': 2}
     map = WorldMap(cells)
     self.assertLocationsEqual(map.pickup_cells(), (Location(-1, -1), Location(1, 1)))
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:8,代码来源:test_world_map.py


注:本文中的simulation.world_map.WorldMap.pickup_cells方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。