本文整理匯總了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)