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


Python ComponentManager.remove_Component方法代码示例

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


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

示例1: Play_Game

# 需要导入模块: from ComponentManager import ComponentManager [as 别名]
# 或者: from ComponentManager.ComponentManager import remove_Component [as 别名]
def Play_Game():
    config.player_action = None
    config.mouse = libtcodpy.Mouse()
    config.key = libtcodpy.Key()
    while not config.gamewindow.is_window_closed:
        libtcodpy.sys_check_for_event(libtcodpy.EVENT_KEY_PRESS |
                                      libtcodpy.EVENT_MOUSE,
                                      config.key, config.mouse)
        Render()
        config.gamewindow.flush
        check_level_up()
        dungeonlevelid = config.DungeonLevelIds[config.CurrentDungeonLevel]
        dungeonlevel = CM.get_Component('DungeonLevel', dungeonlevelid)
        objectids = []
        objectids.extend(dungeonlevel.ItemIds)
        objectids.extend(dungeonlevel.FeatureIds)
        objectids.extend(dungeonlevel.MonsterIds)
        objectids.append(config.PlayerId)
        charmap = char_map(dungeonlevel.MapId)
        for objectid in objectids:
            objectcoord = CM.get_Component('Coord', objectid)
            x = objectcoord.X
            y = objectcoord.Y
            if config.visible[x][y]:
                config.playscreen.write_ex(x, y, charmap[x][y],
                                           Color.map_tile_visible)
        playercreature = CM.get_Component('Creature', config.PlayerId)
        if 'Paralyzed' in playercreature.Special:
            playercreature.Special.pop('Paralyzed', None)
            config.player_action = 'Paralyzed'
            Message('You have been paralyzed for a turn', color=Color.red)
        else:
            config.player_action = Handle_Keys()
        if config.player_action == 'exit' or \
                config.game_state == 'finished' or\
                config.game_state == 'Quit':
            if config.player_action == 'exit':
                choice = None
                while choice is None:
                    choice = Menu('Are you sure you want to Quit?',
                                  ['Yes I want to quit', 'No'], 34)
                if choice == 0:
                    End_Game()
                    break
            else:
                config.gamewindow.clear
                config.playscreen.clear
                break
        if config.game_state == 'playing' and \
                config.player_action != 'no action':
            actions = CM.dict_of('Action')
            keylist = list(actions.keys())
            creatures = CM.dict_of('Creature')
            creatures = dict(creatures)
            poison = CM.dict_of('Poison')
            if poison:
                poison = dict(poison)
                for key, value in poison.iteritems():
                    creature = CM.get_Component('Creature', key)
                    creature.CurHp -= value.Damage
                    value.TurnsLeft -= 1
                    check_death(value.SourceId, key, poison=True)
                    if value.TurnsLeft <= 0:
                        CM.remove_Component('Poison', key)
            for key in keylist:
                if key in objectids:
                    if 'Paralyzed' in creatures[key].Special:
                        creatures[key].Special.pop('Paralyzed', None)
                        tile = CM.get_Component('Tile', key)
                        Message('The ' + tile.TileName + ' is paralyzed!',
                                color=Color.sky)
                    else:
                        actions[key].take_turn()
            for key, value in creatures.iteritems():
                if 'CardinalLeap' in value.Special:
                    (need, cur, dist) = value.Special['CardinalLeap']
                    if cur < need:
                        cur += 1
                        value.Special['CardinalLeap'] = (
                            need, cur, dist)
开发者ID:Akhier,项目名称:12Down,代码行数:82,代码来源:Play_Game.py


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