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


Python Context.terrain方法代码示例

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


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

示例1: __init__

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import terrain [as 别名]
    def __init__(self, character, renderer, proxy, input_mgr, res_mgr, audio_mgr, conf):
        """Constructor.

        :param character: The character name
        :type character: str

        :param renderer: The rederer instance.
        :type renderer: :class:`renderer.Renderer`

        :param proxy: The message proxy
        :type proxy: :class:`network.message.MessageProxy`

        :param input_mgr: The input manager
        :type input_mgr: :class:`core.InputManager`

        :param res_mgr: The resource manager
        :type res_mgr: :class:`loader.ResourceManager`

        :param audio_mgr: The audio manager
        :type audio_mgr: :class:`game.audio.AudioManager`

        :param conf: Configuration
        :type conf: mapping
        """
        self.renderer = renderer
        self.proxy = proxy

        # Setup the context
        context = Context(conf)
        context.input_mgr = input_mgr
        context.res_mgr = res_mgr
        context.audio_mgr = audio_mgr

        # Setup the player
        c_res = res_mgr.get('/characters')
        c_data = c_res.data['map'][character]
        context.character_name = c_data['name']
        context.character_type = ActorType[c_data['type']]
        context.character_avatar = c_data['avatar']

        # Setup the level matrix
        map_res = res_mgr.get('/map')
        context.matrix = map_res['matrix']
        context.scale_factor = map_res.data['scale_factor']

        # Setup lights, scene, camera, terrain and map
        context.light = self.setup_light()
        context.scene = self.setup_scene(context)
        context.camera, context.ratio = self.setup_camera(context)
        context.terrain = self.setup_terrain(context)
        context.map = self.setup_map(context)

        # Setup UI
        ui_res = context.res_mgr.get('/ui')
        player_data = {
            'name': context.character_name,
            'type': context.character_type,
            'avatar': context.character_avatar,
            'avatar_res': c_res['avatar'],
        }
        context.ui = UI(ui_res, self.renderer.width, self.renderer.height, player_data)
        self.context = context

        # Client status variable
        self.exit = False  # Wether or not the client should stop the game loop
        self.last_update = None  # Last tick update

        self.sync_counter = count()  # The computed time delta with the server
        self._syncing = {}
        self.delta = 0  # The computed time delta with the server

        self.time_acc = 0.0  # FPS time accumulator
        self.fps_count = 0  # FPS counter
开发者ID:RookieGameDevs,项目名称:surviveler,代码行数:75,代码来源:client.py


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