本文整理汇总了Python中bravo.location.Location.in_front_of方法的典型用法代码示例。如果您正苦于以下问题:Python Location.in_front_of方法的具体用法?Python Location.in_front_of怎么用?Python Location.in_front_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bravo.location.Location
的用法示例。
在下文中一共展示了Location.in_front_of方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestLocation
# 需要导入模块: from bravo.location import Location [as 别名]
# 或者: from bravo.location.Location import in_front_of [as 别名]
class TestLocation(unittest.TestCase):
def setUp(self):
self.l = Location()
def test_trivial(self):
pass
def test_str(self):
str(self.l)
def test_save_to_packet(self):
self.assertTrue(self.l.save_to_packet())
def test_in_front_of(self):
other = self.l.in_front_of(1)
self.assertEqual(other.pos.x, 0)
self.assertEqual(other.pos.z, 32)
def test_in_front_of_yaw(self):
self.l.ori = Orientation.from_degs(90, 0)
other = self.l.in_front_of(1)
self.assertEqual(other.pos.x, -32)
self.assertEqual(other.pos.z, 0)
示例2: TestLocation
# 需要导入模块: from bravo.location import Location [as 别名]
# 或者: from bravo.location.Location import in_front_of [as 别名]
class TestLocation(unittest.TestCase):
def setUp(self):
self.l = Location()
def test_trivial(self):
pass
def test_str(self):
str(self.l)
def test_clamp_stance(self):
"""
Clamped stance should be 1.62 blocks above the current block.
"""
self.l.pos = Position(0, 32, 0)
self.l.clamp()
self.assertAlmostEqual(self.l.stance, 2.62)
def test_save_to_packet(self):
self.assertTrue(self.l.save_to_packet())
def test_in_front_of(self):
other = self.l.in_front_of(1)
self.assertEqual(other.pos.x, 0)
self.assertEqual(other.pos.z, 32)
def test_in_front_of_yaw(self):
self.l.ori = Orientation.from_degs(90, 0)
other = self.l.in_front_of(1)
self.assertEqual(other.pos.x, -32)
self.assertEqual(other.pos.z, 0)
示例3: TestLocationMethods
# 需要导入模块: from bravo.location import Location [as 别名]
# 或者: from bravo.location.Location import in_front_of [as 别名]
class TestLocationMethods(unittest.TestCase):
def setUp(self):
self.l = Location()
def test_trivial(self):
pass
def test_in_front_of(self):
other = self.l.in_front_of(1)
self.assertEqual(other.x, 0)
self.assertEqual(other.z, 1)
def test_in_front_of_yaw(self):
self.l.yaw = 90
other = self.l.in_front_of(1)
self.assertEqual(other.x, -1)
self.assertEqual(other.z, 0)
test_in_front_of_yaw.todo = "Precision problems"