本文整理汇总了Python中MovieCamera.chooseFireShot方法的典型用法代码示例。如果您正苦于以下问题:Python MovieCamera.chooseFireShot方法的具体用法?Python MovieCamera.chooseFireShot怎么用?Python MovieCamera.chooseFireShot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovieCamera
的用法示例。
在下文中一共展示了MovieCamera.chooseFireShot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doFires
# 需要导入模块: import MovieCamera [as 别名]
# 或者: from MovieCamera import chooseFireShot [as 别名]
def doFires(fires):
if len(fires) == 0:
return (None, None)
suitFiresDict = { }
for fire in fires:
suitId = fire['target']['suit'].doId
if suitFiresDict.has_key(suitId):
suitFiresDict[suitId].append(fire)
continue
suitFiresDict[suitId] = [
fire]
suitFires = suitFiresDict.values()
def compFunc(a, b):
if len(a) > len(b):
return 1
elif len(a) < len(b):
return -1
return 0
suitFires.sort(compFunc)
totalHitDict = { }
singleHitDict = { }
groupHitDict = { }
for fire in fires:
suitId = fire['target']['suit'].doId
if fire['target']['hp'] > 0:
addHit(singleHitDict, suitId, 1)
addHit(totalHitDict, suitId, 1)
else:
addHit(singleHitDict, suitId, 0)
addHit(totalHitDict, suitId, 0)
fire['target']['hp'] > 0
notify.debug('singleHitDict = %s' % singleHitDict)
notify.debug('groupHitDict = %s' % groupHitDict)
notify.debug('totalHitDict = %s' % totalHitDict)
delay = 0.0
mtrack = Parallel()
firedTargets = []
for sf in suitFires:
if len(sf) > 0:
ival = __doSuitFires(sf)
if ival:
mtrack.append(Sequence(Wait(delay), ival))
delay = delay + TOON_FIRE_SUIT_DELAY
continue
retTrack = Sequence()
retTrack.append(mtrack)
camDuration = retTrack.getDuration()
camTrack = MovieCamera.chooseFireShot(fires, suitFiresDict, camDuration)
return (retTrack, camTrack)