def exitPlay(self):
     self.firstPerson.end()
     self.firstPerson.enableMouse()
     self.deleteTimer()
     base.localAvatar.createChatInput()
     base.localAvatar.chatInput.enableKeyboardShortcuts()
     DistributedMinigame.exitPlay(self)
 def disable(self):
     for triggerName in self.triggers:
         self.ignore('enter' + triggerName)
     base.localAvatar.createChatInput()
     camera.reparentTo(render)
     camera.setPosHpr(0, 0, 0, 0, 0, 0)
     render.clearFog()
     self.triggers = None
     self.toonOof = None
     self.hitEagleSfx = None
     self.hitObstacleSfx = None
     self.cannonMoveSfx = None
     self.fallSfx = None
     if self.world:
         self.world.removeNode()
         self.world = None
     self.worldModelPath = None
     self.nodesToStash = None
     self.fog = None
     self.round = None
     for platform in self.platforms:
         platform.removeNode()
     self.platforms = None
     self.cannonId = None
     self.cannonBarrel = None
     self.platformPositions = None
     base.setBackgroundColor(CIGlobals.DefaultBackgroundColor)
     self.bgColor = None
     DistributedMinigame.disable(self)
    def __init__(self, cr):
        try:
            self.DistributedCameraShyGame_initialized
            return
        except:
            self.DistributedCameraShyGame_initialized = 1
        DistributedMinigame.__init__(self, cr)
        self.headPanels.delete()
        self.headPanels = CameraShyHeadPanels()
        self.fsm.addState(
            State('countdown', self.enterCountdown, self.exitCountdown,
                  ['play']))
        self.fsm.addState(
            State('announceGameOver', self.enterAnnounceGameOver,
                  self.exitAnnounceGameOver, ['showWinner']))
        self.fsm.addState(
            State('showWinner', self.enterShowWinner, self.exitShowWinner,
                  ['gameOver']))
        self.fsm.getStateNamed('waitForOthers').addTransition('countdown')
        self.fsm.getStateNamed('play').addTransition('announceGameOver')
        self.remoteAvatars = []
        self.myRemoteAvatar = None
        self.thisPlayerWinsLbl = None
        self.olc = None
        self.firstPerson = CameraShyFirstPerson(self)
        self.skyUtil = None
        self.pbpText = None

        self.levelLoader = CameraShyLevelLoader()
        self.spawnPoints = []
    def offstage(self):
        self.notify.debug('offstage')
        if self.introTrack.isPlaying():
            self.introTrack.finish()
        del self.introTrack
        for avId in self.toonHitTracks.keys():
            track = self.toonHitTracks[avId]
            if track.isPlaying():
                track.finish()

        self.__killCameraTask()
        camera.wrtReparentTo(render)
        self.camParent.removeNode()
        del self.camParent
        for panel in self.scorePanels:
            panel.cleanup()

        self.scorePanels = []
        self.goalBar.destroy()
        del self.goalBar
        base.setCellsAvailable(base.rightCells, 1)
        for suit in self.suits:
            suit.offstage()

        self.__unloadSuits()
        for treasure in self.treasures:
            treasure.destroy()

        del self.treasures
        del self.sndTable
        del self.grabSounds
        del self.toonRNGs
        self.maze.offstage()
        base.localAvatar.showName()
        DistributedMinigame.offstage(self)
    def disable(self):
        for triggerName in self.triggers:
            self.ignore('enter' + triggerName)

        base.localAvatar.createChatInput()
        camera.reparentTo(render)
        camera.setPosHpr(0, 0, 0, 0, 0, 0)
        render.clearFog()
        self.triggers = None
        self.toonOof = None
        self.hitEagleSfx = None
        self.hitObstacleSfx = None
        self.cannonMoveSfx = None
        self.fallSfx = None
        if self.world:
            self.world.removeNode()
            self.world = None
        self.worldModelPath = None
        self.nodesToStash = None
        self.fog = None
        self.round = None
        for platform in self.platforms:
            platform.removeNode()

        self.platforms = None
        self.cannonId = None
        self.cannonBarrel = None
        self.platformPositions = None
        base.setBackgroundColor(CIGlobals.DefaultBackgroundColor)
        self.bgColor = None
        DistributedMinigame.disable(self)
        return
 def enterPlay(self):
     DistributedMinigame.enterPlay(self)
     self.music.setPlayRate(self.Round2MusicSpeed[self.getRound()])
     self.createTimer()
     if self.cannonId != None:
         self.cannonFSM.request('control')
     return
    def offstage(self):
        self.notify.debug('offstage')
        if self.introTrack.isPlaying():
            self.introTrack.finish()
        del self.introTrack
        for avId in self.toonHitTracks.keys():
            track = self.toonHitTracks[avId]
            if track.isPlaying():
                track.finish()

        self.__killCameraTask()
        camera.wrtReparentTo(render)
        self.camParent.removeNode()
        del self.camParent
        for panel in self.scorePanels:
            panel.cleanup()

        self.scorePanels = []
        self.goalBar.destroy()
        del self.goalBar
        base.setCellsActive(base.rightCells, 1)
        for suit in self.suits:
            suit.offstage()

        self.__unloadSuits()
        for treasure in self.treasures:
            treasure.destroy()

        del self.treasures
        del self.sndTable
        del self.grabSounds
        del self.toonRNGs
        self.maze.offstage()
        base.localAvatar.showName()
        DistributedMinigame.offstage(self)
 def enterPlay(self):
     DistributedMinigame.enterPlay(self)
     self.music.setPlayRate(self.Round2MusicSpeed[self.getRound()])
     self.createTimer()
     if self.cannonId != None:
         self.cannonFSM.request('control')
     return
    def __init__(self, cr):
        try:
            self.DistributedCameraShyGame_initialized
            return
        except:
            self.DistributedCameraShyGame_initialized = 1

        DistributedMinigame.__init__(self, cr)
        self.headPanels.delete()
        self.headPanels = CameraShyHeadPanels()
        self.fsm.addState(State('countdown', self.enterCountdown, self.exitCountdown, ['play']))
        self.fsm.addState(State('announceGameOver', self.enterAnnounceGameOver, self.exitAnnounceGameOver, ['showWinner']))
        self.fsm.addState(State('showWinner', self.enterShowWinner, self.exitShowWinner, ['gameOver']))
        self.fsm.getStateNamed('waitForOthers').addTransition('countdown')
        self.fsm.getStateNamed('play').addTransition('announceGameOver')
        self.maze = None
        self.mazeCollModel = None
        self.spawnPoints = []
        self.remoteAvatars = []
        self.myRemoteAvatar = None
        self.thisPlayerWinsLbl = None
        self.sky = None
        self.firstPerson = CameraShyFirstPerson(self)
        self.skyUtil = None
        self.pbpText = None
        return
 def enterFinalScores(self):
     if self.gameMode == GGG.GameModes.KOTH:
         from lib.coginvasion.gui.KOTHKingGui import KOTHKingGui
         self.finalScoreUI = KOTHKingGui(self, self.KOTHKing,
                                         self.myKOTHPoints)
     else:
         DistributedMinigame.enterFinalScores(self)
 def __init__(self, cr):
     DistributedMinigame.__init__(self, cr)
     self.gameFSM = ClassicFSM.ClassicFSM('DistributedMazeGame', [State.State('off', self.enterOff, self.exitOff, ['play']),
      State.State('play', self.enterPlay, self.exitPlay, ['cleanup', 'showScores']),
      State.State('showScores', self.enterShowScores, self.exitShowScores, ['cleanup']),
      State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'off', 'cleanup')
     self.addChildGameFSM(self.gameFSM)
     self.usesLookAround = 1
 def __init__(self, cr):
     DistributedMinigame.__init__(self, cr)
     self.gameFSM = ClassicFSM.ClassicFSM('DistributedMazeGame', [State.State('off', self.enterOff, self.exitOff, ['play']),
      State.State('play', self.enterPlay, self.exitPlay, ['cleanup', 'showScores']),
      State.State('showScores', self.enterShowScores, self.exitShowScores, ['cleanup']),
      State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'off', 'cleanup')
     self.addChildGameFSM(self.gameFSM)
     self.usesLookAround = 1
    def onstage(self):
        self.notify.debug('onstage')
        DistributedMinigame.onstage(self)
        self.maze.onstage()
        self.randomNumGen.shuffle(self.startPosHTable)
        lt = base.localAvatar
        lt.reparentTo(render)
        lt.hideName()
        self.__placeToon(self.localAvId)
        lt.setAnimState('Happy', 1.0)
        lt.setSpeed(0, 0)
        self.camParent = render.attachNewNode('mazeGameCamParent')
        self.camParent.reparentTo(base.localAvatar)
        self.camParent.setPos(0, 0, 0)
        self.camParent.setHpr(render, 0, 0, 0)
        camera.reparentTo(self.camParent)
        camera.setPos(self.camOffset)
        self.__spawnCameraTask()
        self.toonRNGs = []
        for i in xrange(self.numPlayers):
            self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen))

        self.treasures = []
        for i in xrange(self.maze.numTreasures):
            self.treasures.append(MazeTreasure.MazeTreasure(self.treasureModel, self.maze.treasurePosList[i], i, self.doId))

        self.__loadSuits()
        for suit in self.suits:
            suit.onstage()

        self.sndTable = {'hitBySuit': [None] * self.numPlayers, 'falling': [
                     None] * self.numPlayers}
        for i in xrange(self.numPlayers):
            self.sndTable['hitBySuit'][i] = base.loader.loadSfx('phase_4/audio/sfx/MG_Tag_C.ogg')
            self.sndTable['falling'][i] = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_whizz.ogg')

        self.grabSounds = []
        for i in xrange(5):
            self.grabSounds.append(base.loader.loadSfx('phase_4/audio/sfx/MG_maze_pickup.ogg'))

        self.grabSoundIndex = 0
        for avId in self.avIdList:
            self.toonHitTracks[avId] = Wait(0.1)

        self.scores = [0] * self.numPlayers
        self.goalBar = DirectWaitBar(parent=render2d, relief=DGG.SUNKEN, frameSize=(-0.35,
                                                                                    0.35,
                                                                                    -0.15,
                                                                                    0.15), borderWidth=(0.02,
                                                                                                        0.02), scale=0.42, pos=(0.84, 0, 0.5 - 0.28 * self.numPlayers + 0.05), barColor=(0,
                                                                                                                                                                                         0.7,
                                                                                                                                                                                         0,
                                                                                                                                                                                         1))
        self.goalBar.setBin('unsorted', 0)
        self.goalBar.hide()
        self.introTrack = self.getIntroTrack()
        self.introTrack.start()
        return
 def load(self):
     self.createWorld()
     self.setMinigameMusic('phase_6/audio/bgm/GS_Race_SS.mid')
     self.setDescription('Be the first to take 3 pictures of all the other Toons with your camera. ' + 'Use WASD to move and the mouse to look around. Press the left mouse button to take a picture. ' + 'Your camera takes some time to recharge after taking a picture. ' + 'You know you have a good shot when the view finder is green!')
     self.setWinnerPrize(30)
     self.setLoserPrize(15)
     base.render.hide()
     base.setBackgroundColor(0, 0, 0)
     DistributedMinigame.load(self)
Exemple #15
0
    def __init__(self, cr):
        DistributedMinigame.__init__(self, cr)
        self.platformPositions = {
            0: (-15, 0.5, -0.5),
            1: (-5, 0.5, -0.5),
            2: (5, 0.5, -0.5),
            3: (15, 0.5, -0.5)
        }
        self.fsm.addState(
            State('preGameMovie', self.enterPreGameMovie,
                  self.exitPreGameMovie, ['start']))
        self.fsm.addState(
            State('roundCountdown', self.enterRoundCountdown,
                  self.exitRoundCountdown, ['play']))
        self.fsm.addState(
            State('roundOver', self.enterRoundOver, self.exitRoundOver,
                  ['finalScores', 'roundCountdown']))
        self.fsm.addState(
            State('finalScores', self.enterFinalScores, self.exitFinalScores,
                  ['gameOver']))
        self.fsm.getStateNamed('waitForOthers').addTransition('preGameMovie')
        self.fsm.getStateNamed('waitForOthers').addTransition('roundCountdown')
        self.fsm.getStateNamed('play').addTransition('roundOver')
        self.fsm.getStateNamed('gameOver').addTransition('finalScores')

        self.cannonFSM = ClassicFSM('Cannon', [
            State('off', self.enterOff, self.exitOff),
            State('control', self.enterControlCannon, self.exitControlCannon),
            State('fly', self.enterFly, self.exitFly)
        ], 'off', 'off')
        self.cannonFSM.enterInitialState()
        self.cannon = None
        self.hitEagleSfx = None
        self.toonOof = None
        self.cannonMoveSfx = None
        self.fallSfx = None
        self.bgColor = (0.05, 0.05, 0.05)
        self.cannonId = None
        self.cannonBarrel = '**/cannon'
        self.fog = None
        self.platforms = []
        self.cannons = []
        self.round = 0
        self.world = None
        self.world2 = None
        self.olc = None
        self.worldModelPath = 'phase_5/models/cogdominium/tt_m_ara_cfg_quadrant2.bam'
        self.nodesToStash = [
            'lights', 'streamers', 'tt_m_ara_cfg_girders2b:Rwall_col',
            'tt_m_ara_cfg_girders2b:Lwall_col'
        ]
        self.triggers = [
            'tt_m_ara_cfg_clump2:col_clump2', 'tt_m_ara_cfg_clump4:col_clump4',
            'tt_m_ara_cfg_clump5:col_clump5', 'tt_m_ara_cfg_clump6:col_clump6',
            'tt_m_ara_cfg_clump7:col_clump7',
            'tt_m_ara_cfg_base:ceiling_collision'
        ]
    def disable(self):
        self.myRemoteAvatar.cleanup()
        self.myRemoteAvatar = None
        for av in self.remoteAvatars:
            av.cleanup()
            del av

        self.remoteAvatars = None
        DistributedMinigame.disable(self)
        return
    def disable(self):
        self.myRemoteAvatar.cleanup()
        self.myRemoteAvatar = None
        for av in self.remoteAvatars:
            av.cleanup()
            del av

        self.remoteAvatars = None
        DistributedMinigame.disable(self)
        return
 def enterGameOver(self, winner, winnerDoId, allPrize):
     try:
         currentCamPos = base.camera.getPos(render)
         currentCamHpr = base.camera.getHpr(render)
         self.firstPerson.reallyEnd()
         base.camera.setPos(currentCamPos)
         base.camera.setHpr(currentCamHpr)
     except:
         pass
     DistributedMinigame.enterGameOver(self, winner, winnerDoId, allPrize)
 def unload(self):
     self.notify.debug('unload')
     DistributedMinigame.unload(self)
     del self.toonHitTracks
     self.maze.destroy()
     del self.maze
     self.treasureModel.removeNode()
     del self.treasureModel
     del self.music
     self.removeChildGameFSM(self.gameFSM)
     del self.gameFSM
Exemple #20
0
 def __init__(self, cr):
     try:
         self.DistributedToonFPSGame_initialized
         return
     except:
         self.DistributedToonFPSGame_initialized = 1
     DistributedMinigame.__init__(self, cr)
     self.remoteAvatars = []
     self.myRemoteAvatar = None
     self.myKOTHPoints = 0
     self.KOTHKing = None
 def unload(self):
     self.notify.debug('unload')
     DistributedMinigame.unload(self)
     del self.toonHitTracks
     self.maze.destroy()
     del self.maze
     self.treasureModel.removeNode()
     del self.treasureModel
     del self.music
     self.removeChildGameFSM(self.gameFSM)
     del self.gameFSM
    def __init__(self, cr):
        try:
            self.DistributedToonFPSGame_initialized
            return
        except:
            self.DistributedToonFPSGame_initialized = 1

        DistributedMinigame.__init__(self, cr)
        self.remoteAvatars = []
        self.myRemoteAvatar = None
        return
    def onstage(self):
        self.notify.debug('onstage')
        DistributedMinigame.onstage(self)
        self.maze.onstage()
        self.randomNumGen.shuffle(self.startPosHTable)
        lt = base.localAvatar
        lt.reparentTo(render)
        lt.hideName()
        self.__placeToon(self.localAvId)
        lt.setAnimState('Happy', 1.0)
        lt.setSpeed(0, 0)
        self.camParent = render.attachNewNode('mazeGameCamParent')
        self.camParent.reparentTo(base.localAvatar)
        self.camParent.setPos(0, 0, 0)
        self.camParent.setHpr(render, 0, 0, 0)
        camera.reparentTo(self.camParent)
        camera.setPos(self.camOffset)
        self.__spawnCameraTask()
        self.toonRNGs = []
        for i in xrange(self.numPlayers):
            self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen))

        self.treasures = []
        for i in xrange(self.maze.numTreasures):
            self.treasures.append(MazeTreasure.MazeTreasure(self.treasureModel, self.maze.treasurePosList[i], i, self.doId))

        self.__loadSuits()
        for suit in self.suits:
            suit.onstage()

        self.sndTable = {'hitBySuit': [None] * self.numPlayers,
         'falling': [None] * self.numPlayers}
        for i in xrange(self.numPlayers):
            self.sndTable['hitBySuit'][i] = base.loadSfx('phase_4/audio/sfx/MG_Tag_C.ogg')
            self.sndTable['falling'][i] = base.loadSfx('phase_4/audio/sfx/MG_cannon_whizz.ogg')

        self.grabSounds = []
        for i in xrange(5):
            self.grabSounds.append(base.loadSfx('phase_4/audio/sfx/MG_maze_pickup.ogg'))

        self.grabSoundIndex = 0
        for avId in self.avIdList:
            self.toonHitTracks[avId] = Wait(0.1)

        self.scores = [0] * self.numPlayers
        self.goalBar = DirectWaitBar(parent=render2d, relief=DGG.SUNKEN, frameSize=(-0.35,
         0.35,
         -0.15,
         0.15), borderWidth=(0.02, 0.02), scale=0.42, pos=(0.84, 0, 0.5 - 0.28 * self.numPlayers + 0.05), barColor=(0, 0.7, 0, 1))
        self.goalBar.setBin('unsorted', 0)
        self.goalBar.hide()
        self.introTrack = self.getIntroTrack()
        self.introTrack.start()
        return
    def enterGameOver(self, winner, winnerDoId, allPrize):
        try:
            currentCamPos = base.camera.getPos(render)
            currentCamHpr = base.camera.getHpr(render)
            self.firstPerson.reallyEnd()
            base.camera.setPos(currentCamPos)
            base.camera.setHpr(currentCamHpr)
        except:
            pass

        DistributedMinigame.enterGameOver(self, winner, winnerDoId, allPrize)
 def load(self):
     self.createWorld()
     self.setMinigameMusic("phase_6/audio/bgm/GS_Race_SS.ogg")
     self.setDescription("Be the first to take 3 pictures of all the other Toons with your camera. " + \
         "Use WASD to move and the mouse to look around. Press the left mouse button to take a picture. " + \
         "Your camera takes some time to recharge after taking a picture. " + \
         "You know you have a good shot when the view finder is green!")
     self.setWinnerPrize(150)
     self.setLoserPrize(15)
     base.render.hide()
     base.setBackgroundColor(0, 0, 0)
     DistributedMinigame.load(self)
    def setGameStart(self, timestamp):
        if not self.hasLocalToon:
            return
        self.notify.debug('setGameStart')
        DistributedMinigame.setGameStart(self, timestamp)
        if self.introTrack.isPlaying():
            self.introTrack.finish()
        for avId in self.remoteAvIdList:
            toon = self.getAvatar(avId)
            if toon:
                toon.stopLookAround()

        self.gameFSM.request('play')
    def setGameStart(self, timestamp):
        if not self.hasLocalToon:
            return
        self.notify.debug('setGameStart')
        DistributedMinigame.setGameStart(self, timestamp)
        if self.introTrack.isPlaying():
            self.introTrack.finish()
        for avId in self.remoteAvIdList:
            toon = self.getAvatar(avId)
            if toon:
                toon.stopLookAround()

        self.gameFSM.request('play')
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.__defineConstants()
     mazeName = MazeGameGlobals.getMazeName(self.doId, self.numPlayers, MazeData.mazeNames)
     self.maze = Maze.Maze(mazeName)
     model = loader.loadModel('phase_3.5/models/props/mickeySZ')
     self.treasureModel = model.find('**/mickeySZ')
     model.removeNode()
     self.treasureModel.setScale(1.6)
     self.treasureModel.setP(-90)
     self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.ogg')
     self.toonHitTracks = {}
     self.scorePanels = []
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.__defineConstants()
     mazeName = MazeGameGlobals.getMazeName(self.doId, self.numPlayers, MazeData.mazeNames)
     self.maze = Maze.Maze(mazeName)
     model = loader.loadModel('phase_3.5/models/props/mickeySZ')
     self.treasureModel = model.find('**/mickeySZ')
     model.removeNode()
     self.treasureModel.setScale(1.6)
     self.treasureModel.setP(-90)
     self.music = base.loader.loadMusic('phase_4/audio/bgm/MG_toontag.ogg')
     self.toonHitTracks = {}
     self.scorePanels = []
 def disable(self):
     if self.thisPlayerWinsLbl:
         self.thisPlayerWinsLbl.destroy()
         self.thisPlayerWinsLbl = None
     base.camera.reparentTo(render)
     base.camera.setPos(0, 0, 0)
     base.camera.setHpr(0, 0, 0)
     if self.myRemoteAvatar:
         self.myRemoteAvatar.cleanup()
         del self.myRemoteAvatar
     self.firstPerson.cleanup()
     del self.firstPerson
     self.deleteWorld()
     base.camLens.setMinFov(CIGlobals.DefaultCameraFov / (4.0 / 3.0))
     DistributedMinigame.disable(self)
     return
    def load(self):
        self.hitEagleSfx = base.loadSfx(
            'phase_4/audio/sfx/AA_drop_anvil_miss.ogg')
        self.hitObstacleSfx = base.loadSfx(
            'phase_4/audio/sfx/MG_cannon_hit_tower.ogg')
        self.toonOof = base.loadSfx(
            'phase_5/audio/sfx/tt_s_ara_cfg_toonHit.ogg')
        self.cannonMoveSfx = base.loadSfx(
            'phase_4/audio/sfx/MG_cannon_adjust.ogg')
        self.cannonMoveSfx.setLoop(True)
        self.fallSfx = base.loadSfx(
            'phase_4/audio/sfx/MG_sfx_vine_game_fall.ogg')
        self.setMinigameMusic('phase_9/audio/bgm/CHQ_FACT_bg.mid')
        self.setDescription(
            'Shoot as many flying Legal Eagles as you can using your cannon. Use the arrow keys to aim your cannon and press the control key to fire.'
        )
        self.setWinnerPrize(175)
        self.setLoserPrize(20)
        base.setBackgroundColor(*self.bgColor)
        self.world = loader.loadModel(self.worldModelPath)
        for nodeName in self.nodesToStash:
            node = self.world.find('**/' + nodeName)
            node.removeNode()

        self.world.find('**/tt_m_ara_cfg_clump7:clump7').setY(30.0)
        self.world.find('**/tt_m_ara_cfg_eagleNest:eagleNest_mesh').setY(30.0)
        self.world.setColorScale(0.75, 0.75, 0.75, 1.0)
        self.world.reparentTo(base.render)
        self.world.setZ(-5.0)
        for i in range(len(self.platformPositions.keys())):
            platform = loader.loadModel('phase_9/models/cogHQ/platform1.bam')
            platform.find('**/platformcollision').removeNode()
            platform.reparentTo(render)
            platform.setPos(*self.platformPositions[i])
            self.platforms.append(platform)

        for triggerName in self.triggers:
            trigger = self.world.find('**/' + triggerName)
            trigger.setCollideMask(CIGlobals.WallBitmask)
            self.accept('enter' + triggerName, self.__handleHitWall)

        self.fog = Fog('DEagleGame-sceneFog')
        self.fog.setColor(*self.bgColor)
        self.fog.setExpDensity(0.01)
        render.setFog(self.fog)
        DistributedMinigame.load(self)
 def disable(self):
     if self.thisPlayerWinsLbl:
         self.thisPlayerWinsLbl.destroy()
         self.thisPlayerWinsLbl = None
     base.camera.reparentTo(render)
     base.camera.setPos(0, 0, 0)
     base.camera.setHpr(0, 0, 0)
     if self.myRemoteAvatar:
         self.myRemoteAvatar.cleanup()
         del self.myRemoteAvatar
     self.firstPerson.cleanup()
     del self.firstPerson
     self.levelLoader.unload()
     self.levelLoader.cleanup()
     del self.levelLoader
     base.camLens.setMinFov(CIGlobals.DefaultCameraFov / (4./3.))
     DistributedMinigame.disable(self)
Exemple #33
0
 def disable(self):
     for triggerName in self.triggers:
         self.ignore('enter' + triggerName)
     self.ignore('ToonCannon::ready')
     base.localAvatar.getGeomNode().show()
     base.localAvatar.showNametag3d()
     base.localAvatar.createChatInput()
     camera.reparentTo(render)
     camera.setPosHpr(0, 0, 0, 0, 0, 0)
     render.clearFog()
     self.triggers = None
     self.toonOof = None
     self.hitEagleSfx = None
     self.hitObstacleSfx = None
     self.cannonMoveSfx = None
     self.fallSfx = None
     self.cannons = None
     self.cannon = None
     if self.world:
         base.disableAndRemovePhysicsNodes(self.world)
         self.world.removeNode()
         self.world = None
     if self.world2:
         self.world2.removeNode()
         self.world2 = None
     self.worldModelPath = None
     self.nodesToStash = None
     if self.olc:
         self.olc.cleanup()
         self.olc = None
     self.round = None
     for platform in self.platforms:
         platform.removeNode()
     self.platforms = None
     self.cannonId = None
     self.cannonBarrel = None
     self.platformPositions = None
     base.setBackgroundColor(CIGlobals.DefaultBackgroundColor)
     self.bgColor = None
     DistributedMinigame.disable(self)
    def load(self):
        self.hitEagleSfx = base.loadSfx('phase_4/audio/sfx/AA_drop_anvil_miss.mp3')
        self.hitObstacleSfx = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_tower.mp3')
        self.toonOof = base.loadSfx('phase_5/audio/sfx/tt_s_ara_cfg_toonHit.mp3')
        self.cannonMoveSfx = base.loadSfx('phase_4/audio/sfx/MG_cannon_adjust.mp3')
        self.cannonMoveSfx.setLoop(True)
        self.fallSfx = base.loadSfx('phase_4/audio/sfx/MG_sfx_vine_game_fall.mp3')
        self.setMinigameMusic('phase_9/audio/bgm/CHQ_FACT_bg.mid')
        self.setDescription('Shoot as many flying Legal Eagles as you can using your cannon. Use the arrow keys to aim your cannon and press the control key to fire.')
        self.setWinnerPrize(60)
        self.setLoserPrize(20)
        base.setBackgroundColor(*self.bgColor)
        self.world = loader.loadModel(self.worldModelPath)
        for nodeName in self.nodesToStash:
            node = self.world.find('**/' + nodeName)
            node.removeNode()

        self.world.find('**/tt_m_ara_cfg_clump7:clump7').setY(30.0)
        self.world.find('**/tt_m_ara_cfg_eagleNest:eagleNest_mesh').setY(30.0)
        self.world.setColorScale(0.75, 0.75, 0.75, 1.0)
        self.world.reparentTo(base.render)
        self.world.setZ(-5.0)
        for i in range(len(self.platformPositions.keys())):
            platform = loader.loadModel('phase_9/models/cogHQ/platform1.bam')
            platform.find('**/platformcollision').removeNode()
            platform.reparentTo(render)
            platform.setPos(*self.platformPositions[i])
            self.platforms.append(platform)

        for triggerName in self.triggers:
            trigger = self.world.find('**/' + triggerName)
            trigger.setCollideMask(CIGlobals.WallBitmask)
            self.accept('enter' + triggerName, self.__handleHitWall)

        self.fog = Fog('DEagleGame-sceneFog')
        self.fog.setColor(*self.bgColor)
        self.fog.setExpDensity(0.01)
        render.setFog(self.fog)
        DistributedMinigame.load(self)
 def setGameReady(self):
     if not self.hasLocalToon:
         return
     self.notify.debug('setGameReady')
     if DistributedMinigame.setGameReady(self):
         return
     for avId in self.remoteAvIdList:
         toon = self.getAvatar(avId)
         if toon:
             toon.reparentTo(render)
             self.__placeToon(avId)
             toon.setAnimState('Happy', 1.0)
             toon.startSmooth()
             toon.startLookAround()
 def setGameReady(self):
     if not self.hasLocalToon:
         return
     self.notify.debug('setGameReady')
     if DistributedMinigame.setGameReady(self):
         return
     for avId in self.remoteAvIdList:
         toon = self.getAvatar(avId)
         if toon:
             toon.reparentTo(render)
             self.__placeToon(avId)
             toon.setAnimState('Happy', 1.0)
             toon.startSmooth()
             toon.startLookAround()
 def __init__(self, cr):
     DistributedMinigame.__init__(self, cr)
     self.platformPositions = {0: (-5, 0.5, -0.5),
      1: (-15, 0.5, -0.5),
      2: (5, 0.5, -0.5),
      3: (15, 0.5, -0.5)}
     self.fsm.addState(State('roundCountdown', self.enterRoundCountdown, self.exitRoundCountdown, ['play']))
     self.fsm.addState(State('roundOver', self.enterRoundOver, self.exitRoundOver, ['finalScores', 'roundCountdown']))
     self.fsm.addState(State('finalScores', self.enterFinalScores, self.exitFinalScores, ['gameOver']))
     self.fsm.getStateNamed('waitForOthers').addTransition('roundCountdown')
     self.fsm.getStateNamed('play').addTransition('roundOver')
     self.fsm.getStateNamed('gameOver').addTransition('finalScores')
     self.cannonFSM = ClassicFSM('Cannon', [State('off', self.enterOff, self.exitOff), State('control', self.enterControlCannon, self.exitControlCannon), State('fly', self.enterFly, self.exitFly)], 'off', 'off')
     self.cannonFSM.enterInitialState()
     self.hitEagleSfx = None
     self.toonOof = None
     self.cannonMoveSfx = None
     self.fallSfx = None
     self.bgColor = (0.05, 0.05, 0.05)
     self.cannonId = None
     self.cannonBarrel = '**/cannon'
     self.fog = None
     self.platforms = []
     self.round = 0
     self.world = None
     self.worldModelPath = 'phase_5/models/cogdominium/tt_m_ara_cfg_quadrant2.bam'
     self.nodesToStash = ['lights',
      'streamers',
      'tt_m_ara_cfg_girders2b:Rwall_col',
      'tt_m_ara_cfg_girders2b:Lwall_col']
     self.triggers = ['tt_m_ara_cfg_clump2:col_clump2',
      'tt_m_ara_cfg_clump4:col_clump4',
      'tt_m_ara_cfg_clump5:col_clump5',
      'tt_m_ara_cfg_clump6:col_clump6',
      'tt_m_ara_cfg_clump7:col_clump7',
      'tt_m_ara_cfg_base:ceiling_collision']
     return
 def exitPlay(self):
     self.cannonFSM.request('off')
     self.deleteTimer()
     DistributedMinigame.exitPlay(self)
 def playMinigameMusic(self):
     DistributedMinigame.playMinigameMusic(self)
     self.music.setVolume(0.3)
 def announceGenerate(self):
     DistributedMinigame.announceGenerate(self)
     base.localAvatar.disableChatInput()
     self.load()
 def exitPlay(self):
     self.cannonFSM.request('off')
     self.deleteTimer()
     DistributedMinigame.exitPlay(self)
 def announceGenerate(self):
     base.camLens.setMinFov(CIGlobals.GunGameFOV / (4./3.))
     self.load()
     DistributedMinigame.announceGenerate(self)
 def exitPlay(self):
     self.firstPerson.end()
     self.firstPerson.enableMouse()
     self.deleteTimer()
     DistributedMinigame.exitPlay(self)
 def exitFinalScores(self):
     if self.gameMode == GGG.GameModes.KOTH:
         self.finalScoreUI.destroy()
         print "I should've destroyed"
     else:
         DistributedMinigame.exitFinalScores(self)
Exemple #45
0
 def exitFinalScores(self):
     if self.gameMode == GGG.GameModes.KOTH:
         self.finalScoreUI.destroy()
     else:
         DistributedMinigame.exitFinalScores(self)
 def announceGenerate(self):
     DistributedMinigame.announceGenerate(self)
     base.localAvatar.disableChatInput()
     self.load()
Exemple #47
0
 def finalScores(self, avIdList, scoreList):
     if self.gameMode == GGG.GameModes.KOTH:
         self.finalScoreUI.start()
     else:
         DistributedMinigame.finalScores(self, avIdList, scoreList)
 def playMinigameMusic(self):
     DistributedMinigame.playMinigameMusic(self)
     self.music.setVolume(0.3)
Exemple #49
0
 def disable(self):
     for av in self.remoteAvatars:
         av.cleanup()
         del av
     self.remoteAvatars = None
     DistributedMinigame.disable(self)
 def handleDisabledAvatar(self, avId):
     hitTrack = self.toonHitTracks[avId]
     if hitTrack.isPlaying():
         hitTrack.finish()
     DistributedMinigame.handleDisabledAvatar(self, avId)
 def announceGenerate(self):
     base.camLens.setMinFov(CIGlobals.GunGameFOV / (4.0 / 3.0))
     self.load()
     DistributedMinigame.announceGenerate(self)
 def handleDisabledAvatar(self, avId):
     hitTrack = self.toonHitTracks[avId]
     if hitTrack.isPlaying():
         hitTrack.finish()
     DistributedMinigame.handleDisabledAvatar(self, avId)
Exemple #53
0
 def playMinigameMusic(self):
     DistributedMinigame.playMinigameMusic(self)