當前位置: 首頁>>代碼示例>>Python>>正文


Python SoundInterval.finish方法代碼示例

本文整理匯總了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 = [
#.........這裏部分代碼省略.........
開發者ID:OldToontown,項目名稱:OldToontown,代碼行數:103,代碼來源:DistributedFoodBelt.py


注:本文中的direct.interval.IntervalGlobal.SoundInterval.finish方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。