def hideOptions(self): #base.playSfx(self.optionsCloseSfx) # ALTIS: TODO: Add sound effects zoomOut = (LerpScaleInterval(self.optionsNode, .1, Vec3(.5, .5, .5), Vec3(1, 1, 1), blendType='easeIn')).start() Sequence(Wait(.1), Func(self.delAllOptions)).start()
def hideConf(self): base.transitions.noFade() zoomOut = LerpScaleInterval(self.confNode, 0.4, Vec3(0, 0, 0), Vec3(1, 1, 1), blendType='easeInOut').start() Sequence(Wait(0.4), Func(self.delConf)).start()
def setGrab(self, avId): if avId == base.localAvatar.doId: self.ignore(self.uniqueName('enterBarrelSphere')) self.barrel.setColorScale(0.5, 0.5, 0.5, 1) if self.animTrack: self.animTrack.finish() self.animTrack = None self.animTrack = Sequence(LerpScaleInterval(self.barrel, 0.2, 1.1 * self.BARREL_SCALE, blendType='easeInOut'), LerpScaleInterval(self.barrel, 0.2, self.BARREL_SCALE, blendType='easeInOut'), Func(self.barrel.setScale, self.BARREL_SCALE)) self.animTrack.start()
def showOptions(self): #base.playSfx(self.optionsOpenSfx) # ALTIS: TODO: Add sound effects self.displayOptions() zoomIn = (LerpScaleInterval(self.optionsNode, .1, Vec3(1, 1, 1), Vec3(0, 0, 0), blendType='easeOut')).start()
def __getGeyserTrack(): track = Sequence( Func(showEntity, geyserMound, cog), Func(showEntity, geyserWater, cog), LerpScaleInterval(geyserWater, 1.0, scaleUpPoint, startScale=GagGlobals.PNT3NEAR0), Wait(0.5 * geyserHold), LerpScaleInterval(geyserWater, 0.5, GagGlobals.PNT3NEAR0, startScale=scaleUpPoint), LerpScaleInterval(geyserMound, 0.5, GagGlobals.PNT3NEAR0), Func(geyserWater.removeNode), Func(geyserMound.removeNode), Func(self.removeEntity, entity)) return track
def hideNews(self): base.playSfx(self.newsCloseSfx) zoomOut = (LerpScaleInterval(self.newsNode, .4, Vec3(0, 0, 0), Vec3(1, 1, 1), blendType='easeInOut')).start() Sequence(Wait(.4), Func(self.delNews)).start()
def hideConf(self): # base.playSfx(self.optionsCloseSfx) # ALTIS: TODO: Add sound effects zoomOut = (LerpScaleInterval(self.confNode, .4, Vec3(0, 0, 0), Vec3(1, 1, 1), blendType='easeInOut')).start() Sequence(Wait(.4), Func(self.delConf)).start()
def showNews(self): base.playSfx(self.newsOpenSfx) self.displayNews() zoomIn = (LerpScaleInterval(self.newsNode, .4, Vec3(1, 1, 1), Vec3(0, 0, 0), blendType='easeInOut')).start()
def showConf(self): # base.playSfx(self.optionsOpenSfx) # ALTIS: TODO: Add sound effects self.displayConfirmation() zoomIn = (LerpScaleInterval(self.confNode, .4, Vec3(1, 1, 1), Vec3(0, 0, 0), blendType='easeInOut')).start()
def startEntity(self): if self.entityTrack: self.entityTrack.pause() self.entityTrack = None if self.getLocation(): x, y, z = self.getLocation() self.gag.setPos(x, y, z - 0.45) if not self.gag: self.build() # Let's let DistributedBattleZone know about this, if we can. lifeTime = self.lifeTime clearTaskName = self.gag.getName() + '-Clear' if base.localAvatarReachable() and hasattr( base.localAvatar, 'myBattle') and base.localAvatar.myBattle != None: base.localAvatar.myBattle.addDebris(self.gag, self.avatar.doId) else: lifeTime = 1.0 self.gag.setScale(GagGlobals.PNT3NEAR0) self.gag.reparentTo(render) LerpScaleInterval(self.gag, 1.2, Point3(1.7, 1.7, 1.7)).start() track = Sequence(Wait(0.7)) if self.isSafeLocation(self.gag): self.entities.append(self.gag) # Let's suck the closest suit into our trap. suits = [] for obj in base.cr.doId2do.values(): if obj.__class__.__name__ == "DistributedSuit": if obj.getPlace() == base.localAvatar.zoneId: suits.append(obj) nearestCog = self.getClosestObject(self.gag, suits) suits = [] if nearestCog and nearestCog.getDistance( self.gag) <= self.minSafeDistance: self.onActivate(self.gag, nearestCog) else: track.append( SoundInterval(self.hitSfx, duration=0.5, node=self.gag)) base.taskMgr.doMethodLater(lifeTime, self.__clearEntity, clearTaskName, extraArgs=[self.gag], appendTask=True) self.gag = None else: # We're too close to another trap, let's clear them out. self.cleanupGag() for ent in [ self.gag, self.getClosestObject(self.gag, self.entities) ]: if ent: self.__doDustClear(ent) track.append(Func(self.completeTrap)) track.start() self.entityTrack = track
def enterShowScores(self): self.notify.debug('enterShowScores') lerpTrack = Parallel() lerpDur = 0.5 lerpTrack.append( Parallel( LerpPosInterval(self.goalBar, lerpDur, Point3(0, 0, -0.6), blendType='easeInOut'), LerpScaleInterval(self.goalBar, lerpDur, Vec3(self.goalBar.getScale()) * 2.0, blendType='easeInOut'))) tY = 0.6 bY = -0.05 lX = -0.5 cX = 0 rX = 0.5 scorePanelLocs = (((cX, bY), ), ((lX, bY), (rX, bY)), ((cX, tY), (lX, bY), (rX, bY)), ((lX, tY), (rX, tY), (lX, bY), (rX, bY))) scorePanelLocs = scorePanelLocs[self.numPlayers - 1] for i in xrange(self.numPlayers): panel = self.scorePanels[i] pos = scorePanelLocs[i] panel.wrtReparentTo(aspect2d) lerpTrack.append( Parallel( LerpPosInterval(panel, lerpDur, Point3(pos[0], 0, pos[1]), blendType='easeInOut'), LerpScaleInterval(panel, lerpDur, Vec3(panel.getScale()) * 2.0, blendType='easeInOut'))) self.showScoreTrack = Parallel( lerpTrack, Sequence(Wait(MazeGameGlobals.SHOWSCORES_DURATION), Func(self.gameOver))) self.showScoreTrack.start() if base.config.GetBool('want-blueprint4-ARG', False): MinigameGlobals.generateDebugARGPhrase()
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()
def startAnimation(self): holidayIds = base.cr.newsManager.getHolidayIdList() if ToontownGlobals.VALENTINES_DAY in holidayIds: originalScale = self.nodePath.getScale() throbScale = VBase3(0.85, 0.85, 0.85) throbInIval = LerpScaleInterval(self.nodePath, 0.3, scale=throbScale, startScale=originalScale, blendType='easeIn') throbOutIval = LerpScaleInterval(self.nodePath, 0.3, scale=originalScale, startScale=throbScale, blendType='easeOut') self.heartThrobIval = Sequence(throbInIval, throbOutIval, Wait(0.75)) self.heartThrobIval.loop()
def enterScoring(self): sortedByDistance = [] for avId in self.avIdList: np = self.getTireNp(avId) pos = np.getPos() pos.setZ(0) sortedByDistance.append((avId, pos.length())) def compareDistance(x, y): if x[1] - y[1] > 0: return 1 elif x[1] - y[1] < 0: return -1 else: return 0 sortedByDistance.sort(cmp=compareDistance) self.scoreMovie = Sequence() curScale = 0.01 curTime = 0 self.scoreCircle.setScale(0.01) self.scoreCircle.show() self.notify.debug('newScores = %s' % self.newScores) circleStartTime = 0 for index in xrange(len(sortedByDistance)): distance = sortedByDistance[index][1] avId = sortedByDistance[index][0] scorePanelIndex = self.avIdList.index(avId) time = (distance - curScale) / IceGameGlobals.ExpandFeetPerSec if time < 0: time = 0.01 scaleXY = distance + IceGameGlobals.TireRadius self.notify.debug('circleStartTime = %s' % circleStartTime) self.scoreMovie.append(Parallel(LerpScaleInterval(self.scoreCircle, time, Point3(scaleXY, scaleXY, 1.0)), SoundInterval(self.scoreCircleSound, duration=time, startTime=circleStartTime))) circleStartTime += time startScore = self.scorePanels[scorePanelIndex].getScore() destScore = self.newScores[scorePanelIndex] self.notify.debug('for avId %d, startScore=%d, newScores=%d' % (avId, startScore, destScore)) def increaseScores(t, scorePanelIndex = scorePanelIndex, startScore = startScore, destScore = destScore): oldScore = self.scorePanels[scorePanelIndex].getScore() diff = destScore - startScore newScore = int(startScore + diff * t) if newScore > oldScore: base.playSfx(self.countSound) self.scorePanels[scorePanelIndex].setScore(newScore) self.scores[scorePanelIndex] = newScore duration = (destScore - startScore) * IceGameGlobals.ScoreCountUpRate tireNp = self.tireDict[avId]['tireNodePath'] self.scoreMovie.append(Parallel(LerpFunctionInterval(increaseScores, duration), Sequence(LerpColorScaleInterval(tireNp, duration / 6.0, VBase4(1, 0, 0, 1)), LerpColorScaleInterval(tireNp, duration / 6.0, VBase4(1, 1, 1, 1)), LerpColorScaleInterval(tireNp, duration / 6.0, VBase4(1, 0, 0, 1)), LerpColorScaleInterval(tireNp, duration / 6.0, VBase4(1, 1, 1, 1)), LerpColorScaleInterval(tireNp, duration / 6.0, VBase4(1, 0, 0, 1)), LerpColorScaleInterval(tireNp, duration / 6.0, VBase4(1, 1, 1, 1))))) curScale += distance self.scoreMovie.append(Func(self.sendUpdate, 'reportScoringMovieDone', [])) self.scoreMovie.start()
def start(self): SquirtGag.start(self) self.buildFlower() self.build() self.equip() if self.isLocal(): self.startTimeout() self.origin = self.getSprayStartPos() def attachFlower(): flowerJoint = self.avatar.find('**/def_joint_attachFlower') if flowerJoint.isEmpty(): flowerJoint = self.avatar.find('**/joint_attachFlower') self.flower.reparentTo(flowerJoint) self.flower.setY(self.flower.getY()) # The variables we'll need. totalAnimationTime = 2.5 flowerAppear = 1.0 flowerScaleTime = 0.5 # Let's start building the track. animTrack = ActorInterval(self.avatar, 'push-button') self.track.append(animTrack) flowerTrack = Sequence( Func(attachFlower), Wait(flowerAppear), LerpScaleInterval(self.flower, flowerScaleTime, 1.5, startScale=GagGlobals.PNT3NEAR0), Wait(totalAnimationTime - flowerScaleTime - flowerAppear)) flowerTrack.append(Func(self.release)) flowerTrack.append( LerpScaleInterval(self.flower, flowerScaleTime, GagGlobals.PNT3NEAR0)) flowerTrack.append( LerpScaleInterval(self.gag, flowerScaleTime, GagGlobals.PNT3NEAR0)) flowerTrack.append(Func(self.unEquip)) self.track.append(flowerTrack) self.track.start()
def enterShowScores(self): self.notify.debug('enterShowScores') lerpTrack = Parallel() lerpDur = 0.5 lerpTrack.append( Parallel( LerpPosInterval(self.goalBar, lerpDur, Point3(0, 0, -.6), blendType='easeInOut'), LerpScaleInterval(self.goalBar, lerpDur, Vec3(self.goalBar.getScale()) * 2.0, blendType='easeInOut'))) tY = 0.6 bY = -.05 lX = -.5 cX = 0 rX = 0.5 scorePanelLocs = (((cX, bY), ), ((lX, bY), (rX, bY)), ((cX, tY), (lX, bY), (rX, bY)), ((lX, tY), (rX, tY), (lX, bY), (rX, bY))) scorePanelLocs = scorePanelLocs[self.numPlayers - 1] for i in range(self.numPlayers): panel = self.scorePanels[i] pos = scorePanelLocs[i] lerpTrack.append( Parallel( LerpPosInterval(panel, lerpDur, Point3(pos[0], 0, pos[1]), blendType='easeInOut'), LerpScaleInterval(panel, lerpDur, Vec3(panel.getScale()) * 2.0, blendType='easeInOut'))) self.showScoreTrack = Parallel( lerpTrack, Sequence(Wait(MazeGameGlobals.SHOWSCORES_DURATION), Func(self.gameOver))) self.showScoreTrack.start()
def startCharging(self): LocationSeeker.stopSeeking(self) self.dropShadow.setZ(self.dropShadow.getZ() - 0.45) finalScale = 6 self.shadowTrack = Sequence() chargeTrack = Parallel(LerpScaleInterval(self.dropShadow, self.chargeDuration, finalScale, startScale=self.dropShadow.getScale(), blendType='easeInOut'), Func(base.audio3d.attachSoundToObject, self.chargingSfx, self.dropShadow), SoundInterval(self.chargingSfx, duration=self.chargeDuration, node=self.dropShadow)) self.shadowTrack.append(chargeTrack) self.shadowTrack.append(self.__tickNearbyCogs()) self.shadowTrack.append(Func(self.onFullCharge)) self.shadowTrack.start() self.isCharging = True
def enterAnnounceGameOver(self): whistle = base.loadSfx("phase_4/audio/sfx/AA_sound_whistle.ogg") base.playSfx(whistle) self.gameOverLbl = OnscreenText(text = 'Game Over!', fg = (1, 1, 1, 1), font = CIGlobals.getMinnieFont(), scale = 0.1) self.gameOverScaleIval = LerpScaleInterval( self.gameOverLbl, duration = 1.0, scale = 0.1, startScale = 0.0, blendType = 'easeOut' )
def getScaleIntervals(self, props, duration, startScale, endScale): tracks = Parallel() if not isinstance(props, list): props = [props] for prop in props: tracks.append( LerpScaleInterval(prop, duration, endScale, startScale=startScale)) return tracks
def enterEatFruit(self, fruitModel, handNode): self.notify.debug('enterEatFruit') self.setAnimState('CatchEating', 1.0) if self.isLocal: self.activity.orthoWalk.start() self.fruitModel = fruitModel renderScale = fruitModel.getScale(render) fruitModel.reparentTo(handNode) fruitModel.setScale(render, renderScale) duration = self.toon.getDuration('catch-eatneutral') self.eatIval = Sequence(Parallel(WaitInterval(duration), Sequence(LerpScaleInterval(fruitModel, duration / 2.0, fruitModel.getScale() * 0.5, blendType='easeInOut'), Func(fruitModel.hide))), Func(self.fsm.request, 'normal'), name=self.toon.uniqueName('eatingIval')) self.eatIval.start()
def setGrab(self, avId): local = (avId == base.localAvatar.getDoId()) if local: self.ignore(self.uniqueName('enterbarrelSphere')) self.barrel.setColorScale(0.5, 0.5, 0.5, 1) if self.playSoundForRemoteToons or local: base.playSfx(self.grabSfx) if self.animTrack: self.animTrack.finish() self.animTrack = None self.animTrack = Sequence(LerpScaleInterval(self.barrel, 0.2, 1.1 * self.barrelScale, blendType='easeInOut'), LerpScaleInterval(self.barrel, 0.2, self.barrelScale, blendType='easeInOut'), Func(self.reset), name=self.uniqueName('animTrack')) self.animTrack.start()
def makeSmokeEffect(self, pos): smoke = loader.loadModel('phase_4/models/props/test_clouds.bam') smoke.setBillboardAxis() smoke.reparentTo(render) smoke.setPos(pos) smoke.setScale(0.05, 0.05, 0.05) smoke.setDepthWrite(False) track = Sequence( Parallel(LerpScaleInterval(smoke, 0.5, (0.1, 0.15, 0.15)), LerpColorScaleInterval(smoke, 0.5, Vec4(2, 2, 2, 0))), Func(smoke.removeNode)) track.start()
def createMeterInterval(self, icon, meter, time): ivalDarkness = LerpScaleInterval(meter, time, scale=Vec3(1, 1, 1), startScale=Vec3(1, 0.001, 0.001)) flashingTrack = Sequence() flashDuration = 10 if time > flashDuration: flashingTrack.append(Wait(time - flashDuration)) for i in xrange(10): flashingTrack.append(Parallel(LerpColorScaleInterval(icon, 0.5, VBase4(1, 0, 0, 1)), icon.scaleInterval(0.5, 1.25))) flashingTrack.append(Parallel(LerpColorScaleInterval(icon, 0.5, VBase4(1, 1, 1, 1)), icon.scaleInterval(0.5, 1))) retIval = Parallel(ivalDarkness, flashingTrack) return retIval
def animToSuit(self, timeStamp): self.stopTransition() if self.mode != 'toon': self.setToToon() self.loadAnimToSuitSfx() sideBldgNodes = self.getNodePaths() nodePath = hidden.find(self.getSbSearchString()) newNP = self.setupSuitBuilding(nodePath) if not self.leftDoor: return closeDoors(self.leftDoor, self.rightDoor) newNP.stash() sideBldgNodes.append(newNP) soundPlayed = 0 tracks = Parallel(name=self.taskName('toSuitTrack')) for i in sideBldgNodes: name = i.getName() timeForDrop = TO_SUIT_BLDG_TIME * 0.85 if name[0] == 's': showTrack = Sequence(name=self.taskName('ToSuitFlatsTrack') + '-' + str(sideBldgNodes.index(i))) initPos = Point3(0, 0, self.SUIT_INIT_HEIGHT) + i.getPos() showTrack.append(Func(i.setPos, initPos)) showTrack.append(Func(i.unstash)) if i == sideBldgNodes[len(sideBldgNodes) - 1]: showTrack.append(Func(self.normalizeElevator)) if not soundPlayed: showTrack.append(Func(base.playSfx, self.cogDropSound, 0, 1, None, 0.0)) showTrack.append(LerpPosInterval(i, timeForDrop, i.getPos(), name=self.taskName('ToSuitAnim') + '-' + str(sideBldgNodes.index(i)))) if not soundPlayed: showTrack.append(Func(base.playSfx, self.cogLandSound, 0, 1, None, 0.0)) showTrack.append(self.createBounceTrack(i, 2, 0.65, TO_SUIT_BLDG_TIME - timeForDrop, slowInitBounce=1.0)) if not soundPlayed: showTrack.append(Func(base.playSfx, self.cogSettleSound, 0, 1, None, 0.0)) tracks.append(showTrack) if not soundPlayed: soundPlayed = 1 elif name[0] == 't': hideTrack = Sequence(name=self.taskName('ToSuitToonFlatsTrack')) timeTillSquish = (self.SUIT_INIT_HEIGHT - 20.0) / self.SUIT_INIT_HEIGHT timeTillSquish *= timeForDrop hideTrack.append(LerpFunctionInterval(self.adjustColorScale, fromData=1, toData=0.25, duration=timeTillSquish, extraArgs=[i])) hideTrack.append(LerpScaleInterval(i, timeForDrop - timeTillSquish, Vec3(1, 1, 0.01))) hideTrack.append(Func(i.stash)) hideTrack.append(Func(i.setScale, Vec3(1))) hideTrack.append(Func(i.clearColorScale)) tracks.append(hideTrack) self.stopTransition() self._deleteTransitionTrack() self.transitionTrack = tracks self.transitionTrack.start(timeStamp) return
def animateChatBalloon(self): if (self.chatBalloon is None) or (self.chatBalloon.isEmpty()): return if self.chatBalloonAnimTrack is not None: self.chatBalloonAnimTrack.finish() self.chatBalloonAnimTrack = None self.chatBalloonAnimTrack = Sequence( Parallel( LerpScaleInterval(self.chatBalloon, 0.25, 1.25, startScale=0, blendType='easeIn'), Func(self.contents.show)), LerpScaleInterval(self.chatBalloon, 0.125, 1, startScale=1.25, blendType='easeOut')) self.chatBalloonAnimTrack.start()
def unhighlight(self): """Subclasses should override this method to implement custom drag-over behaviour.""" # If we are already scaling down, do nothing. if hasattr(self,'scaleDownInterval') and self.scaleDownInterval.isPlaying(): return # If we are in the process of scaling up, stop. if hasattr(self,'scaleUpInterval') and self.scaleUpInterval.isPlaying(): self.scaleUpInterval.pause() from direct.interval.IntervalGlobal import LerpScaleInterval self.scaleDownInterval = LerpScaleInterval(self.np, duration=0.2, scale=self.prevScale, startScale=self.getScale()) self.scaleDownInterval.start()
def enterSquish(self, ts=0, callback=None, extraArgs=[]): self.playingAnim = 'squish' sound = loader.loadSfx('phase_9/audio/sfx/toon_decompress.ogg') lerpTime = 0.1 node = self.getGeomNode().getChild(0) origScale = node.getScale() if hasattr(self, 'uniqueName'): name = self.uniqueName('getSquished') else: name = 'getSquished' self.track = Sequence(LerpScaleInterval(node, lerpTime, VBase3(2, 2, 0.025), blendType='easeInOut'), Wait(1.0), Parallel( Sequence( Wait(0.4), LerpScaleInterval(node, lerpTime, VBase3(1.4, 1.4, 1.4), blendType='easeInOut'), LerpScaleInterval(node, lerpTime / 2.0, VBase3(0.8, 0.8, 0.8), blendType='easeInOut'), LerpScaleInterval( node, lerpTime / 3.0, origScale, blendType='easeInOut')), ActorInterval(self, 'happy', startTime=0.2), SoundInterval(sound)), name=name) self.track.setDoneEvent(self.track.getName()) self.acceptOnce(self.track.getDoneEvent(), self.squishDone, [callback, extraArgs]) self.track.delayDelete = DelayDelete.DelayDelete(self, name) self.track.start(ts)
def showResults(self): if not self.gameIsEnding: self.gameIsEnding = True for barrel in self.barrels: barrel.wrtReparentTo(render) for key in self.cogInfo: thief = self.cogInfo[key]['suit'] thief.suit.setPos(100, 0, 0) thief.suit.hide() self.__killRewardCountdown() self.stopGameWalk() numBarrelsSaved = len(self.barrels) - len(self.stolenBarrels) resultStr = '' if numBarrelsSaved == len(self.barrels): resultStr = TTLocalizer.CogThiefPerfect elif numBarrelsSaved > 1: resultStr = TTLocalizer.CogThiefBarrelsSaved % {'num': numBarrelsSaved} elif numBarrelsSaved == 1: resultStr = TTLocalizer.CogThiefBarrelSaved % {'num': numBarrelsSaved} else: resultStr = TTLocalizer.CogThiefNoBarrelsSaved perfectTextSubnode = hidden.attachNewNode(self.__genText(resultStr)) perfectText = hidden.attachNewNode('perfectText') perfectTextSubnode.reparentTo(perfectText) frame = self.__textGen.getCardActual() offsetY = -abs(frame[2] + frame[3]) / 2.0 perfectTextSubnode.setPos(0, 0, offsetY) perfectText.setColor(1, 0.1, 0.1, 1) def fadeFunc(t, text = perfectText): text.setColorScale(1, 1, 1, t) def destroyText(text = perfectText): text.removeNode() def safeGameOver(self = self): if not self.frameworkFSM.isInternalStateInFlux(): self.gameOver() textTrack = Sequence(Func(perfectText.reparentTo, aspect2d), Parallel(LerpScaleInterval(perfectText, duration=0.5, scale=0.3, startScale=0.0), LerpFunctionInterval(fadeFunc, fromData=0.0, toData=1.0, duration=0.5)), Wait(2.0), Parallel(LerpScaleInterval(perfectText, duration=0.5, scale=1.0), LerpFunctionInterval(fadeFunc, fromData=1.0, toData=0.0, duration=0.5, blendType='easeIn')), Func(destroyText), WaitInterval(0.5), Func(safeGameOver)) if numBarrelsSaved == len(self.barrels): soundTrack = SoundInterval(self.sndPerfect) else: soundTrack = Sequence() self.resultIval = Parallel(textTrack, soundTrack) self.resultIval.start() #For the Alpha Blueprint ARG if config.GetBool('want-blueprint4-ARG', False): MinigameGlobals.generateDebugARGPhrase()
def onActivate(self, entity, suit): ActivateTrapGag.onActivate(self, entity, suit) slidePos = entity.getPos(render) slidePos.setY(slidePos.getY() - 5.1) moveTrack = Sequence(Wait(0.1), LerpPosInterval(self.gag, 0.1, slidePos)) animTrack = Sequence( ActorInterval(self.gag, 'banana', startTime=3.1), Wait(1.1), LerpScaleInterval(self.gag, 1, Point3(0.01, 0.01, 0.01))) suitTrack = ActorInterval(suit, 'slip-backward') soundTrack = Sequence( SoundInterval(self.slipSfx, duration=0.55, node=suit), SoundInterval(self.activateSfx, node=suit)) Parallel(moveTrack, animTrack, suitTrack, soundTrack).start()
def enterShoot(self, suitId): if self.cannon: smoke = loader.loadModel("phase_4/models/props/test_clouds.bam") smoke.setBillboardPointEye() smoke.reparentTo(self.cannon.find('**/cannon')) smoke.setPos(0, 6, -3) smoke.setScale(0.5) smoke.wrtReparentTo(render) self.suit = self.cr.doId2do.get(suitId) self.cannon.find('**/cannon').lookAt(self.suit.find('**/joint_head')) self.cannon.find('**/square_drop_shadow').headsUp(self.suit.find('**/joint_head')) self.track = Sequence(Parallel(LerpScaleInterval(smoke, 0.5, 3), LerpColorScaleInterval(smoke, 0.5, Vec4(2, 2, 2, 0))), Func(smoke.removeNode)) self.track.start() self.createAndShootGag()