コード例 #1
0
class DGPlayground(Playground.Playground):
    notify = directNotify.newCategory("DGPlayground")

    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.birdSfx = None

    def enter(self, requestStatus):
        Playground.Playground.enter(self, requestStatus)
        self.startBirds()

    def startBirds(self):
        taskMgr.add(self.birdTask, "DGPlayground-birdTask")

    def stopBirds(self):
        taskMgr.remove("DGPlayground-birdTask")
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None

    def birdTask(self, task):
        noiseFile = random.choice(self.loader.birdNoises)
        noise = base.loadSfx(noiseFile)
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        self.birdSfx = SoundInterval(noise)
        self.birdSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again

    def exit(self):
        self.stopBirds()
        Playground.Playground.exit(self)
コード例 #2
0
    def clientCommonObject(self, type, commonId, pos, hpr, sizeX, sizeY, moveDistance):
        data = self.createCommonObject(type, commonId, pos, hpr, sizeX, sizeY, moveDistance)
        index = data[1]
        if type == 3:
            cross = self.commonObjectDict[commonId][2]
            for pair in self.odePandaRelationList:
                pandaNodePathGeom = pair[0]
                odeBody = pair[1]
                if odeBody == cross:
                    base.sfxPlayer.setCutoffDistance(240)
                    self.notify.debug('nodePath = %s' % pandaNodePathGeom)
                    windmillSfx = loader.loadSfx('phase_6/audio/sfx/Golf_Windmill_Loop.ogg')
                    windMillSoundInterval = SoundInterval(windmillSfx, node=pandaNodePathGeom, listenerNode=base.camera, seamlessLoop=True, volume=0.5)
                    windMillSoundInterval.loop()
                    self.physicsSfxDict[index] = (windmillSfx, windMillSoundInterval)
                    break

        else:
            if type == 4:
                box = self.commonObjectDict[commonId][2]
                for pair in self.odePandaRelationList:
                    pandaNodePathGeom = pair[0]
                    odeBody = pair[1]
                    if odeBody == box:
                        self.notify.debug('nodePath = %s' % pandaNodePathGeom)
                        moverSfx = loader.loadSfx('phase_6/audio/sfx/Golf_Moving_Barrier.ogg')
                        moverSoundInterval = SoundInterval(moverSfx, node=pandaNodePathGeom, listenerNode=base.camera, seamlessLoop=True, volume=0.5)
                        moverSoundInterval.start()
                        self.physicsSfxDict[index] = (moverSfx, moverSoundInterval, index)
                        break
コード例 #3
0
    def clientCommonObject(self, type, commonId, pos, hpr, sizeX, sizeY, moveDistance):
        data = self.createCommonObject(type, commonId, pos, hpr, sizeX, sizeY, moveDistance)
        index = data[1]
        if type == 3:
            cross = self.commonObjectDict[commonId][2]
            for pair in self.odePandaRelationList:
                pandaNodePathGeom = pair[0]
                odeBody = pair[1]
                if odeBody == cross:
                    base.sfxPlayer.setCutoffDistance(240)
                    self.notify.debug('nodePath = %s' % pandaNodePathGeom)
                    windmillSfx = loader.loadSfx('phase_6/audio/sfx/Golf_Windmill_Loop.ogg')
                    windMillSoundInterval = SoundInterval(windmillSfx, node=pandaNodePathGeom, listenerNode=base.camera, seamlessLoop=True, volume=0.5)
                    windMillSoundInterval.loop()
                    self.physicsSfxDict[index] = (windmillSfx, windMillSoundInterval)
                    break

        elif type == 4:
            box = self.commonObjectDict[commonId][2]
            for pair in self.odePandaRelationList:
                pandaNodePathGeom = pair[0]
                odeBody = pair[1]
                if odeBody == box:
                    self.notify.debug('nodePath = %s' % pandaNodePathGeom)
                    moverSfx = loader.loadSfx('phase_6/audio/sfx/Golf_Moving_Barrier.ogg')
                    moverSoundInterval = SoundInterval(moverSfx, node=pandaNodePathGeom, listenerNode=base.camera, seamlessLoop=True, volume=0.5)
                    moverSoundInterval.start()
                    self.physicsSfxDict[index] = (moverSfx, moverSoundInterval, index)
                    break
コード例 #4
0
ファイル: DDPlayground.py プロジェクト: coginvasion/src
class DDPlayground(Playground.Playground):

    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.birdSfx = None
        return

    def enter(self, requestStatus):
        Playground.Playground.enter(self, requestStatus)
        self.startBirds()

    def startBirds(self):
        taskMgr.add(self.birdTask, 'DDPlayground-birdTask')

    def stopBirds(self):
        taskMgr.remove('DDPlayground-birdTask')
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        return

    def birdTask(self, task):
        noiseFile = self.loader.birdNoise
        noise = base.loadSfx(noiseFile)
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        self.birdSfx = SoundInterval(noise)
        self.birdSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again

    def exit(self):
        self.stopBirds()
        Playground.Playground.exit(self)
コード例 #5
0
class DDPlayground(Playground.Playground):
    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.birdSfx = None
        return

    def enter(self, requestStatus):
        Playground.Playground.enter(self, requestStatus)
        self.startBirds()

    def startBirds(self):
        taskMgr.add(self.birdTask, 'DDPlayground-birdTask')

    def stopBirds(self):
        taskMgr.remove('DDPlayground-birdTask')
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        return

    def birdTask(self, task):
        noiseFile = self.loader.birdNoise
        noise = base.loadSfx(noiseFile)
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        self.birdSfx = SoundInterval(noise)
        self.birdSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again

    def exit(self):
        self.stopBirds()
        Playground.Playground.exit(self)
コード例 #6
0
class TTPlayground(Playground.Playground):
    notify = directNotify.newCategory('TTPlayground')

    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.birdSfx = None
        self.christmasTree = None
        return

    def load(self):
        Playground.Playground.load(self)
        if base.cr.holidayManager.getHoliday() == HolidayType.CHRISTMAS:
            self.christmasTree = loader.loadModel(
                'phase_4/models/props/winter_tree_Christmas.bam')
            self.christmasTree.reparentTo(self.loader.geom)
            self.christmasTree.setPos(0.651558, 23.0954, 0.00864142)
            self.christmasTree.setH(-183.108)
            winterTxt = loader.loadTexture('winter/maps/tt_winter_ground.png')
            self.loader.geom.find('**/ground_center').setTexture(winterTxt, 1)

    def unload(self):
        Playground.Playground.unload(self)
        if self.christmasTree:
            self.christmasTree.removeNode()
            self.christmasTree = None
        return

    def enter(self, requestStatus):
        Playground.Playground.enter(self, requestStatus)
        self.startBirds()

    def startBirds(self):
        taskMgr.add(self.birdTask, 'TTPlayground-birdTask')

    def stopBirds(self):
        taskMgr.remove('TTPlayground-birdTask')
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        return

    def birdTask(self, task):
        noiseFile = random.choice(self.loader.birdNoises)
        noise = base.loadSfx(noiseFile)
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        self.birdSfx = SoundInterval(noise)
        self.birdSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again

    def exit(self):
        self.stopBirds()
        Playground.Playground.exit(self)
コード例 #7
0
class DDPlayground(Playground.Playground):
    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.birdSfx = None

        # Let's handle the Christmas effects.
        if base.cr.holidayManager.getHoliday() == HolidayType.CHRISTMAS:
            water = self.loader.geom.find('**/water')
            water.setCollideMask(CIGlobals.FloorBitmask)

    def load(self):
        Playground.Playground.load(self)
        base.waterReflectionMgr.addWaterNode(
            125, (-25, 30, base.wakeWaterHeight),
            depth=14.0,
            spec=base.waterReflectionMgr.getDefaultSpec('ddPond'))

    def enter(self, requestStatus):
        self.startBirds()
        Playground.Playground.enter(self, requestStatus)

    def startBirds(self):
        taskMgr.add(self.birdTask, "DDPlayground-birdTask")

    def stopBirds(self):
        taskMgr.remove("DDPlayground-birdTask")
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None

    def birdTask(self, task):
        noiseFile = self.loader.birdNoise
        noise = base.loadSfx(noiseFile)
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        self.birdSfx = SoundInterval(noise)
        self.birdSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again

    def exit(self):
        self.stopBirds()
        Playground.Playground.exit(self)
コード例 #8
0
ファイル: TTPlayground.py プロジェクト: coginvasion/src
class TTPlayground(Playground.Playground):
    notify = directNotify.newCategory('TTPlayground')

    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.birdSfx = None
        return

    def load(self):
        Playground.Playground.load(self)

    def unload(self):
        Playground.Playground.unload(self)

    def enter(self, requestStatus):
        Playground.Playground.enter(self, requestStatus)
        self.startBirds()

    def startBirds(self):
        taskMgr.add(self.birdTask, 'TTPlayground-birdTask')

    def stopBirds(self):
        taskMgr.remove('TTPlayground-birdTask')
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        return

    def birdTask(self, task):
        noiseFile = random.choice(self.loader.birdNoises)
        noise = base.loadSfx(noiseFile)
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        self.birdSfx = SoundInterval(noise)
        self.birdSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again

    def exit(self):
        self.stopBirds()
        Playground.Playground.exit(self)
コード例 #9
0
class BRPlayground(Playground.Playground):
    notify = directNotify.newCategory('BRPlayground')
    InWaterZ = 0.93

    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.windSfx = None
        self.water = None
        return

    def enter(self, requestStatus):
        Playground.Playground.enter(self, requestStatus)
        self.water = BRWater.BRWater(self)
        self.startWind()

    def exit(self):
        self.stopWind()
        self.water.fsm.requestFinalState()
        Playground.Playground.exit(self)

    def unload(self):
        self.water.cleanup()
        self.water = None
        Playground.Playground.unload(self)
        return

    def startWaterWatch(self, enter=1):
        taskMgr.add(self.__waterWatch,
                    'BRPlayground-waterWatch',
                    extraArgs=[enter],
                    appendTask=True)

    def __waterWatch(self, enter, task):
        if enter:
            if base.localAvatar.getZ(render) <= self.InWaterZ:
                self.water.fsm.request('freezeUp')
                return task.done
        else:
            if base.localAvatar.getZ(render) > self.InWaterZ:
                if self.water.fsm.getCurrentState().getName() == 'freezeUp':
                    self.water.fsm.request('coolDown')
                    return task.done
        return task.cont

    def stopWaterWatch(self):
        taskMgr.remove('BRPlayground-waterWatch')

    def startWind(self):
        taskMgr.add(self.windTask, 'BRPlayground-windTask')

    def stopWind(self):
        taskMgr.remove('BRPlayground-windTask')
        if self.windSfx:
            self.windSfx.finish()
            self.windSfx = None
        return

    def windTask(self, task):
        noiseFile = random.choice(self.loader.windNoises)
        noise = base.loadSfx(noiseFile)
        if self.windSfx:
            self.windSfx.finish()
            self.windSfx = None
        self.windSfx = SoundInterval(noise)
        self.windSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again
コード例 #10
0
ファイル: BRPlayground.py プロジェクト: coginvasion/src
class BRPlayground(Playground.Playground):
    notify = directNotify.newCategory('BRPlayground')
    InWaterZ = 0.93

    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.windSfx = None
        self.water = None
        return

    def enter(self, requestStatus):
        Playground.Playground.enter(self, requestStatus)
        self.water = BRWater.BRWater(self)
        self.startWind()

    def exit(self):
        self.stopWind()
        self.water.fsm.requestFinalState()
        Playground.Playground.exit(self)

    def unload(self):
        self.water.cleanup()
        self.water = None
        Playground.Playground.unload(self)
        return

    def startWaterWatch(self, enter = 1):
        taskMgr.add(self.__waterWatch, 'BRPlayground-waterWatch', extraArgs=[enter], appendTask=True)

    def __waterWatch(self, enter, task):
        if enter:
            if base.localAvatar.getZ(render) <= self.InWaterZ:
                self.water.fsm.request('freezeUp')
                return task.done
        elif base.localAvatar.getZ(render) > self.InWaterZ:
            if self.water.fsm.getCurrentState().getName() == 'freezeUp':
                self.water.fsm.request('coolDown')
                return task.done
        return task.cont

    def stopWaterWatch(self):
        taskMgr.remove('BRPlayground-waterWatch')

    def startWind(self):
        taskMgr.add(self.windTask, 'BRPlayground-windTask')

    def stopWind(self):
        taskMgr.remove('BRPlayground-windTask')
        if self.windSfx:
            self.windSfx.finish()
            self.windSfx = None
        return

    def windTask(self, task):
        noiseFile = random.choice(self.loader.windNoises)
        noise = base.loadSfx(noiseFile)
        if self.windSfx:
            self.windSfx.finish()
            self.windSfx = None
        self.windSfx = SoundInterval(noise)
        self.windSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again
コード例 #11
0
class TTPlayground(Playground.Playground):
    notify = directNotify.newCategory("TTPlayground")

    def __init__(self, loader, parentFSM, doneEvent):
        Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
        self.birdSfx = None
        self.christmasTree = None
    
    def load(self):
        Playground.Playground.load(self)
        
        if base.cr.holidayManager.getHoliday() == HolidayType.CHRISTMAS:
            # Let's make the Christmas Tree
            self.christmasTree = loader.loadModel('phase_4/models/props/winter_tree_Christmas.bam')
            self.christmasTree.reparentTo(self.loader.geom)
            self.christmasTree.setPos(0.651558, 23.0954, 0.00864142)
            self.christmasTree.setH(-183.108)
            
            # Winter ground
            winterTxt = 'winter/maps/tt_winter_ground.mat'
            self.loader.geom.find('**/ground_center').setBSPMaterial(winterTxt, 1)

        base.waterReflectionMgr.addWaterNode(35, (30.5, -21.4, base.wakeWaterHeight), depth = 2.0,
                                             spec = base.waterReflectionMgr.getDefaultSpec('ttcPond'))

    def unload(self):
        Playground.Playground.unload(self)

        if self.christmasTree:
            self.christmasTree.removeNode()
        self.christmasTree = None

    def enter(self, requestStatus):
        for tree in self.loader.trees:
            tree.reparentTo(self.loader.geom)
        Playground.Playground.enter(self, requestStatus)
        self.startBirds()

    def startBirds(self):
        taskMgr.add(self.birdTask, "TTPlayground-birdTask")

    def stopBirds(self):
        taskMgr.remove("TTPlayground-birdTask")
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None

    def birdTask(self, task):
        noiseFile = random.choice(self.loader.birdNoises)
        noise = base.loadSfx(noiseFile)
        if self.birdSfx:
            self.birdSfx.finish()
            self.birdSfx = None
        self.birdSfx = SoundInterval(noise)
        self.birdSfx.start()
        task.delayTime = random.random() * 20 + 1
        return task.again

    def exit(self):
        self.stopBirds()
        Playground.Playground.exit(self)
        for tree in self.loader.trees:
            tree.reparentTo(hidden)