def loadBarrel(self):
        self.barrel = loader.loadModel('phase_4/models/cogHQ/gagTank')
        self.barrel.reparentTo(self)
        self.barrel.setH(self, 180)
        self.barrel.setScale(self.BARREL_SCALE)
        self.barrel.hide()

        dustCloud = DustCloud(fBillboard=0)
        dustCloud.setBillboardAxis(2.0)
        dustCloud.setZ(3)
        dustCloud.setScale(1.2)
        dustCloud.createTrack()
        Sequence(Func(dustCloud.reparentTo, self.barrel),
                 Parallel(dustCloud.track,
                          Func(self.barrel.show)),
                 Func(dustCloud.destroy)).start()
Esempio n. 2
0
    def showToonThrowingGag(self, heading, pos):
        gag = self.equippedGag
        if gag is None:
            return
        self.removeGag()
        tossTrack, flyTrack, object = self.getThrowInterval(
            gag, pos[0], pos[1], pos[2], heading, 0, 0)

        def matchRunningAnim(toon=self.toon):
            toon.playingAnim = None
            toon.setSpeed(toon.forwardSpeed, toon.rotateSpeed)

        newTossTrack = Sequence(tossTrack, Func(matchRunningAnim))
        throwTrack = Parallel(newTossTrack, flyTrack)
        throwTrack.start(0)
        return object
Esempio n. 3
0
 def turnAround(self, nextState, shouldMoveRight):
     if self.velocity[0] < 0 and shouldMoveRight:
         self.velocity[0] = -self.velocity[0]
     elif self.velocity[0] > 0 and not shouldMoveRight:
         self.velocity[0] = -self.velocity[0]
     self.movingRight = self.velocity[0] > 0
     if self.fishMoveSequence:
         self.fishMoveSequence.pause()
         self.fishMoveSequence.clearToInitial()
     animationToTurn = 'turn'
     if self.movingRight:
         animationToTurn = 'turnOpposite'
     durationOfFishTurn = self.myData['durationOfFishTurn']
     self.fishMoveSequence = Parallel(Sequence(Func(self.actor.changeAnimationTo, animationToTurn, False), Wait(durationOfFishTurn), Func(self.fsm.request, nextState)), Sequence(Wait(durationOfFishTurn * 0.33), Func(self.setXVelocity, 0.0), Wait(durationOfFishTurn * 0.66), Func(self.setXVelocity, self.velocity[0])), name='%s_turnAroundInterval' % self.getName())
     self.velocity[0] = -self.velocity[0]
     self.fishMoveSequence.start()
    def startMovie(self):
        self.movie = Sequence()
        for index in xrange(self.numPlayers):
            track = self.createOnePlayerSequence(index, 1.25)
            self.movie.append(track)
            self.movie.append(Wait(0.75))

        self.movie.append(Func(self.resultLabel.show))
        soundAndWait = Parallel()
        soundAndWait.append(Wait(2.0))
        if self.localAvatarWon:
            soundAndWait.append(SoundInterval(self.winVoteSfx))
        elif self.localAvatarLost:
            soundAndWait.append(SoundInterval(self.loseVoteSfx, duration=0.43))
        self.movie.append(soundAndWait)
        self.movie.start()
Esempio n. 5
0
 def showSplat(self):
     if self.kaboomTrack and self.kaboomTrack.isPlaying():
         self.kaboomTrack.finish()
     self.splat.reparentTo(render)
     self.splat.setPos(self.suit.getPos())
     self.splat.setZ(3)
     self.kaboomTrack = Parallel(
         SoundInterval(self.pieHitSound, volume=1.0),
         Sequence(
             Func(self.splat.showThrough),
             LerpScaleInterval(self.splat,
                               duration=0.5,
                               scale=1.75,
                               startScale=Point3(0.1, 0.1, 0.1),
                               blendType='easeOut'), Func(self.splat.hide)))
     self.kaboomTrack.start()
Esempio n. 6
0
    def enterWaitReward(self):
        self.scoreBoard.showBoardFinal()
        if self.curHoleDoId != 0:
            av = base.cr.doId2do.get(self.curHoleDoId)
        av.cleanupPowerBar()

        def doneWithRewardMovie():
            if self.exit == False:
                self.notify.debug('doneWithRewardMovie')
                self.sendUpdate('setDoneReward', [])
                self._destroyDelayDelete()
                self.exit = True

        self.golfRewardDialog = GolfRewardDialog.GolfRewardDialog(self.avIdList, self.trophiesList, self.rankingsList, self.holeBestList, self.courseBestList, self.cupList, self.localAvId, self.tieBreakWinner, self.aimTimesList)
        self.rewardIval = Sequence(Parallel(Wait(5), self.golfRewardDialog.getMovie()), Func(doneWithRewardMovie))
        self.rewardIval.start()
 def enterLeftDoorOpening(self, ts=0):
     if self.leftTrack:
         self.leftTrack.finish()
         self.leftTrack = None
     self.leftTrack = Sequence(
         Wait(0.5),
         Parallel(
             Func(self.toggleDoorHole, 'left', True),
             LerpQuatInterval(self.leftDoor,
                              duration=0.7,
                              quat=(self.getLeftDoorOpenH(), 0, 0),
                              startHpr=(self.getLeftDoorClosedH(), 0, 0),
                              blendType='easeInOut'),
             SoundInterval(self.doorOpenSound, node=self.leftDoor)))
     self.leftTrack.start()
     return
    def doCameraNPCInteraction(self):
        currCamPos = camera.getPos()
        currCamHpr = camera.getHpr()
        camera.setX(camera.getX() + 5)
        camera.setY(camera.getY() + 5)
        camera.headsUp(self)
        newCamPos = camera.getPos()
        newCamHpr = camera.getHpr()
        camera.setPos(currCamPos)
        camera.setHpr(currCamHpr)

        self.cameraTrack = Parallel(
            LerpPosInterval(camera, duration = 1.0, pos = newCamPos, startPos = currCamPos, blendType = 'easeOut'),
            LerpQuatInterval(camera, duration = 1.0, quat = newCamHpr, startHpr = currCamHpr, blendType = 'easeOut')
        )
        self.cameraTrack.start()
Esempio n. 9
0
 def move_camp_unit(self, sens):
     if self.nb_saves == 0 or self.nb_saves == 1: return
     if sens == 2:  #capture depuis le click souris
         if self.app.lst_arrows[2]["status"] == 2: sens = 0
         elif self.app.lst_arrows[3]["status"] == 2: sens = 1
         else: return
     pos_texts = [(0.3, 0, 0.2), (0, 0, 0), (0.3, 0, -0.5), (0.4, 0, -0.6),
                  (0.5, 0, -0.68)]
     scale_texts = [0.08, 0.1, 0.08, 0.07, 0.05]
     if sens == 0 and self.lst_menus[2] == (self.nb_saves - 1): return
     elif sens == 1 and self.lst_menus[2] == 0: return
     if sens == 0:
         if self.lst_menus[2] == 0: self.app.lst_arrows[3]["node"].show()
         if self.lst_menus[2] == (self.nb_saves - 2):
             self.app.lst_arrows[2]["node"].hide()
         if self.lst_menus[2] > 0:
             self.gui_saves[self.lst_menus[2] - 1][4].hide()
         if self.lst_menus[2] + 4 < self.nb_saves:
             self.gui_saves[self.lst_menus[2] + 4][4].show()
         self.arc_aux_menu.play("down")
         self.lst_menus[2] += 1
     elif sens == 1:
         if self.lst_menus[2] == 1: self.app.lst_arrows[3]["node"].hide()
         if self.lst_menus[2] == (self.nb_saves - 1):
             self.app.lst_arrows[2]["node"].show()
         if self.lst_menus[2] > 1:
             self.gui_saves[self.lst_menus[2] - 2][4].show()
         if self.lst_menus[2] + 3 < self.nb_saves:
             self.gui_saves[self.lst_menus[2] + 3][4].hide()
         self.arc_aux_menu.play("up")
         self.lst_menus[2] -= 1
     self.lst_gui["camp_frame"][10]["text"] = self.gui_saves[
         self.lst_menus[2]][2]
     self.lst_gui["camp_frame"][11]["text"] = self.gui_saves[
         self.lst_menus[2]][1]
     movePara = Parallel(name="texts_move")
     start = (1 if self.lst_menus[2] == 0 else 0)
     end = (self.nb_saves - self.lst_menus[2] + 1 if
            (self.nb_saves - self.lst_menus[2]) < 5 else 5)
     for it in range(start, end):
         movePara.append(self.gui_saves[self.lst_menus[2] - 1 + start +
                                        (it - start)][4].posInterval(
                                            0.2, Point3(pos_texts[it])))
         movePara.append(self.gui_saves[self.lst_menus[2] - 1 + start +
                                        (it - start)][4].scaleInterval(
                                            0.2, scale_texts[it]))
     movePara.start()
Esempio n. 10
0
    def showSuitsFalling(self, suits, ts, name, callback):
        if self.bossCog == None:
            return
        else:
            suitTrack = Parallel()
            delay = 0
            for suit in suits:
                suit.setState('Battle')
                if suit.dna.dept == 'l':
                    suit.reparentTo(self.bossCog)
                    suit.setPos(0, 0, 0)
                if suit in self.joiningSuits:
                    i = len(self.pendingSuits) + self.joiningSuits.index(suit)
                    destPos, h = self.suitPendingPoints[i]
                    destHpr = VBase3(h, 0, 0)
                else:
                    destPos, destHpr = self.getActorPosHpr(suit, self.suits)
                startPos = destPos + Point3(
                    0, 0, SuitTimings.fromSky * ToontownGlobals.SuitWalkSpeed)
                self.notify.debug('startPos for %s = %s' % (suit, startPos))
                suit.reparentTo(self)
                suit.setPos(startPos)
                suit.headsUp(self)
                moveIval = Sequence()
                chairInfo = self.bossCog.claimOneChair()
                if chairInfo:
                    moveIval = self.createDinerMoveIval(
                        suit, destPos, chairInfo)
                suitTrack.append(
                    Track((delay, Sequence(moveIval,
                                           Func(suit.loop, 'neutral')))))
                delay += 1

            if self.hasLocalToon():
                camera.reparentTo(self)
                self.notify.debug('self.battleSide =%s' % self.battleSide)
                camHeading = -20
                camX = -4
                if self.battleSide == 0:
                    camHeading = 20
                    camX = 4
                camera.setPosHpr(camX, -15, 7, camHeading, 0, 0)
            done = Func(callback)
            track = Sequence(suitTrack, done, name=name)
            track.start(ts)
            self.storeInterval(track, name)
            return
Esempio n. 11
0
    def startAction(self, action):
        cur_action = self.cur_action
        rotation = self.actions[cur_action].rotation
        self.cur_action = action
        paction = self.actions[action]
        if cur_action != "stand":
            diff = self.joint.getPos(render) - paction.diff
        else:
            diff = self.actor.getPos()

        if self.print_action:
            print paction.name,

        interval = self.actor.actorInterval(paction.name)
        func = Func(self.reposition, diff, rotation)
        self.sequence = Parallel(Sequence(Wait(0.001), func), interval)
        self.sequence.start()
Esempio n. 12
0
 def showGrab(self):
     self.nodePath.hide()
     self.collNodePath.hide()
     # disable collisions
     self.collNode.setIntoCollideMask(BitMask32(0))
     if self.penalty:
         self.track = Parallel(
             SoundInterval(self.penaltyGrabSound),
             Sequence(
                 Func(self.kaboom.showThrough),
                 LerpScaleInterval(self.kaboom,
                                   duration=0.5,
                                   scale=Point3(10, 10, 10),
                                   blendType='easeOut'),
                 Func(self.kaboom.hide),
             ))
         self.track.start()
 def release(self):
     if self.isLocal():
         self.startTimeout()
         self.resetCrashEffect()
     LocationGag.release(self)
     self.build()
     self.isDropping = True
     actorTrack = LocationGag.getActorTrack(self)
     self.fallSoundInterval = LocationGag.getSoundTrack(self)
     if actorTrack:
         actorTrack.append(Func(self.startDrop))
         actorTrack.start()
         self.fallSoundInterval.append(
             Parallel(SoundInterval(self.fallSfx, node=self.avatar)))
         self.fallSoundInterval.start()
     if self.isLocal():
         base.localAvatar.sendUpdate('usedGag', [self.id])
Esempio n. 14
0
 def getAvatarEnterTrack(self, av):
     track = Sequence(name = av.uniqueName('avatarEnterDoorTrack'))
     track.append(Func(av.setAnimState, 'walkBack'))
     track.append(
         ParallelEndTogether(
             LerpPosInterval(
                 av,
                 duration = 0.5,
                 blendType = 'easeInOut',
                 pos = self.enterWalkBackPos,
                 startPos = av.getPos(render)
             ),
             LerpQuatInterval(
                 av,
                 duration = 0.5,
                 hpr = self.doorNode.getHpr(render),
                 startHpr = av.getHpr(render)
             )
         )
     )
     track.append(Func(av.setPlayRate, 1.0, 'walk'))
     track.append(Func(av.loop, 'neutral'))
     track.append(Wait(1.0))
     track.append(Func(av.loop, 'walk'))
     parallel = Parallel()
     parallel.append(
         LerpPosInterval(
             av,
             duration = 1.0,
             blendType = 'easeInOut',
             pos = self.enterWalkInPos,
             startPos = self.enterWalkBackPos
         )
     )
     if base.localAvatar.doId == av.doId:
         parallel.append(LerpPosHprInterval(nodePath = camera, other = av, duration = 1.0,
                                            pos = (0, -8, av.getHeight()), hpr = (0, 0, 0),
                                            blendType = 'easeInOut'))
         parallel.append(Sequence(Wait(0.5), Func(self.sendGoingIn), Wait(1.0)))
     track.append(parallel)
     if base.localAvatar.doId == av.doId:
         track.append(Func(self.sendWentInDoor))
     track.setDoneEvent(track.getName())
     track.delayDelete = DelayDelete.DelayDelete(av, track.getName())
     self.acceptOnce(track.getDoneEvent(), self.__avatarTrackDone, [track])
     return track
    def __shrinkLoadingBar(self):
        if self.__isValidDownloadBar():
            ivalDuration = 0.5
            barPosIval = LerpPosInterval(self.bar, ivalDuration, (-0.81, 0, -0.96))
            barScaleIval = LerpScaleInterval(self.bar, ivalDuration, (0.25, 0.25, 0.25))

            def posText(pos):
                self.bar['text_pos'] = (0, pos)

            def scaleText(scale):
                self.bar['text_scale'] = (scale, scale)

            textScaleIval = LerpFunc(scaleText, fromData=0.08, toData=0.16, duration=ivalDuration)
            textPosIval = LerpFunc(posText, fromData=-0.035, toData=-0.05, duration=ivalDuration)
            shrinkIval = Parallel(barPosIval, barScaleIval, textPosIval, textScaleIval, Func(self.loadingText.hide))
            self.hideBlockerIval = Sequence(shrinkIval, Wait(0.5), Func(self.__hideBlocker), Func(self.__resetLoadingBar), Func(self.destroy))
            self.hideBlockerIval.start()
    def doHit(self):
        self.cleanupHit()
        if not self.headActor:
            return

        self.hitInterval = Sequence(
            Parallel(
                Sequence(
                    Func(self.headActor.setColorScale, 1, 1, 1, 1),
                    self.headActor.colorScaleInterval(0.1, colorScale=VBase4(1, 0, 0, 1)),
                    self.headActor.colorScaleInterval(0.3, colorScale=VBase4(1, 1, 1, 1))
                ),
                ActorInterval(self.headActor, 'turn2Fb')
            ),
            Func(self.headActor.loop, 'Ff_neutral')
        )
        self.hitInterval.start()
Esempio n. 17
0
 def onShipDamaged(self, wasGrapeshot = False):
     if wasGrapeshot:
         shakeDelta = 0.050000000000000003
         randomX = random.random() * 2 * shakeDelta - shakeDelta
         randomZ = random.random() * 2 * shakeDelta - shakeDelta
         if self.shakeSequence.isPlaying():
             self.shakeSequence.finish()
         
         self.shakeSequence = Parallel(Sequence(LerpColorScaleInterval(self, duration = 0.5, colorScale = (1.0, 0.20000000000000001, 0.20000000000000001, 1.0)), LerpColorScaleInterval(self, duration = RepairGlobals.Common.guiShakeCooldownTime / 2.0, colorScale = (1.0, 1.0, 1.0, 1.0))), Sequence(LerpPosInterval(self, duration = 0.10000000000000001, pos = self.getPos() - (randomX, 0.0, randomZ)), LerpPosInterval(self, duration = 0.20000000000000001, pos = self.getPos() + (randomX, 0.0, randomZ)), LerpPosInterval(self, duration = 0.10000000000000001, pos = self.getPos()), Wait(RepairGlobals.Common.guiShakeCooldownTime)), name = 'RepairGameGUI.shakeSequence')
         self.shakeSequence.start()
     else:
         shakeDelta = 0.025000000000000001
         randomX = random.random() * 2 * shakeDelta - shakeDelta
         randomZ = random.random() * 2 * shakeDelta - shakeDelta
         if not self.shakeSequence.isPlaying():
             self.shakeSequence = Sequence(LerpPosInterval(self, duration = 0.10000000000000001, pos = self.getPos() - (randomX, 0.0, randomZ)), LerpPosInterval(self, duration = 0.20000000000000001, pos = self.getPos() + (randomX, 0.0, randomZ)), LerpPosInterval(self, duration = 0.10000000000000001, pos = self.getPos()), Wait(RepairGlobals.Common.guiShakeCooldownTime), name = 'RepairGameGUI.shakeSequence')
             self.shakeSequence.start()
Esempio n. 18
0
    def enterBiting(self):
        self.fish.startBiteBubbleEffect()
        if self.fish.myData['size'] == 'small':
            biteSFX = self.fish.fishManager.gameObject.sfx['biteSmall']
        elif self.fish.myData['size'] == 'medium':
            biteSFX = self.fish.fishManager.gameObject.sfx['biteSmall']
        elif self.fish.myData['size'] == 'large':
            biteSFX = self.fish.fishManager.gameObject.sfx['biteLarge']
        elif self.fish.myData['size'] == 'super':
            biteSFX = self.fish.fishManager.gameObject.sfx['biteLarge']

        if self.fish.getX() < self.fish.fishManager.gameObject.lure.getX():
            self.fish.actor.changeAnimationTo('bite', False)
            biteOffset = self.fish.mouthJoint.getPos(
            ) * -1.0 * self.fish.actor.getSx()
        else:
            self.fish.actor.changeAnimationTo('biteOpposite', False)
            biteOffset = self.fish.mouthJoint.getPos(
            ) * -1.0 * self.fish.actor.getSx()
        self.fish.fishManager.activeFish = self.fish
        if self.fish.fishMoveSequence:
            self.fish.fishMoveSequence.pause()

        biteDuration = 1.083
        self.fish.fishManager.gameObject.lureAngle = 0
        self.fish.wrtReparentTo(self.fish.fishManager.gameObject.lure)
        self.fish.fishStatusIconNodePath.setScale(1.0)
        (self.fish.fishStatusIconNodePath.show(), )
        self.fish.fishStatusIconTextNode.setText('?')
        self.fish.fishStatusIconTextNode.setTextColor(1.0, 1.0, 0.0, 1.0)
        self.fish.fishManager.gameObject.sfx['biteAlert'].play()
        self.fish.fishManager.gameObject.scareFish = False
        self.fish.fishMoveSequence = Sequence(Parallel(
            Sequence(
                Wait(biteDuration * FishingGlobals.biteWindowStartPercentage),
                Func(self.checkForBite),
                Func(self.fish.fishStatusIconNodePath.show),
                Func(self.fish.fishStatusIconTextNode.setText, '!'),
                Func(self.fish.fishStatusIconTextNode.setTextColor, 0.0, 1.0,
                     0.0, 1.0), Func(base.playSfx, biteSFX),
                Wait(biteDuration * FishingGlobals.biteWindowFinishPercentage),
                Func(self.fish.fishManager.gameObject.checkForHooked)),
            self.fish.posInterval(biteDuration / 2.0, biteOffset)),
                                              name='%s_MoveSequence' %
                                              self.fish.getName())
        self.fish.fishMoveSequence.start()
Esempio n. 19
0
 def showKaboom(self):
     if self.kaboomTrack and self.kaboomTrack.isPlaying():
         self.kaboomTrack.finish()
     self.kaboom.reparentTo(render)
     self.kaboom.setPos(self.suit.getPos())
     self.kaboom.setZ(3)
     self.kaboomTrack = Parallel(
         SoundInterval(self.kaboomSound, volume=0.5),
         Sequence(
             Func(self.kaboom.showThrough),
             LerpScaleInterval(self.kaboom,
                               duration=0.5,
                               scale=Point3(10, 10, 10),
                               startScale=Point3(1, 1, 1),
                               blendType='easeOut'),
             Func(self.kaboom.hide)))
     self.kaboomTrack.start()
	def _afterShootTrackDone(self):
		self.track = None
		self.track = Parallel(
			Sequence(
				LerpQuatInterval(self.cannon.find('**/cannon'), duration = 3, quat = (60, 0, 0),
					startHpr = Vec3(-60, 0, 0), blendType = 'easeInOut'),
				LerpQuatInterval(self.cannon.find('**/cannon'), duration = 3, quat = (-60, 0, 0),
					startHpr = Vec3(60, 0, 0), blendType = 'easeInOut'),
			),
			Sequence(
				LerpQuatInterval(self.cannon.find('**/square_drop_shadow'), duration = 3, quat = (60, 0, 0),
					startHpr = Vec3(-60, 0, 0), blendType = 'easeInOut'),
				LerpQuatInterval(self.cannon.find('**/square_drop_shadow'), duration = 3, quat = (-60, 0, 0),
					startHpr = Vec3(60, 0, 0), blendType = 'easeInOut'),
			)
		)
		self.track.loop()
 def serveFood(self, food, chairIndex):
     self.removeFoodModel(chairIndex)
     serviceLoc = self.serviceLocs.get(chairIndex)
     if not food or food.isEmpty():
         foodModel = loader.loadModel('phase_12/models/bossbotHQ/canoffood')
         foodModel.setScale(ToontownGlobals.BossbotFoodModelScale)
         foodModel.reparentTo(serviceLoc)
     else:
         food.wrtReparentTo(serviceLoc)
         tray = food.find('**/tray')
         if not tray.isEmpty():
             tray.hide()
         ivalDuration = 1.5
         foodMoveIval = Parallel(SoundInterval(self.serveFoodSfx, node=food), ProjectileInterval(food, duration=ivalDuration, startPos=food.getPos(serviceLoc), endPos=serviceLoc.getPos(serviceLoc)), LerpHprInterval(food, ivalDuration, Point3(0, -360, 0)))
         intervalName = 'serveFood-%d-%d' % (self.index, chairIndex)
         foodMoveIval.start()
         self.activeIntervals[intervalName] = foodMoveIval
Esempio n. 22
0
    def onSetAction(self, action):
        self.model.show()

        self.avatar.doingActivity = False

        if action == self.StateThrow:

            self.avatar.doingActivity = True
            
            time = 0.0#3.0 * 0.667
            sf = self.ThrowObjectFrame#0

            self.setAnimTrack(
                Parallel(self.getAnimationTrack('throw-object', startFrame=sf,
                                       playRate=(self.PlayRate * self.ReleasePlayRateMultiplier), fullBody = False),
                         Sequence(Wait(time), Func(self.model.hide))),
                startNow = True)
Esempio n. 23
0
 def enterAnim(self):
     if self.gameObject.gameBoard.pieceNotDropped:
         self.gameObject.gameBoard.pieceNotDropped = False
         base.playSfx(self.Sfxs['NoDrop'])
     
     if len(self.gameObject.animationList) > 0:
         if self.gameObject.gameBoard.pieceDropped:
             self.gameObject.gameBoard.pieceDropped = False
             self.gameObject.animationList.append(Sequence(Wait(0.29999999999999999), Func(self.playDrop)))
         
         if self.gameObject.gameBoard.delayDropped:
             self.gameObject.gameBoard.delayDropped = False
             self.gameObject.animationList.append(Sequence(Wait(0.80000000000000004), Func(self.playSoftDrop)))
         
         if self.gameObject.gameBoard.pieceFlipped:
             self.gameObject.gameBoard.pieceFlipped = False
             base.playSfx(self.Sfxs['Flip'])
         
         if self.gameObject.gameBoard.experementMatched:
             self.gameObject.gameBoard.experementMatched = False
             base.playSfx(self.Sfxs['Fill'])
         
         if self.gameObject.gameBoard.experementFailed:
             self.gameObject.gameBoard.experementFailed = False
             base.playSfx(self.Sfxs['Wrong'])
         
         if self.gameObject.soulMade:
             self.gameObject.soulMade = False
             self.gameObject.animationList.append(Sequence(Wait(0.10000000000000001), Func(self.playSoulMade)))
         
         if self.gameObject.soulMatch:
             self.gameObject.soulMatch = False
             self.gameObject.animationList.append(Sequence(Wait(0.10000000000000001), Func(self.playSoulMatch)))
         
         if self.matchMade:
             self.matchMade = False
             self.gameObject.animationList.append(Sequence(Wait(0.10000000000000001), Func(self.playMatch)))
         
         if self.ingredientMade:
             self.ingredientMade = False
             self.gameObject.animationList.append(Sequence(Wait(0.10000000000000001), Func(self.playFill)))
         
         self.animSeq = Sequence(Parallel(*self.gameObject.animationList), Func(self.request, 'Eval'))
         self.animSeq.start()
     else:
         self.demand('Eval')
Esempio n. 24
0
 def dropBoard(self):
     board = self.currentBoard
     boardIndex = self.currentBoardIndex
     self.dropBoardSequence = Sequence(
         Parallel(
             Sequence(Func(self.boardDestroyedLabel.unstash), Wait(1.5),
                      Func(self.boardDestroyedLabel.stash)),
             Sequence(
                 Wait(0.5), Func(self.boardDestroyed.play),
                 Func(self.sawingLine.reset),
                 LerpPosInterval(board,
                                 duration=self.config.splitBoardAnimTime,
                                 pos=Point3(0.0, 0.0, -2.0)),
                 Func(board.stash), Wait(0.5), Func(self.loadNewBoard),
                 Func(self.addBoardBackToPool, board, boardIndex))),
         name='RepairSawGame.dropBoardSequence')
     self.dropBoardSequence.start()
Esempio n. 25
0
 def fireWater(self, origin, target):
     color = VBase4(0.75, 0.75, 1, 0.8)
     dScaleUp = 0.1
     dHold = 0.3
     dScaleDown = 0.1
     horizScale = 0.1
     vertScale = 0.1
     sprayTrack = self.getSprayTrack(color, origin, target, dScaleUp, dHold,
                                     dScaleDown, horizScale, vertScale)
     duration = self.squirtSfx.length()
     if sprayTrack.getDuration() < duration:
         duration = sprayTrack.getDuration()
     soundTrack = SoundInterval(self.squirtSfx,
                                node=self.waterPitcherModel,
                                duration=duration)
     self.fireTrack = Parallel(sprayTrack, soundTrack)
     self.fireTrack.start()
    def generateToonJumpTrack(self, av, seatIndex):
        av.pose('sit', 47)
        hipOffset = av.getHipsParts()[2].getPos(av)

        def getToonJumpTrack(av, seatIndex):

            def getJumpDest(av = av, node = self.golfKart):
                dest = Point3(0, 0, 0)
                if hasattr(self, 'golfKart') and self.golfKart:
                    dest = Vec3(self.golfKart.getPos(av.getParent()))
                    seatNode = self.golfKart.find('**/seat' + str(seatIndex + 1))
                    dest += seatNode.getPos(self.golfKart)
                    dna = av.getStyle()
                    dest -= hipOffset
                    if seatIndex < 2:
                        dest.setY(dest.getY() + 2 * hipOffset.getY())
                    dest.setZ(dest.getZ() + 0.1)
                else:
                    self.notify.warning('getJumpDestinvalid golfKart, returning (0,0,0)')
                return dest

            def getJumpHpr(av = av, node = self.golfKart):
                hpr = Point3(0, 0, 0)
                if hasattr(self, 'golfKart') and self.golfKart:
                    hpr = self.golfKart.getHpr(av.getParent())
                    if seatIndex < 2:
                        hpr.setX(hpr.getX() + 180)
                    else:
                        hpr.setX(hpr.getX())
                    angle = PythonUtil.fitDestAngle2Src(av.getH(), hpr.getX())
                    hpr.setX(angle)
                else:
                    self.notify.warning('getJumpHpr invalid golfKart, returning (0,0,0)')
                return hpr

            toonJumpTrack = Parallel(ActorInterval(av, 'jump'), Sequence(Wait(0.43), Parallel(LerpHprInterval(av, hpr=getJumpHpr, duration=0.9), ProjectileInterval(av, endPos=getJumpDest, duration=0.9))))
            return toonJumpTrack

        def getToonSitTrack(av):
            toonSitTrack = Sequence(ActorInterval(av, 'sit-start'), Func(av.loop, 'sit'))
            return toonSitTrack

        toonJumpTrack = getToonJumpTrack(av, seatIndex)
        toonSitTrack = getToonSitTrack(av)
        jumpTrack = Sequence(Parallel(toonJumpTrack, Sequence(Wait(1), toonSitTrack)))
        return jumpTrack
Esempio n. 27
0
 def doSplat(self):
     if self.splatTrack and self.splatTrack.isPlaying():
         self.splatTrack.finish()
     self.splat.reparentTo(render)
     self.splat.setPos(self.object, 0, 0, 3.0)
     self.splat.setY(self.splat.getY() - 1.0)
     self._splatSfxIval.node = self.splat
     self.splatTrack = Parallel(
         self._splatSfxIval,
         Sequence(
             Func(self.splat.showThrough),
             LerpScaleInterval(self.splat,
                               duration=0.5,
                               scale=6,
                               startScale=1,
                               blendType='easeOut'), Func(self.splat.hide)))
     self.splatTrack.start()
    def createOnePlayerSequence(self, index, duration):
        numVotes = self.votes[index]
        direction = self.directions[index]

        def ticketTicker(t, label = self.entryList[index][direction + 1], startVotes = 0, endVotes = numVotes):
            label['text'] = str(int(t * endVotes + startVotes))

        track = Parallel()
        startVotes = 0
        for prev in range(index):
            if self.directions[prev] == direction:
                startVotes += self.votes[prev]

        def totalTicker(t, label = self.totalVotesLabels[direction], startVotes = startVotes, additionalVotes = numVotes):
            label['text'] = str(int(t * additionalVotes + startVotes))

        track.append(LerpFunc(totalTicker, duration=duration, name='countTotal %d' % index))
        if self.avVotesLabel.has_key(index):

            def avVotesTicker(t, label = self.avVotesLabel[index], startVotes = 0, endVotes = numVotes, direction = direction):
                oldValue = label['text']
                newValue = int(t * endVotes + startVotes)
                label['text'] = str(newValue)
                if not oldValue == label['text']:
                    if newValue:
                        if direction == 0:
                            self.upArrowSfx[self.curArrowSfxIndex].play()
                        else:
                            self.downArrowSfx[self.curArrowSfxIndex].play()
                            self.curArrowSfxIndex += 1
                        if self.curArrowSfxIndex >= len(self.upArrowSfx):
                            self.curArrowSfxIndex = 0

            label = self.avVotesLabel[index]
            track.append(Func(self.avVotesLabel[index].show, name='showName %d' % index))
            if self.avArrows.has_key(index):
                track.append(Func(self.avArrows[index].show, name='showArrow %d' % index))
            if direction == 0 and numVotes:
                pass
            elif direction == 1 and numVotes:
                pass
            else:
                track.append(SoundInterval(self.noVoteSfx))
            track.append(LerpFunc(avVotesTicker, duration=duration, name='countAvVotes %d' % index))
        return track
Esempio n. 29
0
    def draw(self):
        if self.isClickable():
            foreground, background = self.whisperColor[self.clickState]
        else:
            foreground, background = self.whisperColor[PGButton.SInactive]
        self.chatBalloon = ChatBalloon(NametagGlobals.chatBalloon2dModel,
                                       NametagGlobals.chatBalloon2dWidth,
                                       NametagGlobals.chatBalloon2dHeight,
                                       self.textNode,
                                       foreground=foreground,
                                       background=background)
        self.chatBalloon.reparentTo(self.contents)

        # Calculate the center of the TextNode:
        left, right, bottom, top = self.textNode.getFrameActual()
        center = self.contents.getRelativePoint(self.chatBalloon.textNodePath,
                                                ((left + right) / 2.0, 0,
                                                 (bottom + top) / 2.0))

        # Translate the chat balloon along the inverse:
        self.chatBalloon.setPos(self.chatBalloon, -center)

        # Draw the quit button:
        self.quitButton = WhisperQuitButton(self)
        quitButtonNodePath = self.contents.attachNewNode(self.quitButton)

        # Move the quit button to the top right of the TextNode:
        quitButtonNodePath.setPos(
            self.contents.getRelativePoint(self.chatBalloon.textNodePath,
                                           (right, 0, top)))

        # Apply the quit button shift:
        quitButtonNodePath.setPos(quitButtonNodePath, self.QUIT_BUTTON_SHIFT)

        # Allow the quit button to close this whisper:
        self.quitButton.setClickEvent(self.quitEvent)

        Parallel(
            LerpColorScaleInterval(self.contents, .2, VBase4(1, 1, 1, 1),
                                   VBase4(1, 1, 1, 0)),
            Sequence(
                LerpScaleInterval(self.contents, .2,
                                  (self.CONTENTS_SCALE + 0.01), (0)),
                LerpScaleInterval(self.contents, .09,
                                  (self.CONTENTS_SCALE)))).start()
Esempio n. 30
0
    def doLipstick(self, target):
        dScale = 0.5
        tLips = 2.5
        animDuration = base.localAvatar.getDuration(self.avAnim)
        tThrow = 115.0 / base.localAvatar.getFrameRate(self.avAnim)

        def doHeal():
            if self.isLocal():
                self.setHealAmount()
                self.healAvatar(target, 'conked')
                base.localAvatar.sendUpdate('gagRelease', [self.getID()])
            else:
                Func(target.play, 'conked').start()

        self.placeProp(self.handJoint, self.gag, Point3(-0.27, -0.24, -0.95),
                       Point3(-118, -10.6, -25.9))
        stickScaleUp = self.getScaleTrack([self.gag], dScale,
                                          GagGlobals.PNT3NEAR0,
                                          GagGlobals.PNT3NORMAL)
        stickScaleDn = self.getScaleTrack([self.gag], dScale,
                                          GagGlobals.PNT3NORMAL,
                                          GagGlobals.PNT3NEAR0)
        stickTrack = Sequence(stickScaleUp, Wait(animDuration - 2.0 * dScale),
                              stickScaleDn)

        lipsTrack = Sequence(
            Wait(tLips), Func(self.avatar.pose, self.avAnim, 57),
            Func(self.avatar.update, 0),
            Func(self.placeProp, render, self.lips, self.gag.getPos(render)),
            Func(self.lips.setBillboardPointWorld),
            LerpScaleInterval(self.lips,
                              dScale,
                              Point3(3, 3, 3),
                              startScale=GagGlobals.PNT3NEAR0),
            Wait(tThrow - tLips - dScale),
            LerpPosInterval(self.lips,
                            dScale,
                            Point3(target.getPos()),
                            startPos=self.gag.getPos(render)),
            Sequence(Func(doHeal)), Func(self.cleanupLips))
        delay = tThrow + dScale
        mainTrack = Parallel(stickTrack, lipsTrack,
                             self.getSoundTrack(delay, self.avatar, 2),
                             ActorInterval(self.avatar, self.avAnim))
        mainTrack.start()