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


Python GameLogic.getBlendFileList方法代码示例

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


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

示例1: main

# 需要导入模块: import GameLogic [as 别名]
# 或者: from GameLogic import getBlendFileList [as 别名]
def main(cont):
    # only proceed if we are warping
    if not cont.sensors['trigger_warp_script'].positive:
        return

    own = cont.owner
    own_pos = Vector(own.worldPosition)

    sce = GameLogic.getCurrentScene()

    blendFiles = GameLogic.getBlendFileList('//')
    blendFiles += GameLogic.getBlendFileList('//levels')
    
    blendFiles = dict([(b, None) for b in blendFiles]).keys()
    blendFiles = list(blendFiles) # py3 has its own dict_keys type
    
    blendFiles.sort()

    for b in blendFiles[:]:
        # get rid of this file
        if 'portal_world' in b:
            blendFiles.remove(b)
        if 'library' in b:
            blendFiles.remove(b)
            
    print(blendFiles)
    totFiles = len(blendFiles)

    if not totFiles:
        print('No levels found!')
        return
    # radius for paintings to be displayed in exhibit
    r = 11
    theta = 0 # starting angle for first painting
    totFiles = float(totFiles)
    logic.texture = len(blendFiles)*[2]
    pos_xy = [0,0,0]
    for i,f in enumerate(blendFiles):
        theta = 2*pi* (i/totFiles)
        pos_xy[2] = 1.8
        pos_xy[0] = r*cos(theta)
        pos_xy[1] = r*sin(theta)

        # dynamically change texture
        actu_add_object = cont.actuators['add_dyn_portal.00'+str(i+1)]
        actu_add_object.instantAddObject()
        new_portal = actu_add_object.objectLastCreated
        ID = texture.materialID(new_portal,'MAMyMaterial.00' +str(i+1))
        object_texture = texture.Texture(new_portal,ID)
        url = logic.expandPath('//' + f[0:-6] + '.jpg')
        new_source = texture.ImageFFmpeg(url)
        logic.texture.append(object_texture)
        object_texture.source = new_source
        object_texture.refresh(False)
        
        new_portal.worldPosition = pos_xy

        d,new_vect,local = new_portal.getVectTo((0,0,1))
        new_portal.alignAxisToVect(new_vect,0)
        new_portal.alignAxisToVect(new_vect,1)
        new_portal.alignAxisToVect(new_vect,2)

        new_portal['portal_blend'] = '//' + f
            
        own.endObject() # may as well distroy, wont use anymore
开发者ID:WartburgComputerClub,项目名称:tractor-drive,代码行数:67,代码来源:dyn_portal.py


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