本文整理汇总了Python中location.Location.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Location.__init__方法的具体用法?Python Location.__init__怎么用?Python Location.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类location.Location
的用法示例。
在下文中一共展示了Location.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import __init__ [as 别名]
def __init__(self, config):
Location.__init__(self, config)
self.victory_chance = config['victory_chance']
self.reward = config['reward']
self.exp_reward = config['exp_reward']
self.penalty = config['penalty']
self.drop_object = config['drop_object']
示例2: __init__
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import __init__ [as 别名]
def __init__(self, map_name, name):
xml = doc.xpath('//map[@name="%s"]/door[@name="%s"]' % (map_name, name))[0]
#~ print etree.tostring(xml)
Location.__init__(self, map_name, xml.get('loc'))
#~ Location.__init__(self, map_name, doc.xpath('//map[@name="%s"]/door[@name="%s"]' % (map_name, name))[0].get('loc'))
self.door_name = name
if not xml.get('target'):
raise Exception("door without target: %s" % etree.tostring(xml))
self.target = xml.get('target')
示例3: __init__
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import __init__ [as 别名]
def __init__(self, config):
Location.__init__(self, config)
self.inventory_price = config['inventory_price']
self.extra_price = config['extra_price']
示例4: __init__
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import __init__ [as 别名]
def __init__(self, tid, x, y, source=None):
Location.__init__(self, x, y, tid)
if source:
self.distance = self.dist(source)
else:
self.distance = float('inf') # the max possible
示例5: __init__
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import __init__ [as 别名]
def __init__(self, map_name, xml):
loc = xml.get('loc').split(',')
loc = (int(loc[0]), int(loc[1]))
Location.__init__(self, map_name, loc)
self.target = xml.get('target')
self.name = xml.get('name')