def playPlayerEnterIval(self):
        
        def conditionallyShowSwitchButton(self = self, enable = True):
            if enable and self.activity.activityFSM.state in [
                'WaitForEnough',
                'WaitToStart']:
                self.activity.teamActivityGui.enableSwitchButton()
            else:
                self.activity.teamActivityGui.disableSwitchButton()

        ival = Sequence(Func(self.disableWallCollisions), Func(conditionallyShowSwitchButton, self, False), self.player.getRunToStartPositionIval(), Func(conditionallyShowSwitchButton, self, True), Func(self.enableWallCollisions))
        self.playToonIval(base.localAvatar.doId, ival)
Exemple #2
0
 def startGame(self, firstMessage):
     self._presentGuiIval = ToontownIntervals.start(
         Sequence(ToontownIntervals.getPresentGuiIval(self._bossGui,
                                                      '',
                                                      startPos=(0, 0,
                                                                -0.15)),
                  Func(self.mazeMapGui.show),
                  ToontownIntervals.getPulseLargerIval(
                      self.mazeMapGui, '',
                      scale=self.mazeMapGui.getScale()),
                  Func(self.setMessage, firstMessage),
                  name='present_gui'))
 def load(self):
     DistributedPartyActivity.load(self)
     self.danceFloor = loader.loadModel(self.model)
     self.danceFloor.reparentTo(self.getParentNodePath())
     self.danceFloor.setPos(self.x, self.y, 0.0)
     self.danceFloor.setH(self.h)
     self.danceFloor.wrtReparentTo(render)
     self.sign.setPos(22, -22, 0)
     floor = self.danceFloor.find('**/danceFloor_mesh')
     self.danceFloorSequence = Sequence(Wait(0.3),
                                        Func(floor.setH, floor, 36))
     discoBall = self.danceFloor.find('**/discoBall_mesh')
     self.discoBallSequence = Parallel(
         discoBall.hprInterval(6.0, Vec3(360, 0, 0)),
         Sequence(
             discoBall.posInterval(3,
                                   Point3(0, 0, 1),
                                   blendType='easeInOut'),
             discoBall.posInterval(3,
                                   Point3(0, 0, 0),
                                   blendType='easeInOut')))
Exemple #4
0
 def showNumber(self):
     self.setHit(False)
     self._bossIconX.show()
     ToontownIntervals.cleanup('boss_code%i' % self._id)
     ToontownIntervals.start(
         Sequence(Parallel(
             ToontownIntervals.getPresentGuiIval(self._bossIcon,
                                                 '',
                                                 startPos=(0, 0, -0.15))),
                  Wait(1.0),
                  ToontownIntervals.getPulseLargerIval(self._bg, ''),
                  name='boss_code%i' % self._id))
Exemple #5
0
 def exitDown(self):
     self.root.setR(0.0)
     self.root.setH(0.0)
     self.targetDistance = 0.0
     self.targetFacing = 0.0
     self.currentT = 0.0
     self.setAlongSpline(0.0)
     self.clearHitInterval()
     startScale = self.hole.getScale()
     endScale = Point3(5, 5, 5)
     self.hitInterval = Sequence(LerpScaleInterval(self.hole, duration=0.175, scale=endScale, startScale=startScale, blendType='easeIn'), Parallel(SoundInterval(self.upSound, volume=0.6, node=self.actor, cutOff=PartyGlobals.PARTY_COG_CUTOFF), ActorInterval(self.actor, 'up', loop=0)), Func(self.actor.loop, 'idle'), LerpScaleInterval(self.hole, duration=0.175, scale=Point3(3, 3, 3), startScale=endScale, blendType='easeOut'))
     self.hitInterval.start()
 def stopAnimatedTile(self,x,y,now=None):
     tile = self.getTileFromPos(x,y)
     if tile:
         if tile.hasPythonTag("Seq") and now == None:
             sequence = tile.getPythonTag("Seq")
             sequence.pause()
             sequence = Sequence( Wait(.1), LerpPosQuatInterval(tile,.1,(x,y,0),(0,0,0),blendType='easeIn') )
             sequence.start()
             tile.setPythonTag("Seq",sequence)
         elif tile.hasPythonTag("Seq") and now != None:      
             sequence = tile.getPythonTag("Seq")
             sequence.pause()
 def poofBean(self, bean, beanAnim):
     if bean == None:
         self.notify.warning('poofBean, returning immediately as bean is None')
         return
     if bean.isEmpty():
         self.notify.warning('poofBean, returning immediately as bean is empty')
         return
     currentAlpha = bean.getColorScale()[3]
     currentScale = bean.getScale()
     poofAnim = Sequence(Parallel(LerpFunc(bean.setAlphaScale, fromData=currentAlpha, toData=0.0, duration=0.25), LerpFunc(bean.setScale, fromData=currentScale, toData=currentScale * 5.0, duration=0.25)), Func(bean.stash), Func(beanAnim.finish), Func(bean.setAlphaScale, currentAlpha), Func(bean.setScale, currentScale))
     poofAnim.start()
     return
    def load(self):
        self.notify.debug('load()')
        CogdoGameMovie.load(self)
        backgroundGui = loader.loadModel('phase_5/models/cogdominium/tt_m_gui_csa_flyThru')
        self.bg = backgroundGui.find('**/background')
        self.chatBubble = backgroundGui.find('**/chatBubble')
        self.chatBubble.setScale(6.5, 6.5, 7.3)
        self.chatBubble.setPos(0.32, 0, -0.78)
        self.bg.setScale(5.2)
        self.bg.setPos(0.14, 0, -0.6667)
        self.bg.reparentTo(aspect2d)
        self.chatBubble.reparentTo(aspect2d)
        self.frame = DirectFrame(geom=self.bg, relief=None, pos=(0.2, 0, -0.6667))
        self.bg.wrtReparentTo(self.frame)
        self.gameTitleText = DirectLabel(parent=self.frame, text=TTLocalizer.CogdoExecutiveSuiteTitle, scale=TTLocalizer.MRPgameTitleText * 0.8, text_align=TextNode.ACenter, text_font=getSignFont(), text_fg=(1.0, 0.33, 0.33, 1.0), pos=TTLocalizer.MRgameTitleTextPos, relief=None)
        self.chatBubble.wrtReparentTo(self.frame)
        self.frame.hide()
        backgroundGui.removeNode()
        self.toonDNA = ToonDNA.ToonDNA()
        self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14)
        self.toonHead = Toon.Toon()
        self.toonHead.setDNA(self.toonDNA)
        self.makeSuit('sc')
        self.toonHead.getGeomNode().setDepthWrite(1)
        self.toonHead.getGeomNode().setDepthTest(1)
        self.toonHead.loop('neutral')
        self.toonHead.setPosHprScale(-0.73, 0, -1.27, 180, 0, 0, 0.18, 0.18, 0.18)
        self.toonHead.reparentTo(hidden)
        self.toonHead.startBlink()
        self.clipPlane = self.toonHead.attachNewNode(PlaneNode('clip'))
        self.clipPlane.node().setPlane(Plane(0, 0, 1, 0))
        self.clipPlane.setPos(0, 0, 2.45)
        self._toonDialogueSfx = loader.loadSfx('phase_3.5/audio/dial/AV_dog_long.ogg')
        self._camHelperNode = NodePath('CamHelperNode')
        self._camHelperNode.reparentTo(render)
        dialogue = TTLocalizer.CogdoExecutiveSuiteIntroMessage

        def start():
            self.frame.show()
            base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0)

        def showShopOwner():
            self._setCamTarget(self._shopOwner, -10, offset=Point3(0, 0, 5))

        def end():
            self._dialogueLabel.reparentTo(hidden)
            self.toonHead.reparentTo(hidden)
            self.frame.hide()
            base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1)
            self._stopUpdateTask()

        self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Func(showShopOwner), ParallelEndTogether(camera.posInterval(self.cameraMoveDuration, Point3(8, 0, 13), blendType='easeInOut'), camera.hprInterval(0.5, self._camHelperNode.getHpr(), blendType='easeInOut')), Wait(self.introDuration), Func(end))
        self._startUpdateTask()
Exemple #9
0
    def __init__(self,
                 type,
                 index,
                 model,
                 collSolid,
                 motionPath=None,
                 motionPattern=None,
                 blendMotion=True,
                 instanceModel=True):
        self.type = type
        self.index = index
        name = 'CogdoFlyingObstacle-%s-%i' % (self.type, self.index)
        if instanceModel:
            self.model = NodePath(name)
            model.instanceTo(self.model)
        else:
            self.model = model
            self.model.setName(name)
        self.currentT = 0.0
        self.direction = 1.0
        self.collNode = None
        self._initCollisions(name, collSolid)
        self.motionPath = motionPath
        self.motionPattern = motionPattern
        self.motionSequence = None
        if blendMotion:
            blendType = 'easeInOut'
        else:
            blendType = 'noBlend'
        if motionPath is not None:

            def moveObstacle(value):
                self.motionPath.goTo(self.model, value)

            self.motionPath = Mopath.Mopath(name='obstacle-%i' % self.index)
            self.motionPath.loadNodePath(motionPath)
            dur = self.motionPath.getMaxT()
            self.motionSequence = Sequence(
                name='%s.obstacle-%i-motionSequence' %
                (self.__class__.__name__, self.index))
            movePart1 = LerpFunc(moveObstacle,
                                 fromData=0.0,
                                 toData=self.motionPath.getMaxT(),
                                 duration=dur,
                                 blendType=blendType)
            self.motionSequence.append(movePart1)
            if self.motionPattern == CogdoFlyingObstacle.MotionTypes.BackForth:
                movePart2 = LerpFunc(moveObstacle,
                                     fromData=self.motionPath.getMaxT(),
                                     toData=0.0,
                                     duration=dur,
                                     blendType=blendType)
                self.motionSequence.append(movePart2)
Exemple #10
0
    def on_button_press(self, button, cmd, event=None):
        def py_exec(command):
            exec(command)

        self.last_button_pressed = button
        button['state'] = DGG.DISABLED
        pos = button.get_pos()
        self.click_sound.play()
        Sequence(LerpPosInterval(button, 0.05, pos + _pos2d(0, 2)),
                 LerpPosInterval(button, 0.05, pos),
                 Func(button.configure, **{'state': DGG.NORMAL}),
                 Func(py_exec, cmd)).start()
Exemple #11
0
    def camInterval(self, cam, actor):
        inc = cam.getX(), cam.getY() + 10, cam.getZ()
        #print(inc)
        #maybe a list of numbers-- an array for x, y, z, a method (manX, manY, manZ) man = manipulate by +- int, ret that array which will be used
        #as the Point3 args. if args are NaN/0/null, just ret the xyz arr. will be used to get the last position args for after the sequence finalizes.
        intervalOne = cam.posInterval(4.0, Point3(inc))
        camSequence = Sequence(intervalOne)
        camSequence.append(Func(self.loadButtons, actor))

        #print(camSequence.__len__())

        camSequence.start()
Exemple #12
0
 def fade_screen(self, time=1.5, color=(0, 0, 0)):
     '''Turns the screen to 'color' then fades the color away in 'time' seconds'''
     startColor = self.fade_quad.get_color()
     if startColor[3] == 0.0:
         Sequence(
             Func(self.fade_quad.show),
             LerpColorInterval(nodePath=self.fade_quad,
                               duration=time,
                               color=(color[0], color[1], color[2], 1),
                               startColor=startColor),
         ).start()
     else:
         Sequence(
             Func(self.fade_quad.show),
             Wait(time * 0.1),
             LerpColorInterval(nodePath=self.fade_quad,
                               duration=time * 0.9,
                               color=(color[0], color[1], color[2], 0),
                               startColor=startColor,
                               blendType='easeIn'),
             Func(self.fade_quad.hide),
         ).start()
 def animateTile(self,x,y):
     """
     the floating animation of tiles.
     """
     Time = 2
     tile = self.getTileFromPos(x,y)
     if tile:
          if tile.getPythonTag("Seq").isPlaying() ==False:
             seq = Sequence( 
                     LerpPosInterval( tile, Time+(0.2*Time*random()),(x,y,.35),(x,y,0)  , blendType="easeInOut") ,  
                     LerpPosInterval( tile, Time+(0.2*Time*random()),(x,y, 0),(x,y,.35) , blendType="easeInOut")  )
             tile.setPythonTag("Seq", seq )
             seq.loop()  
Exemple #14
0
    def __hitSomething(self, hitNode):
        pos = self.gag.getPos(render)
        self.gag.removeNode()
        self.gag = None

        track = Sequence()
        enemy = self.arena.getEnemyByCollName(hitNode)

        if enemy:
            track.append(Func(enemy.takeDamage))

        track.append(PieThrow.getPieSplatInterval(pos, 'creampie'))
        return track
Exemple #15
0
 def fade(self, time=1.5):
     '''Turns rhe screen black then fades the black away in 'time' seconds'''
     startColor = self.black_quad.get_color()
     if startColor[3] == 0.0:
         Sequence(
             Func(self.black_quad.show),
             LerpColorInterval(nodePath=self.black_quad,
                               duration=time,
                               color=(0, 0, 0, 1),
                               startColor=startColor),
         ).start()
     else:
         Sequence(
             Func(self.black_quad.show),
             Wait(time * 0.1),
             LerpColorInterval(nodePath=self.black_quad,
                               duration=time * 0.9,
                               color=(0, 0, 0, 0),
                               startColor=startColor,
                               blendType='easeIn'),
             Func(self.black_quad.hide),
         ).start()
Exemple #16
0
 def acquireToon(self):
     self.toon.disableSmartCameraViews()
     self.toon.stopUpdateSmartCamera()
     camera.wrtReparentTo(render)
     self.toon.dropShadow.reparentTo(hidden)
     self.toon.startPosHprBroadcast(period=0.2)
     self.toonAcceleration = 0.0
     self.toonVelocity = 0.0
     self.topHeight = 0.0
     self.trampB = self.normalTrampB
     self.leavingTrampoline = False
     self.hopOnAnim = Sequence(Func(self.toon.b_setAnimState, 'jump', 1.0), Wait(0.4), PartyUtils.arcPosInterval(0.75, self.toon, Point3(0.0, 0.0, self.trampHeight), 5.0, self.tramp), Func(self.postHopOn))
     self.hopOnAnim.start()
Exemple #17
0
 def enterDanceMove(self, anim = ''):
     if self.lastAnim is None and anim == '':
         self.toon.loop('victory', fromFrame=98, toFrame=122)
     else:
         if anim == '':
             anim = self.lastAnim
         if anim in DanceReverseLoopAnims:
             self.danceMoveSequence = Sequence(self.toon.actorInterval(anim, loop=0), self.toon.actorInterval(anim, loop=0, playRate=-1.0))
             self.danceMoveSequence.loop()
         else:
             self.toon.loop(anim)
         self.lastAnim = anim
     return
Exemple #18
0
 def playFireSequence(self):
     self.smokeNode.reparentTo(self.barrelNode)
     self.smokeNode.setPos(0, 6, -3)
     self.smokeNode.setScale(0.5)
     self.smokeNode.wrtReparentTo(render)
     track = Sequence(
         Parallel(
             LerpScaleInterval(self.smokeNode, 0.5, 3),
             LerpColorScaleInterval(self.smokeNode, 0.5, Vec4(2, 2, 2, 0))),
         Func(self.smokeNode.reparentTo, hidden),
         Func(self.smokeNode.clearColorScale))
     base.playSfx(self.sndCannonFire)
     track.start()
Exemple #19
0
    def loadIntervals(self):
        # create an interval that updates the ideal key press rate for each stage
        self.updateIdealRateInterval = Sequence()
        # other code handles setting the initial ideal rate, so only add the
        # wait for the first state
        self.updateIdealRateInterval.append(
            Wait(PartyGlobals.TugOfWarTargetRateList[0][0]), )
        # for each stage after the first
        for i in range(1, len(PartyGlobals.TugOfWarTargetRateList)):
            duration = PartyGlobals.TugOfWarTargetRateList[i][0]
            idealRate = PartyGlobals.TugOfWarTargetRateList[i][1]
            # set ideal speed
            self.updateIdealRateInterval.append(
                Func(self.setIdealRate, idealRate))
            # add delay for stage's length or set last stage flag
            if i == (len(PartyGlobals.TugOfWarTargetRateList) - 1):
                self.updateIdealRateInterval.append(
                    Func(setattr, self, "allOutMode", True))
            else:
                self.updateIdealRateInterval.append(Wait(duration), )
        # create an interval that updates the local player's key press rate
        self.updateKeyPressRateInterval = Sequence(
            Wait(PartyGlobals.TugOfWarKeyPressUpdateRate),
            Func(self.updateKeyPressRate),
        )
        # create an interval that updates the local player's force and tells the
        # server
        self.reportToServerInterval = Sequence(
            Wait(PartyGlobals.TugOfWarKeyPressReportRate),
            Func(self.reportToServer),
        )

        self.setupInterval = Parallel()
        # run this even if the local toon is not playing
        self.globalSetupInterval = Sequence(
            Wait(PartyGlobals.TugOfWarReadyDuration +
                 PartyGlobals.TugOfWarGoDuration),
            Func(self.tightenRopes),
        )
        # only run this when a local toon is playing
        self.localSetupInterval = Sequence(
            Func(self.setStatus, TTLocalizer.PartyTugOfWarReady),
            Func(self.showStatus),
            Wait(PartyGlobals.TugOfWarReadyDuration),
            Func(base.playSfx, self.whistleSound),
            Func(self.setStatus, TTLocalizer.PartyTugOfWarGo),
            Wait(PartyGlobals.TugOfWarGoDuration),
            Func(self.enableKeys),
            Func(self.hideStatus),
            Func(self.updateIdealRateInterval.start),
            Func(self.updateKeyPressRateInterval.loop),
            Func(self.reportToServerInterval.loop),
        )

        # interval for playing the splash sound and showing the splash visual effect
        self.splashInterval = Sequence(
            Func(base.playSfx, self.splashSound),
            Func(self.splash.play),
        )
Exemple #20
0
    def loadIntervals(self):
        def prepareHeightText():
            self.heightText.node().setText(
                TTLocalizer.PartyTrampolineGetHeight % int(self.toon.getZ()))
            self.heightText.setZ(self.indicatorFactor * self.toon.getZ() +
                                 self.heightTextOffset)

        self.heightTextInterval = Sequence(
            Func(prepareHeightText),
            LerpFunc(self.heightText.setAlphaScale,
                     fromData=1.0,
                     toData=0.0,
                     duration=1.0))
Exemple #21
0
 def letterboxOn(self, t = 0.25, finishIval = None):
     self.noLetterbox()
     self.loadLetterbox()
     self.letterbox.unstash()
     if t == 0:
         self.letterboxBottom.setPos(0, 0, -1)
         self.letterboxTop.setPos(0, 0, 0.80000000000000004)
     else:
         self.letterboxIval = Sequence(Parallel(LerpPosInterval(self.letterboxBottom, t, pos = Vec3(0, 0, -1)), LerpPosInterval(self.letterboxTop, t, pos = Vec3(0, 0, 0.80000000000000004))), name = self.letterboxTaskName)
         if finishIval:
             self.letterboxIval.append(finishIval)
         
         self.letterboxIval.start()
    def showMoveControls(self):
        if self._moveKeys.isHidden() and not self._attackKeys.isHidden():
            self._moveKeys.show()

            taskMgr.remove(self._moveIvalName)
            
            Sequence(
                ToontownIntervals.getPulseLargerIval(self._moveKeys, "", scale = 0.15),
                Wait(PartyGlobals.CogActivityControlsShowTime),
                Func(self.hideMoveControls),
                name=self._moveIvalName,
                autoFinish=1
                ).start()
Exemple #23
0
    def contTunnel(self):
        self.auto_position_on_track -= 50
        position_on_track = self.auto_position_on_track
        print(str(int(position_on_track)) + '   ' + str(self.cue_zone))
        if int(position_on_track) in np.array(
                self.cue_zone):  #check for cue zone
            if not self.auto_restart:
                print('STOP!')
                self.tunnelMove.pause()
                self.auto_presentation = True
                # self.current_number_of_segments +=1
            else:
                self.auto_restart = True
                self.tunnelMove.resume()

        else:
            self.in_waiting_period = False
            self.auto_presentation = False

            # base.setBackgroundColor([1,0 , 0])
            if self.looking_for_a_cue_zone == False:
                self.looking_for_a_cue_zone = True
            if self.stim_started == True:
                self.stop_a_presentation()

            # This line uses slices to take the front of the list and put it on the
            # back. For more information on slices check the Python manual
            self.tunnel = self.tunnel[1:] + self.tunnel[0:1]

            # Set the front segment (which was at TUNNEL_SEGMENT_LENGTH) to 0, which
            # is where the previous segment started
            self.tunnel[0].setZ(0)
            # Reparent the front to render to preserve the hierarchy outlined above
            self.tunnel[0].reparentTo(render)
            # Set the scale to be apropriate (since attributes like scale are
            # inherited, the rest of the segments have a scale of 1)
            self.tunnel[0].setScale(.155, .155, .305)
            # Set the new back to the values that the rest of the segments have
            self.tunnel[3].reparentTo(self.tunnel[2])
            self.tunnel[3].setZ(-TUNNEL_SEGMENT_LENGTH)
            self.tunnel[3].setScale(1)

            # Set up the tunnel to move one segment and then call contTunnel again
            # to make the tunnel move infinitely
            self.tunnelMove = Sequence(
                LerpFunc(self.tunnel[0].setZ,
                         duration=TUNNEL_TIME,
                         fromData=0,
                         toData=TUNNEL_SEGMENT_LENGTH * .305),
                Func(self.contTunnel))
            self.tunnelMove.start()
Exemple #24
0
    def throwTeamInWater(self, losingTeam):
        self.notify.debug("throwTeamInWater( %s )" %
                          PartyGlobals.TeamActivityTeams.getString(losingTeam))
        splashSet = False
        for toonId in self.toonIds[losingTeam]:
            # throw toon in water
            self.fallenToons.append(toonId)
            toon = self.getAvatar(toonId)
            # getting a a crash of popping from empty list
            #fallenPosIndex = self.unusedFallenPositionsIndices.pop(0)
            fallenPosIndex = self.toonIds[losingTeam].index(toonId)
            if (fallenPosIndex < 0) or (fallenPosIndex >= 4):
                fallenPosIndex = 0
            newPos = self.fallenPositions[fallenPosIndex]

            # animate the toons falling into the water
            if self.toonIdsToAnimIntervals[toonId] is not None:
                if self.toonIdsToAnimIntervals[toonId].isPlaying():
                    self.toonIdsToAnimIntervals[toonId].finish()

            # Fall into water
            if toon:
                parallel = Parallel(
                    ActorInterval(actor=toon,
                                  animName='slip-forward',
                                  duration=2.0),
                    LerpPosInterval(toon,
                                    duration=2.0,
                                    pos=newPos,
                                    other=self.root),
                )
            else:
                self.notify.warning("toon %d is none, skipping slip-forward" %
                                    toonId)
                parallel = Parallel()

            # only setup splash for the first toon
            if not splashSet:
                splashSet = True
                parallel.append(self.splashInterval)

            if toon:
                self.toonIdsToAnimIntervals[toonId] = Sequence(
                    parallel,
                    Func(toon.loop, 'neutral'),
                )
            else:
                self.notify.warning(
                    "toon %d is none, skipping toon.loop(neutral)" % toonId)
                self.toonIdsToAnimIntervals[toonId] = parallel
            self.toonIdsToAnimIntervals[toonId].start()
Exemple #25
0
    def getIntroTrack(self):
        self.__cameraTask(None)
        origCamParent = camera.getParent()
        origCamPos = camera.getPos()
        origCamHpr = camera.getHpr()
        iCamParent = base.localAvatar.attachNewNode("iCamParent")
        iCamParent.setH(180)
        camera.reparentTo(iCamParent)
        toonHeight = base.localAvatar.getHeight()
        camera.setPos(0, -15, toonHeight * 3)
        camera.lookAt(0, 0, toonHeight / 2.0)
        iCamParent.wrtReparentTo(origCamParent)
        waitDur = 5.0
        lerpDur = 4.5
        lerpTrack = Parallel()
        startHpr = iCamParent.getHpr()
        startHpr.setX(PythonUtil.reduceAngle(startHpr[0]))
        lerpTrack.append(
            LerpPosHprInterval(
                iCamParent,
                lerpDur,
                pos=Point3(0, 0, 0),
                hpr=Point3(0, 0, 0),
                startHpr=startHpr,
                name=self.uniqueName("introLerpParent"),
            ))
        lerpTrack.append(
            LerpPosHprInterval(
                camera,
                lerpDur,
                pos=origCamPos,
                hpr=origCamHpr,
                blendType="easeInOut",
                name=self.uniqueName("introLerpCameraPos"),
            ))
        base.localAvatar.startLookAround()

        def cleanup(
            origCamParent=origCamParent,
            origCamPos=origCamPos,
            origCamHpr=origCamHpr,
            iCamParent=iCamParent,
        ):
            camera.reparentTo(origCamParent)
            camera.setPos(origCamPos)
            camera.setHpr(origCamHpr)
            iCamParent.removeNode()
            del iCamParent
            base.localAvatar.stopLookAround()

        return Sequence(Wait(waitDur), lerpTrack, Func(cleanup))
Exemple #26
0
 def addFirefly(self):
     pos1 = Point3(random.uniform(-50, 50), random.uniform(-100, 150),
                   random.uniform(-10, 80))
     dir = Vec3(random.uniform(-1, 1), random.uniform(-1, 1),
                random.uniform(-1, 1))
     dir.normalize()
     pos2 = pos1 + (dir * 20)
     fly = self.lightroot.attachNewNode(PandaNode("fly"))
     glow = fly.attachNewNode(PandaNode("glow"))
     dot = fly.attachNewNode(PandaNode("dot"))
     color_r = random.uniform(0.7, 1.0)
     color_g = 1.0
     color_b = 0.8
     fly.setShaderInput("lightcolor", color_r, color_g, color_b, 1.0)
     int1 = fly.posInterval(random.uniform(7, 12), pos1, pos2)
     int2 = fly.posInterval(random.uniform(7, 12), pos2, pos1)
     si1 = fly.scaleInterval(random.uniform(0.8, 1.5),
                             Point3(0.2, 0.2, 0.2), Point3(0.2, 0.2, 0.2))
     si2 = fly.scaleInterval(random.uniform(1.5, 0.8),
                             Point3(1.0, 1.0, 1.0), Point3(0.2, 0.2, 0.2))
     si3 = fly.scaleInterval(random.uniform(1.0, 2.0),
                             Point3(0.2, 0.2, 0.2), Point3(1.0, 1.0, 1.0))
     siseq = Sequence(si1, si2, si3)
     siseq.loop()
     siseq.setT(random.uniform(0, 1000))
     seq = Sequence(int1, int2)
     seq.loop()
     self.spheremodel.instanceTo(glow)
     self.spheremodel.instanceTo(dot)
     glow.setScale(self.fireflysize * 1.1)
     glow.hide(BitMask32(self.modelMask | self.plainMask))
     dot.setScale(0.6)
     dot.hide(BitMask32(self.modelMask | self.lightMask))
     dot.setColor(color_r, color_g, color_b, 1.0)
     self.fireflies.append(fly)
     self.sequences.append(seq)
     self.glowspheres.append(glow)
     self.scaleseqs.append(siseq)
    def lose_game(self, holeNP):
        toPos = holeNP.node().get_shape_pos(0)
        self.stop_game()

        Sequence(
            Parallel(
                LerpFunc(self.ballNP.set_x, fromData = self.ballNP.get_x(),
                         toData = toPos.get_x(), duration = .1),
                LerpFunc(self.ballNP.set_y, fromData = self.ballNP.get_y(),
                         toData = toPos.get_y(), duration = .1),
                LerpFunc(self.ballNP.set_z, fromData = self.ballNP.get_z(),
                         toData = self.ballNP.get_z() - .9, duration = .2)),
                Wait(1),
                Func(self.start_game)).start()
 def startActive(self):
     DistributedPartyTrampolineActivity.notify.debug('startActive')
     if self.toon != None and self.toon.doId == base.localAvatar.doId:
         base.setCellsAvailable(base.bottomCells, True)
         self.accept('arrow_left', self.onLeft)
         self.accept('arrow_left-up', self.onLeftUp)
         self.accept('arrow_right', self.onRight)
         self.accept('arrow_right-up', self.onRightUp)
         self.beginRoundInterval = Sequence(
             Func(self._showFlashMessage, TTLocalizer.PartyTrampolineReady),
             Wait(1.2),
             Func(self.flashMessage, TTLocalizer.PartyTrampolineGo),
             Func(self.beginRound))
         self.beginRoundInterval.start()
Exemple #29
0
 def irisOut(self, t = 0.5, finishIval = None):
     self.noTransitions()
     self.loadIris()
     self.loadFade()
     if t == 0:
         self.iris.detachNode()
         self.fadeOut(0)
     else:
         self.iris.reparentTo(aspect2d, FADE_SORT_INDEX)
         self.transitionIval = Sequence(LerpScaleInterval(self.iris, t, scale = 0.01, startScale = 0.17999999999999999), Func(self.iris.detachNode), Func(self.fadeOut, 0), name = self.irisTaskName)
         if finishIval:
             self.transitionIval.append(finishIval)
         
         self.transitionIval.start()
Exemple #30
0
 def hide(self):
     """
         hiding text animation
     """
     self.gui_node.hide()
     if self.anim is not None:
         self.anim.finish()
     self.anim = Sequence(
         LerpColorScaleInterval(self.gui_node,
                                0.2,
                                Vec4(1, 1, 1, 0),
                                Vec4(1),
                                blendType="easeInOut"))
     self.anim.start()