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


Python ComponentManager.check_Component方法代码示例

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


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

示例1: Walk_Direction

# 需要导入模块: from ComponentManager import ComponentManager [as 别名]
# 或者: from ComponentManager.ComponentManager import check_Component [as 别名]
def Walk_Direction(creatureid, direction):
    cCoord = CM.get_Component('Coord', creatureid)
    newCoord = Coord(cCoord.X + direction.X, cCoord.Y + direction.Y)
    Coords = CM.dict_of('Coord')
    walkable = True
    for key, value in Coords.iteritems():
        if value == newCoord:
            if CM.check_Component('Tile', key):
                tile = CM.get_Component('Tile', key)
                if not tile.Passable:
                    walkable = False
    if walkable:
        cCoord.X = newCoord.X
        cCoord.Y = newCoord.Y
        return True
    else:
        return False
开发者ID:Akhier,项目名称:12Down,代码行数:19,代码来源:S_MoveCreature.py

示例2: Teleport_Random

# 需要导入模块: from ComponentManager import ComponentManager [as 别名]
# 或者: from ComponentManager.ComponentManager import check_Component [as 别名]
def Teleport_Random(creatureid):
    cCoord = CM.get_Component('Coord', creatureid)
    x = randint(1, config.playscreen_width - 1)
    y = randint(1, config.playscreen_height - 1)
    newCoord = Coord(x, y)
    Coords = CM.dict_of('Coord')
    walkable = True
    for key, value in Coords.iteritems():
        if value == newCoord:
            if CM.check_Component('Tile', key):
                tile = CM.get_Component('Tile', key)
                if not tile.Passable:
                    walkable = False
    if walkable:
        cCoord.X = newCoord.X
        cCoord.Y = newCoord.Y
    else:
        Teleport_Random(creatureid)
开发者ID:Akhier,项目名称:12Down,代码行数:20,代码来源:S_MoveCreature.py

示例3: Blink_Random_Failable

# 需要导入模块: from ComponentManager import ComponentManager [as 别名]
# 或者: from ComponentManager.ComponentManager import check_Component [as 别名]
def Blink_Random_Failable(creatureid, mindist=4, maxdist=10):
    cCoord = CM.get_Component('Coord', creatureid)
    x = randint(mindist, maxdist) * choice([-1, 1])
    y = randint(mindist, maxdist) * choice([-1, 1])
    newCoord = Coord(cCoord.X + x, cCoord.Y + y)
    while newCoord.X < 1 or newCoord.X > config.playscreen_width - 3 or \
            newCoord.Y < 1 or newCoord.Y > config.playscreen_height - 3:
        x = randint(mindist, maxdist) * choice([-1, 1])
        y = randint(mindist, maxdist) * choice([-1, 1])
        newCoord = Coord(cCoord.X + x, cCoord.Y + y)
    Coords = CM.dict_of('Coord')
    walkable = True
    for key, value in Coords.iteritems():
        if value == newCoord:
            if CM.check_Component('Tile', key):
                tile = CM.get_Component('Tile', key)
                if not tile.Passable:
                    walkable = False
    if walkable:
        cCoord.X = newCoord.X
        cCoord.Y = newCoord.Y
开发者ID:Akhier,项目名称:12Down,代码行数:23,代码来源:S_MoveCreature.py


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