本文整理汇总了Python中MovieCamera.chooseTrapShot方法的典型用法代码示例。如果您正苦于以下问题:Python MovieCamera.chooseTrapShot方法的具体用法?Python MovieCamera.chooseTrapShot怎么用?Python MovieCamera.chooseTrapShot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovieCamera
的用法示例。
在下文中一共展示了MovieCamera.chooseTrapShot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doTraps
# 需要导入模块: import MovieCamera [as 别名]
# 或者: from MovieCamera import chooseTrapShot [as 别名]
def doTraps(traps):
if len(traps) == 0:
return None, None
npcArrivals, npcDepartures, npcs = MovieNPCSOS.doNPCTeleports(traps)
hasUberTrapConflict = False
suitTrapsDict = {}
for trap in traps:
targets = trap['target']
if len(targets) == 1:
suitId = targets[0]['suit'].doId
if suitId in suitTrapsDict:
suitTrapsDict[suitId].append(trap)
else:
suitTrapsDict[suitId] = [trap]
else:
for target in targets:
suitId = target['suit'].doId
if suitId not in suitTrapsDict:
suitTrapsDict[suitId] = [trap]
break
if trap['level'] == UBER_GAG_LEVEL_INDEX:
if len(traps) > 1:
hasUberTrapConflict = True
for oneTarget in trap['target']:
suit = oneTarget['suit']
if suit.battleTrap != NO_TRAP:
hasUberTrapConflict = True
suitTrapLists = suitTrapsDict.values()
mtrack = Parallel()
for trapList in suitTrapLists:
trapPropList = []
for i in range(len(trapList)):
trap = trapList[i]
level = trap['level']
if level == 0:
banana = globalPropPool.getProp('banana')
banana2 = MovieUtil.copyProp(banana)
trapPropList.append([banana, banana2])
elif level == 1:
rake = globalPropPool.getProp('rake')
rake2 = MovieUtil.copyProp(rake)
rake.pose('rake', 0)
rake2.pose('rake', 0)
trapPropList.append([rake, rake2])
elif level == 2:
marbles = globalPropPool.getProp('marbles')
marbles2 = MovieUtil.copyProp(marbles)
trapPropList.append([marbles, marbles2])
elif level == 3:
trapPropList.append([globalPropPool.getProp('quicksand')])
elif level == 4:
trapPropList.append([globalPropPool.getProp('trapdoor')])
elif level == 5:
tnt = globalPropPool.getProp('tnt')
tnt2 = MovieUtil.copyProp(tnt)
trapPropList.append([tnt, tnt2])
elif level == 6:
tnt = globalPropPool.getProp('traintrack')
tnt2 = MovieUtil.copyProp(tnt)
trapPropList.append([tnt, tnt2])
else:
notify.warning(
'__doTraps() - Incorrect trap level: %d' %
level)
if len(trapList) == 1 and not hasUberTrapConflict:
ival = __doTrapLevel(trapList[0], trapPropList[0])
if ival:
mtrack.append(ival)
else:
subMtrack = Parallel()
for i in range(len(trapList)):
trap = trapList[i]
trapProps = trapPropList[i]
ival = __doTrapLevel(trap, trapProps, explode=1)
if ival:
subMtrack.append(ival)
mtrack.append(subMtrack)
trapTrack = Sequence(npcArrivals, mtrack, npcDepartures)
camDuration = mtrack.getDuration()
enterDuration = npcArrivals.getDuration()
exitDuration = npcDepartures.getDuration()
camTrack = MovieCamera.chooseTrapShot(
traps, camDuration, enterDuration, exitDuration)
return trapTrack, camTrack
示例2: doTraps
# 需要导入模块: import MovieCamera [as 别名]
# 或者: from MovieCamera import chooseTrapShot [as 别名]
def doTraps(traps):
if len(traps) == 0:
return (None, None)
suitTrapsDict = { }
for trap in traps:
suitId = trap['target']['suit'].doId
if suitTrapsDict.has_key(suitId):
suitTrapsDict[suitId].append(trap)
else:
suitTrapsDict[suitId] = [
trap]
suitTrapLists = suitTrapsDict.values()
ivals = []
for trapList in suitTrapLists:
trapPropList = []
for i in range(len(trapList)):
trap = trapList[i]
level = trap['level']
if level == 0:
banana = globalPropPool.getProp('banana')
banana2 = MovieUtil.copyProp(banana)
trapPropList.append([
banana,
banana2])
elif level == 1:
rake = globalPropPool.getProp('rake')
rake2 = MovieUtil.copyProp(rake)
rake.pose('rake', 0)
rake2.pose('rake', 0)
trapPropList.append([
rake,
rake2])
elif level == 2:
marbles = globalPropPool.getProp('marbles')
marbles2 = MovieUtil.copyProp(marbles)
trapPropList.append([
marbles,
marbles2])
elif level == 3:
trapPropList.append([
globalPropPool.getProp('quicksand')])
elif level == 4:
trapPropList.append([
globalPropPool.getProp('trapdoor')])
elif level == 5:
tnt = globalPropPool.getProp('tnt')
tnt2 = MovieUtil.copyProp(tnt)
trapPropList.append([
tnt,
tnt2])
else:
notify.warning('__doTraps() - Incorrect trap level: %d' % level)
if len(trapList) == 1:
ival = __doTrapLevel(trapList[0], trapPropList[0])
if ival:
ivals.append(Track([
ival]))
else:
subIvals = []
for i in range(len(trapList)):
trap = trapList[i]
trapProps = trapPropList[i]
ival = __doTrapLevel(trap, trapProps, explode = 1)
if ival:
subIvals.append(Track([
ival]))
ivals.append(MultiTrack(subIvals))
mtrack = MultiTrack(ivals)
camDuration = mtrack.getDuration()
camTrack = MovieCamera.chooseTrapShot(traps, camDuration)
return (mtrack, camTrack)