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


Python Location.in_front_of方法代码示例

本文整理汇总了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)
开发者ID:LucianU,项目名称:bravo,代码行数:28,代码来源:test_location.py

示例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)
开发者ID:JDShu,项目名称:bravo,代码行数:37,代码来源:test_location.py

示例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"
开发者ID:squiddy,项目名称:bravo,代码行数:23,代码来源:test_location.py


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