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


Python GameState.get_equipped_in_slot方法代码示例

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


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

示例1: equip

# 需要导入模块: import GameState [as 别名]
# 或者: from GameState import get_equipped_in_slot [as 别名]
    def equip(self):
        # if the slot is already being used, dequip whatever is there first
        old_equipment = GameState.get_equipped_in_slot(self.slot)
        if old_equipment is not None:
            old_equipment.dequip()

        # equip object and show a message about it
        self.is_equipped = True
        Utils.message('Equipped ' + self.owner.name + ' on ' + self.slot + '.', libtcod.light_green)
开发者ID:joekane,项目名称:DeepFriedSuperNova,代码行数:11,代码来源:Components.py

示例2: pick_up

# 需要导入模块: import GameState [as 别名]
# 或者: from GameState import get_equipped_in_slot [as 别名]
 def pick_up(self):
     # add to the player's inventory and remove from the map
     if len(GameState.inventory) >= 26:
         Utils.message('Your inventory is full, cannot pick up ' + self.owner.name + '.', libtcod.red)
     else:
         GameState.inventory.append(self.owner)
         GameState.current_level.get_all_objects().remove(self.owner)
         Utils.message('You picked up a ' + self.owner.name + '!', libtcod.green)
         # special case: automatically equip, if the corresponding equipment slot is unused
         equipment = self.owner.equipment
         if equipment and GameState.get_equipped_in_slot(equipment.slot) is None:
             equipment.equip()
开发者ID:joekane,项目名称:DeepFriedSuperNova,代码行数:14,代码来源:Components.py


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