本文整理汇总了Python中direct.interval.IntervalGlobal.SoundInterval.finish方法的典型用法代码示例。如果您正苦于以下问题:Python SoundInterval.finish方法的具体用法?Python SoundInterval.finish怎么用?Python SoundInterval.finish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.interval.IntervalGlobal.SoundInterval
的用法示例。
在下文中一共展示了SoundInterval.finish方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DistributedFoodBelt
# 需要导入模块: from direct.interval.IntervalGlobal import SoundInterval [as 别名]
# 或者: from direct.interval.IntervalGlobal.SoundInterval import finish [as 别名]
class DistributedFoodBelt(DistributedObject.DistributedObject, FSM.FSM, FoodBeltBase):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedFoodBelt')
BeltSpeed = 5
OnDuration = 300
ToonupBeltSpeed = 1.0
BeltActorPlayRate = 5.3499999999999996
ToonupBeltActorPlayRate = BeltActorPlayRate * ToonupBeltSpeed / BeltSpeed
ToonupModels = [
'phase_6/models/golf/picnic_apple.bam',
'phase_6/models/golf/picnic_cupcake.bam',
'phase_6/models/golf/picnic_sandwich.bam',
'phase_6/models/golf/picnic_chocolate_cake.bam']
ToonupScales = [
5,
5,
5,
4]
ToonupZOffsets = [
-0.25,
-0.25,
-0,
-0.25]
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
FSM.FSM.__init__(self, 'DistributedFoodBelt')
self.boss = None
self.bossCogId = 0
self.index = -1
self.foodNodes = []
self.foodIvals = []
self.foodWaitTimes = []
self.foodModelDict = { }
self.foodNum = 0
self.beltActor = None
self.toonupIvals = []
self.toonupWaitTimes = []
self.toonupModelDict = { }
self.toonupNum = 0
def delete(self):
DistributedObject.DistributedObject.delete(self)
self.cleanup()
def announceGenerate(self):
DistributedObject.DistributedObject.announceGenerate(self)
if self.boss:
self.boss.setBelt(self, self.index)
self.loadAssets()
else:
self.notify.warning('announceGenerate self.boss is None, self.bossCogId = %d' % self.bossCogId)
def setBossCogId(self, bossCogId):
self.bossCogId = bossCogId
self.boss = base.cr.doId2do.get(bossCogId)
def setIndex(self, index):
self.index = index
def setState(self, state):
if state == 'F':
self.demand('Off')
elif state == 'N':
self.demand('On')
elif state == 'I':
self.demand('Inactive')
elif state == 'T':
self.demand('Toonup')
else:
self.notify.error('Invalid state from AI: %s' % state)
def enterOn(self):
self.beltSoundInterval.loop()
for i in xrange(len(self.foodNodes)):
self.doMethodLater(self.foodWaitTimes[i], self.startFoodMoving, 'start-%d-%d' % (self.index, i), extraArgs = [
i])
def exitOn(self):
self.beltSoundInterval.finish()
for i in xrange(len(self.foodNodes)):
taskName = 'start-%d-%d' % (self.index, i)
self.removeTask(taskName)
def enterToonup(self):
self.beltSound.setPlayRate(self.ToonupBeltSpeed / self.BeltSpeed)
self.beltSoundInterval.loop()
for i in xrange(len(self.foodNodes)):
self.removeFood(i)
self.beltActor.setPlayRate(self.ToonupBeltActorPlayRate, 'idle')
self.doMethodLater(self.toonupWaitTimes[i], self.startToonupMoving, 'startToonup-%d-%d' % (self.index, i), extraArgs = [
#.........这里部分代码省略.........