本文整理汇总了Python中direct.interval.IntervalGlobal.SoundInterval类的典型用法代码示例。如果您正苦于以下问题:Python SoundInterval类的具体用法?Python SoundInterval怎么用?Python SoundInterval使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SoundInterval类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadAssets
def loadAssets(self):
self.beltModel = NodePath('beltModel')
self.beltModel.reparentTo(self.boss.geom)
self.startLocator = self.boss.geom.find('**/conveyer_belt_start_%d' % (self.index + 1))
self.endLocator = self.boss.geom.find('**/conveyer_belt_end_%d' % (self.index + 1))
center = (self.startLocator.getPos() + self.endLocator.getPos()) / 2.0
self.beltHeight = center.getZ()
self.beltHeight += 0.1
center.setZ(0)
self.beltLength = (self.endLocator.getPos() - self.startLocator.getPos()).length()
self.distBetweenFoodNodes = self.beltLength / self.NumFoodNodes
self.notify.debug('setting beltModelPos to %s' % center)
self.beltModel.setPos(center)
self.setupFoodNodes()
self.setupFoodIvals()
self.setupToonupIvals()
if self.index == 0:
self.beltActorModel = loader.loadModel('phase_12/models/bossbotHQ/food_belt1_model')
else:
self.beltActorModel = loader.loadModel('phase_12/models/bossbotHQ/food_belt2_model')
if self.beltActorModel:
self.beltActor = Actor.Actor(self.beltActorModel)
if self.index == 0:
self.beltActor.loadAnims({'idle': 'phase_12/models/bossbotHQ/food_belt1'})
else:
self.beltActor.loadAnims({'idle': 'phase_12/models/bossbotHQ/food_belt2'})
self.beltActor.reparentTo(render)
self.beltActor.setPlayRate(self.BeltActorPlayRate, 'idle')
mesh = self.beltActor.find('**/mesh_tide1')
joint = self.beltActor.find('**/uvj_WakeWhiteTide1')
mesh.setTexProjector(mesh.findTextureStage('default'), joint, self.beltActor)
self.beltActor.setPos(self.startLocator.getPos())
self.beltSound = base.loadSfx('phase_12/audio/sfx/CHQ_FACT_conveyor_belt.wav')
self.beltSound.setLoop(1)
self.beltSoundInterval = SoundInterval(self.beltSound, node=self.beltModel, listenerNode=base.localAvatar, seamlessLoop=True, volume=0.25, cutOff=100)
示例2: loadAssets
def loadAssets(self):
self.tableGroup = loader.loadModel("phase_12/models/bossbotHQ/BanquetTableChairs")
tableLocator = self.boss.geom.find("**/TableLocator_%d" % (self.index + 1))
if tableLocator.isEmpty():
self.tableGroup.reparentTo(render)
self.tableGroup.setPos(0, 75, 0)
else:
self.tableGroup.reparentTo(tableLocator)
self.tableGeom = self.tableGroup.find("**/Geometry")
self.setupDiners()
self.setupChairCols()
self.squirtSfx = loader.loadSfx("phase_4/audio/sfx/AA_squirt_seltzer_miss.mp3")
self.hitBossSfx = loader.loadSfx("phase_5/audio/sfx/SA_watercooler_spray_only.mp3")
self.hitBossSoundInterval = SoundInterval(self.hitBossSfx, node=self.boss, volume=1.0)
self.serveFoodSfx = loader.loadSfx("phase_4/audio/sfx/MG_sfx_travel_game_bell_for_trolley.mp3")
self.pitcherMoveSfx = base.loadSfx("phase_4/audio/sfx/MG_cannon_adjust.mp3")
示例3: setMovie
def setMovie(self, mode, avId):
isLocalToon = avId == base.localAvatar.doId
if isLocalToon:
DistributedMailbox.notify.debug('setMovie( mode=%d, avId=%d ) called on a local toon' % (mode, avId))
else:
DistributedMailbox.notify.debug('setMovie( mode=%d, avId=%d ) called on a non-local toon' % (mode, avId))
if mode == MailboxGlobals.MAILBOX_MOVIE_CLEAR:
DistributedMailbox.notify.debug('setMovie: clear')
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_EXIT:
if random.random() < 0.5:
sfx = base.loadSfx('phase_5.5/audio/sfx/mailbox_close_1.ogg')
else:
sfx = base.loadSfx('phase_5.5/audio/sfx/mailbox_close_2.ogg')
sfxTrack = SoundInterval(sfx, node=self.model)
sfxTrack.start()
DistributedMailbox.notify.debug('setMovie: exit')
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_EMPTY:
DistributedMailbox.notify.debug('setMovie: empty')
if isLocalToon:
self.mailboxDialog = TTDialog.TTDialog(dialogName='MailboxEmpty', style=TTDialog.Acknowledge, text=TTLocalizer.DistributedMailboxEmpty, text_wordwrap=15, fadeScreen=1, command=self.__clearDialog)
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_WAITING:
DistributedMailbox.notify.debug('setMovie: waiting')
if isLocalToon:
self.mailboxDialog = TTDialog.TTDialog(dialogName='MailboxWaiting', style=TTDialog.Acknowledge, text=TTLocalizer.DistributedMailboxWaiting, text_wordwrap=15, fadeScreen=1, command=self.__clearDialog)
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_READY:
DistributedMailbox.notify.debug('setMovie: ready')
if random.random() < 0.5:
sfx = base.loadSfx('phase_5.5/audio/sfx/mailbox_open_1.ogg')
else:
sfx = base.loadSfx('phase_5.5/audio/sfx/mailbox_open_2.ogg')
sfxTrack = SoundInterval(sfx, node=self.model)
sfxTrack.start()
if isLocalToon:
self.mailboxGui = MailboxScreen.MailboxScreen(self, base.localAvatar, self.mailboxGuiDoneEvent)
self.mailboxGui.show()
self.accept(self.mailboxGuiDoneEvent, self.__handleMailboxDone)
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_NOT_OWNER:
DistributedMailbox.notify.debug('setMovie: not owner')
if isLocalToon:
self.mailboxDialog = TTDialog.TTDialog(dialogName='MailboxNotOwner', style=TTDialog.Acknowledge, text=TTLocalizer.DistributedMailboxNotOwner, text_wordwrap=15, fadeScreen=1, command=self.__clearDialog)
return
else:
DistributedMailbox.notify.warning('unknown mode in setMovie: %s' % mode)
示例4: DistributedBanquetTable
#.........这里部分代码省略.........
elif state == "R":
self.demand("Free")
elif state == "C":
self.demand("Controlled", avId)
elif state == "L":
self.demand("Flat", avId)
else:
self.notify.error("Invalid state from AI: %s" % state)
def setNumDiners(self, numDiners):
self.numDiners = numDiners
def setDinerInfo(self, hungryDurations, eatingDurations, dinerLevels):
self.dinerInfo = {}
for i in xrange(len(hungryDurations)):
hungryDur = hungryDurations[i]
eatingDur = eatingDurations[i]
dinerLevel = dinerLevels[i]
self.dinerInfo[i] = (hungryDur, eatingDur, dinerLevel)
def loadAssets(self):
self.tableGroup = loader.loadModel("phase_12/models/bossbotHQ/BanquetTableChairs")
tableLocator = self.boss.geom.find("**/TableLocator_%d" % (self.index + 1))
if tableLocator.isEmpty():
self.tableGroup.reparentTo(render)
self.tableGroup.setPos(0, 75, 0)
else:
self.tableGroup.reparentTo(tableLocator)
self.tableGeom = self.tableGroup.find("**/Geometry")
self.setupDiners()
self.setupChairCols()
self.squirtSfx = loader.loadSfx("phase_4/audio/sfx/AA_squirt_seltzer_miss.mp3")
self.hitBossSfx = loader.loadSfx("phase_5/audio/sfx/SA_watercooler_spray_only.mp3")
self.hitBossSoundInterval = SoundInterval(self.hitBossSfx, node=self.boss, volume=1.0)
self.serveFoodSfx = loader.loadSfx("phase_4/audio/sfx/MG_sfx_travel_game_bell_for_trolley.mp3")
self.pitcherMoveSfx = base.loadSfx("phase_4/audio/sfx/MG_cannon_adjust.mp3")
def setupDiners(self):
for i in xrange(self.numDiners):
newDiner = self.createDiner(i)
self.diners[i] = newDiner
self.dinerStatus[i] = self.HUNGRY
def createDiner(self, i):
diner = Suit.Suit()
diner.dna = SuitDNA.SuitDNA()
level = self.dinerInfo[i][2]
level -= 4
diner.dna.newSuitRandom(level=level, dept="c")
diner.setDNA(diner.dna)
if self.useNewAnimations:
diner.loop("sit", fromFrame=i)
else:
diner.pose("landing", 0)
locator = self.tableGroup.find("**/chair_%d" % (i + 1))
locatorScale = locator.getNetTransform().getScale()[0]
correctHeadingNp = locator.attachNewNode("correctHeading")
self.chairLocators[i] = correctHeadingNp
heading = self.rotationsPerSeatIndex[i]
correctHeadingNp.setH(heading)
sitLocator = correctHeadingNp.attachNewNode("sitLocator")
base.sitLocator = sitLocator
pos = correctHeadingNp.getPos(render)
if SuitDNA.getSuitBodyType(diner.dna.name) == "c":
sitLocator.setPos(0.5, 3.6499999999999999, -3.75)
else:
示例5: DistributedFoodBelt
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 = [
#.........这里部分代码省略.........