def announceGenerate(self):
     DistributedElevatorExt.DistributedElevatorExt.announceGenerate(self)
     angle = self.startingHpr[0]
     angle -= 90
     radAngle = deg2Rad(angle)
     unitVec = Vec3(math.cos(radAngle), math.sin(radAngle), 0)
     unitVec *= 11.25
     self.endPos = self.startingPos + unitVec
     self.endPos.setZ(0.5)
     dist = Vec3(self.endPos - self.enteringPos).length()
     wheelAngle = dist / (6.72 * math.pi) * 360
     self.kartEnterAnimateInterval = Parallel(
         LerpHprInterval(
             self.wheels[0], 5.0,
             Vec3(self.wheels[0].getH(), wheelAngle,
                  self.wheels[0].getR())),
         LerpHprInterval(
             self.wheels[1], 5.0,
             Vec3(self.wheels[1].getH(), wheelAngle,
                  self.wheels[1].getR())),
         LerpHprInterval(
             self.wheels[2], 5.0,
             Vec3(self.wheels[2].getH(), wheelAngle,
                  self.wheels[2].getR())),
         LerpHprInterval(
             self.wheels[3], 5.0,
             Vec3(self.wheels[3].getH(), wheelAngle,
                  self.wheels[3].getR())),
         name='SwagKartAnimate')
     trolleyExitTrack1 = Parallel(
         Sequence(
             Wait(1.25),
             Func(self.mole.doMolePop, 0, 0.75, 5, 0.75,
                  MoleFieldBase.HILL_MOLE)),
         Sequence(
             LerpPosInterval(self.golfKart, 2.5, self.endPos),
             Func(self.mole.setHillType, MoleFieldBase.HILL_WHACKED),
             Func(self.soundBomb.play), Func(self.soundBomb2.play),
             Func(self.soundUp.play),
             Parallel(
                 ProjectileInterval(self.golfKart,
                                    startPos=self.endPos,
                                    endPos=self.flyToPos,
                                    duration=2,
                                    gravityMult=2.5),
                 self.golfKart.hprInterval(
                     2, (self.golfKart.getH(), self.golfKart.getP() + 720,
                         0)))),
         self.kartEnterAnimateInterval,
         name='SwagKartExitTrack')
     self.trolleyExitTrack = Sequence(trolleyExitTrack1)
     self.trolleyEnterTrack = Sequence(
         Func(self.golfKart.setP, 0),
         LerpPosInterval(self.golfKart,
                         5.0,
                         self.startingPos,
                         startPos=self.enteringPos))
     self.closeDoors = Sequence(self.trolleyExitTrack,
                                Func(self.onDoorCloseFinish))
     self.openDoors = Sequence(self.trolleyEnterTrack)
    def generated(self):
        self.eastPier = self.cr.playGame.hood.loader.geom.find(
            '**/' + self.eastPierPath)
        self.westPier = self.cr.playGame.hood.loader.geom.find(
            '**/' + self.westPierPath)
        base.cr.parentMgr.registerParent(CIGlobals.SPDonaldsBoat, self.boatMdl)
        self.accept('enterdonalds_boat_floor', self.__handleOnBoat)
        self.accept('exitdonalds_boat_floor', self.__handleOffBoat)
        self.d_requestCurrentStateAndTimestamp()
        self.fsm.enterInitialState()

        speedFactor = 2

        self.animBoatTrack = Sequence(
            LerpHprInterval(self.boatMdl,
                            duration=1 * speedFactor,
                            hpr=(0, 0, -1),
                            startHpr=(0, 0, 1),
                            blendType='easeInOut'),
            LerpHprInterval(self.boatMdl,
                            duration=1 * speedFactor,
                            hpr=(0, 0, 1),
                            startHpr=(0, 0, -1),
                            blendType='easeInOut'))

        import math

        self.animBoat1Track = Sequence(
            LerpHprInterval(self.boatMdl1,
                            duration=math.pi * speedFactor,
                            hpr=(0, 1, 0),
                            startHpr=(0, -1, 0),
                            blendType='easeInOut'),
            LerpHprInterval(self.boatMdl1,
                            duration=math.pi * speedFactor,
                            hpr=(0, -1, 0),
                            startHpr=(0, 1, 0),
                            blendType='easeInOut'))
        self.animBoat1Track.loop()
        self.animBoatTrack.loop()

        if base.cr.holidayManager.getHoliday() == HolidayType.CHRISTMAS:
            self.boat.setPosHpr(12.73, -1.6, -4.7, 341.57, 350.0, 26.5)
            self.fsm.request('off')

            self.crashColl = CollisionSphere(0, 0, 0, 15)
            self.crashCollNP = self.boat.attachNewNode(
                CollisionNode('crashed_boat_collision'))
            self.crashCollNP.node().addSolid(self.crashColl)
            self.crashCollNP.node().setCollideMask(CIGlobals.WallBitmask)
            self.crashCollNP.setSz(2)
            self.crashCollNP.setSx(0.75)
            self.crashCollNP.setSy(1.25)
            self.crashCollNP.setPosHpr(2.05, 3.21, 1.66, 8.44, 6.93, 332.61)
Beispiel #3
0
    def announceGenerate(self):
        """Setup other fields dependent on the required fields."""
        DistributedElevatorExt.DistributedElevatorExt.announceGenerate(self)

        angle = self.startingHpr[0]
        angle -= 90
        radAngle = deg2Rad(angle)
        unitVec = Vec3(math.cos(radAngle), math.sin(radAngle), 0)
        unitVec *= 45.0
        self.endPos = self.startingPos + unitVec
        self.endPos.setZ(0.5)

        dist = Vec3(self.endPos - self.enteringPos).length()
        wheelAngle = (dist / (4.8 * 1.4 * math.pi)) * 360

        self.kartEnterAnimateInterval = Parallel(
            # start a lerp HPR for each wheel
            LerpHprInterval(
                self.wheels[0], 5.0,
                Vec3(self.wheels[0].getH(), wheelAngle,
                     self.wheels[0].getR())),
            LerpHprInterval(
                self.wheels[1], 5.0,
                Vec3(self.wheels[1].getH(), wheelAngle,
                     self.wheels[1].getR())),
            LerpHprInterval(
                self.wheels[2], 5.0,
                Vec3(self.wheels[2].getH(), wheelAngle,
                     self.wheels[2].getR())),
            LerpHprInterval(
                self.wheels[3], 5.0,
                Vec3(self.wheels[3].getH(), wheelAngle,
                     self.wheels[3].getR())),
            name="CogKartAnimate")

        trolleyExitTrack1 = Parallel(LerpPosInterval(self.golfKart, 5.0,
                                                     self.endPos),
                                     self.kartEnterAnimateInterval,
                                     name="CogKartExitTrack")
        self.trolleyExitTrack = Sequence(
            trolleyExitTrack1,
            # Func(self.hideSittingToons), # we may not need this
        )

        self.trolleyEnterTrack = Sequence(
            LerpPosInterval(self.golfKart,
                            5.0,
                            self.startingPos,
                            startPos=self.enteringPos))

        self.closeDoors = Sequence(self.trolleyExitTrack,
                                   Func(self.onDoorCloseFinish))
        self.openDoors = Sequence(self.trolleyEnterTrack)
Beispiel #4
0
 def toggleR(self):
     (h, p, r) = self.container.getHpr()
     if r in (0.0, 15.0):
         self.toggle_r_snd.play()
         if self.r:
             i = LerpHprInterval(self.container, 0.25, (h, p, r - 15),
                                 (h, p, r))
         else:
             i = LerpHprInterval(self.container, 0.25, (h, p, r + 15),
                                 (h, p, r))
         s = Sequence(i)
         s.start()
         self.r = not self.r
Beispiel #5
0
 def initIntervals(self):
     self.baseSpinDuration = 1.0
     self.propellerSpinLerp = LerpFunctionInterval(self.propeller.setH, fromData=0.0, toData=360.0, duration=self.baseSpinDuration, name='%s.propellerSpinLerp-%s' % (self.__class__.__name__, self.toon.doId))
     singleBlinkTime = Globals.Gameplay.TargetedWarningSingleBlinkTime
     blinkTime = Globals.Gameplay.TargetedWarningBlinkTime
     self.blinkLoop = Sequence(Wait(singleBlinkTime / 2.0), Func(self.setBackpackTexture, Globals.Gameplay.BackpackStates.Attacked), Wait(singleBlinkTime / 2.0), Func(self.setBackpackTexture, Globals.Gameplay.BackpackStates.Targeted), name='%s.blinkLoop-%s' % (self.__class__.__name__, self.toon.doId))
     self.blinkWarningSeq = Sequence(Func(self.blinkLoop.loop), Wait(blinkTime), Func(self.blinkLoop.clearToInitial), name='%s.blinkWarningSeq-%s' % (self.__class__.__name__, self.toon.doId))
     dur = Globals.Gameplay.BackpackRefuelDuration
     self.refuelSeq = Sequence(Func(self.setPropellerSpinRate, Globals.Gameplay.RefuelPropSpeed), Wait(dur), Func(self.returnBackpackToLastStateFunc), name='%s.refuelSeq-%s' % (self.__class__.__name__, self.toon.doId))
     scale = self.redTapeRing.getScale()
     pulseTime = 1.0
     self.pulseBubbleSeq = Parallel(Sequence(LerpFunctionInterval(self.redTapeRing.setScale, fromData=scale, toData=scale * 1.1, duration=pulseTime / 2.0, blendType='easeInOut'), LerpFunctionInterval(self.redTapeRing.setScale, fromData=scale * 1.1, toData=scale, duration=pulseTime / 2.0, blendType='easeInOut')), LerpHprInterval(self.redTapeRing, pulseTime, Vec3(360, 0, 0), startHpr=Vec3(0, 0, 0)), name='%s.pulseBubbleSeq-%s' % (self.__class__.__name__, self.toon.doId))
     bouncePercent = 1.2
     scaleTime = 0.5
     scaleBounceTime = 0.25
     self.popUpBubbleLerp = LerpScaleInterval(self.redTapeRing, scaleTime, scale * bouncePercent, startScale=0.0, blendType='easeInOut')
     self.popUpBubbleSeq = Sequence(Func(self.updateLerpStartScale, self.popUpBubbleLerp, self.redTapeRing), Func(self.redTapeRing.show), self.popUpBubbleLerp, LerpScaleInterval(self.redTapeRing, scaleBounceTime, scale, startScale=scale * bouncePercent, blendType='easeInOut'), Func(self.pulseBubbleSeq.loop), name='%s.popUpBubbleSeq-%s' % (self.__class__.__name__, self.toon.doId))
     self.removeBubbleLerp = LerpScaleInterval(self.redTapeRing, scaleBounceTime, scale * bouncePercent, startScale=scale, blendType='easeInOut')
     self.removeBubbleSeq = Sequence(Func(self.pulseBubbleSeq.clearToInitial), Func(self.updateLerpStartScale, self.removeBubbleLerp, self.redTapeRing), self.removeBubbleLerp, LerpScaleInterval(self.redTapeRing, scaleTime, 0.0, startScale=scale * bouncePercent, blendType='easeInOut'), Func(self.redTapeRing.hide), name='%s.removeBubbleSeq-%s' % (self.__class__.__name__, self.toon.doId))
     self.redTapeRing.setScale(0.0)
     self.deathInterval = Sequence(Parallel(LerpHprInterval(self.toon, 1.0, Vec3(720, 0, 0)), LerpFunctionInterval(self.toon.setScale, fromData=1.0, toData=0.1, duration=1.0)), Func(self.toon.stash), name='%s.deathInterval-%s' % (self.__class__.__name__, self.toon.doId))
     self.spawnInterval = Sequence(Func(self.toon.stash), Func(self.resetToon), Wait(1.0), Func(self.toon.setAnimState, 'TeleportIn'), Func(self.toon.unstash), name='%s.spawnInterval-%s' % (self.__class__.__name__, self.toon.doId))
     singleBlinkTime = Globals.Gameplay.InvulSingleBlinkTime
     blinkTime = Globals.Gameplay.InvulBlinkTime
     invulBuffTime = Globals.Gameplay.InvulBuffTime
     self.blinkBubbleLoop = Sequence(LerpFunctionInterval(self.redTapeRing.setAlphaScale, fromData=1.0, toData=0.0, duration=singleBlinkTime / 2.0, blendType='easeInOut'), LerpFunctionInterval(self.redTapeRing.setAlphaScale, fromData=0.0, toData=1.0, duration=singleBlinkTime / 2.0, blendType='easeInOut'), name='%s.blinkBubbleLoop-%s' % (self.__class__.__name__, self.toon.doId))
     self.blinkBubbleSeq = Sequence(Wait(invulBuffTime - blinkTime), Func(self.blinkBubbleLoop.loop), Wait(blinkTime), Func(self.blinkBubbleLoop.finish), name='%s.blinkBubbleSeq-%s' % (self.__class__.__name__, self.toon.doId))
Beispiel #6
0
    def doMoveTrack(self,
                    path,
                    turnToFirstWP=True,
                    speed=3.0,
                    doWalkAnims=True):
        self.goon.d_doMoveTrack(path, turnToFirstWP, speed, doWalkAnims)

        self.clearMoveTrack()

        self.moveTrack = CIGlobals.getMoveIvalFromPath(self.goon, path, speed)

        if turnToFirstWP:
            turnHpr = CIGlobals.getHeadsUpAngle(self.goon, path[1])
            turnHpr[0] = PythonUtil.fitDestAngle2Src(self.goon.getHpr()[0],
                                                     turnHpr[0])
            turnDist = CIGlobals.getHeadsUpDistance(self.goon, path[1])
            self.moveTrack.insert(
                1,
                LerpHprInterval(self.goon,
                                duration=turnDist / (speed * 30),
                                hpr=turnHpr))

        self.moveTrack.append(Func(self._moveTrackFinished))
        self.moveTrack.start()
        self.moving = True
Beispiel #7
0
    def exitDoorEnterClosing(self, ts):
        assert(self.debugPrint("exitDoorEnterClosing()"))
        # Start animation:

        bldgActor = self.getBuildingActor()
        leftDoor = bldgActor.controlJoint(None, "modelRoot", "def_left_door")

        #if ZoneUtil.isInterior(self.zoneId):
        #    doorFrameHoleLeft.setColor(1., 1., 1., 1.)
        # Left door:
        if self.leftSwing:
            h = -100
        else:
            h = 100

        if (not leftDoor.isEmpty()):
            # Close the door:
            otherNP=self.getDoorNodePath()
            trackName = "doorExitTrack-%d" % (self.doId)
            self.finishDoorExitTrack()
            self.doorExitTrack = Sequence(
                    LerpHprInterval(
                        nodePath=leftDoor,
                        duration=1.0,
                        hpr=VBase3(0, 0, 0),
                        startHpr=VBase3(h, 0, 0),
                        #other=otherNP,
                        blendType="easeInOut"),
                    #Func(doorFrameHoleLeft.hide),
                    #Func(self.hideIfHasFlat, leftDoor),
                    SoundInterval(self.closeSfx, node=leftDoor),
                    name = trackName)
            self.doorExitTrack.start(ts)
Beispiel #8
0
 def exitDoorEnterOpening(self, ts):
     assert(self.debugPrint("exitDoorEnterOpening()"))
     bldgActor = self.getBuildingActor()
     leftDoor = bldgActor.controlJoint(None, "modelRoot", "def_left_door")
     if self.leftSwing:
         h = -100
     else:
         h = 100
     if (not leftDoor.isEmpty()):
         # Open the door:
         otherNP=self.getDoorNodePath()
         trackName = "doorDoorExitTrack-%d" % (self.doId)
         self.finishDoorExitTrack()
         self.doorExitTrack = Parallel(
             SoundInterval(self.openSfx, node=leftDoor),
             Sequence(
                 #Func(leftDoor.show),
                 #Func(doorFrameHoleLeft.show),
                 LerpHprInterval(nodePath=leftDoor,
                                 duration=0.6,
                                 hpr=VBase3(h, 0, 0),
                                 startHpr=VBase3(0, 0, 0),
                                 #other=otherNP,
                                 blendType="easeInOut")),
             name = trackName)
         # Start the tracks:
         self.doorExitTrack.start(ts)
     else:
         self.notify.warning("exitDoorEnterOpening(): did not find leftDoor")
Beispiel #9
0
    def enterClosing(self, ts):
        assert(self.debugPrint("enterClosing()"))
        # Right door:
        bldgActor = self.getBuildingActor()
        rightDoor = bldgActor.controlJoint(None, "modelRoot", "def_right_door")
        if (rightDoor.isEmpty()):
            self.notify.warning("enterClosing(): did not find rightDoor")
            return

        # Close the door:
        otherNP=self.getDoorNodePath()
        trackName = "doorClose-%d" % (self.doId)
        if self.rightSwing:
            h = 100
        else:
            h = -100
        # Stop animation:
        self.finishDoorTrack()
        self.doorTrack=Sequence(
                LerpHprInterval(
                    nodePath=rightDoor,
                    duration=1.0,
                    hpr=VBase3(0, 0, 0),
                    startHpr=VBase3(h, 0, 0),
                    #other=otherNP,
                    blendType="easeInOut"),
                #Func(doorFrameHoleRight.hide),
                #Func(self.hideIfHasFlat, rightDoor),
                SoundInterval(self.closeSfx, node=rightDoor),
                name = trackName)
        self.doorTrack.start(ts)
        if hasattr(self, "done"):
            request = self.getRequestStatus()
            messenger.send("doorDoneEvent", [request])
Beispiel #10
0
    def doMoveTrack(self,
                    path,
                    turnToFirstWP=True,
                    speed=3.0,
                    doWalkAnims=True):
        self.clearMoveTrack()

        #for pos in path:
        #    smiley = loader.loadModel("models/smiley.egg.pz")
        #    smiley.reparentTo(self.pathVisRoot)
        #    smiley.setPos(pos)
        #    smiley.setTextureOff(1)

        self.moveTrack = CIGlobals.getMoveIvalFromPath(self, path, speed)

        if turnToFirstWP:
            turnHpr = CIGlobals.getHeadsUpAngle(self, path[1])
            turnDist = CIGlobals.getHeadsUpDistance(self, path[1])
            if doWalkAnims:
                self.moveTrack.insert(0, Func(self.playWalkAnim, 1.0))
            self.moveTrack.insert(
                1,
                LerpHprInterval(self,
                                duration=turnDist / (speed * 30),
                                hpr=turnHpr))
            if doWalkAnims:
                self.moveTrack.insert(2, Func(self.playWalkAnim, 1.5))
        elif doWalkAnims:
            self.moveTrack.insert(0, Func(self.playWalkAnim, 1.5))

        self.moveTrack.append(Func(self.playIdleAnim))
        self.moveTrack.start()
Beispiel #11
0
    def endScan(self):
        if self.shootTrack:
            self.shootTrack.finish()
        if self.lightScanIval:
            self.lightScanIval.pause()
        taskMgr.remove(self.taskName("scanTask"))

        self.scanLoopSound.stop()
        self.shootTrack = Parallel(
            SoundInterval(self.scanEndSound, node=self),
            Sequence(
                LerpHprInterval(self.scannerMdl,
                                duration=0.25,
                                hpr=(180, 0, 0),
                                startHpr=self.scannerMdl.getHpr()),
                LerpScaleInterval(self.scannerMdl,
                                  duration=0.7,
                                  scale=(0.3, 2, 1),
                                  startScale=(2, 2, 1)),
                LerpScaleInterval(self.scannerMdl,
                                  duration=0.7,
                                  scale=(0.01, 0.01, 0.01),
                                  startScale=(0.3, 2, 1)),
                Func(self.scannerMdl.hide),
                LerpFunc(self.blendAnimFromBase,
                         fromData=1,
                         toData=0,
                         duration=0.5,
                         extraArgs=['scan'])))
        self.shootTrack.start()
Beispiel #12
0
 def enterScan(self):
     self.setPlayRate(1, "scan")
     self.pingpong("scan", fromFrame=94, toFrame=96)
     self.scannerMdl.setHpr(180, 0, 0)
     self.shootTrack = Sequence(
         LerpFunc(self.blendAnimFromBase,
                  fromData=0,
                  toData=1,
                  duration=0.5,
                  extraArgs=['scan']),
         Parallel(
             SoundInterval(self.scanBeginSound, node=self),
             Func(self.scannerMdl.show),
             Sequence(
                 LerpScaleInterval(self.scannerMdl,
                                   duration=0.5,
                                   scale=(0.3, 2, 1),
                                   startScale=(0.01, 0.01, 0.01)),
                 LerpScaleInterval(self.scannerMdl,
                                   duration=0.5,
                                   scale=(2, 2, 1),
                                   startScale=(0.3, 2, 1)),
                 LerpHprInterval(self.scannerMdl,
                                 duration=0.25,
                                 hpr=(180, 20, 0),
                                 startHpr=(180, 0, 0)))),
         Func(self.beginScan))
     self.shootTrack.start()
    def onSetAction(self, action):
        self.model.reparentTo(self.eyeRoot)
        self.model.setScale(0.01)
        self.model.setHpr(VBase3(-155.0, -20.0, 0.0))
        self.model.setLightOff()

        self.avatar.doingActivity = False

        if action == self.StateThrow:
            self.avatar.doingActivity = True

            eyeTrack = Sequence(
                Func(self.model.show), Wait(self.HoldStart),
                LerpScaleInterval(self.model,
                                  self.HoldDuration,
                                  Point3(self.ModelScale),
                                  startScale=0.01),
                Wait(self.EyeHoldDuration * 0.3),
                LerpHprInterval(self.model, 0.02, Point3(205, 40, 0)),
                Wait(self.EyeHoldDuration * 0.7), Func(self.model.hide))

            self.setAnimTrack(Parallel(
                Sequence(Wait(1.3), Func(self.eyeSfx.play)),
                Sequence(
                    self.getAnimationTrack('glower',
                                           endTime=self.HoldStart,
                                           fullBody=False),
                    Wait(self.HoldDuration),
                    self.getAnimationTrack('glower',
                                           startTime=self.HoldStart,
                                           fullBody=False)), eyeTrack),
                              startNow=True)
Beispiel #14
0
    def start(self):
        SoundGag.start(self)
        tracks = Parallel()
        delayTime = 2.45
        delayUntilAppearSound = 1.0
        INSTRUMENT_SCALE_MODIFIER = 0.5
        instrMin = Vec3(0.001, 0.001, 0.001)
        instrMax1 = Vec3(0.1, 0.1, 0.1)
        instrMax1 *= INSTRUMENT_SCALE_MODIFIER
        instrMax2 = Vec3(0.3, 0.3, 0.3)
        instrMax2 *= INSTRUMENT_SCALE_MODIFIER
        instrStretch = Vec3(0.4, 0.4, 0.4)
        instrStretch *= INSTRUMENT_SCALE_MODIFIER

        def setInstrumentStats():
            self.gag.setPos(-0.8, -0.9, 0.2)
            self.gag.setHpr(145, 0, 0)
            self.gag.setScale(instrMin)

        megaphoneSh = Sequence(
            Func(self.placeProp, self.handJoint, self.megaphone),
            Func(self.placeProp, self.handJoint, self.gag),
            Func(setInstrumentStats))
        grow = self.getScaleIntervals(self.gag,
                                      duration=1,
                                      startScale=instrMin,
                                      endScale=instrMax1)
        instrumentAppear = Parallel(grow)
        stretchInstr = self.getScaleBlendIntervals(self.gag,
                                                   duration=0.3,
                                                   startScale=instrMax2,
                                                   endScale=instrStretch,
                                                   blendType='easeOut')
        backInstr = self.getScaleBlendIntervals(self.gag,
                                                duration=1.0,
                                                startScale=instrStretch,
                                                endScale=instrMin,
                                                blendType='easeIn')
        spinInstr = LerpHprInterval(self.gag,
                                    duration=1.5,
                                    startHpr=Vec3(145, 0, 0),
                                    hpr=Vec3(145, 0, 90),
                                    blendType='easeInOut')
        attackTrack = Parallel(Sequence(Wait(0.2), spinInstr),
                               Sequence(stretchInstr, Wait(0.5), backInstr))
        megaphoneTrack = Sequence(
            megaphoneSh, Wait(delayUntilAppearSound),
            SoundInterval(self.appearSfx, node=self.avatar),
            Wait(delayTime + 1.0), instrumentAppear)
        tracks.append(megaphoneTrack)
        tracks.append(ActorInterval(self.avatar, 'sound'))
        soundTrack = Sequence(
            Wait(delayTime),
            Parallel(attackTrack, SoundInterval(self.soundSfx,
                                                node=self.avatar),
                     Func(self.damageCogsNearby), Wait(0.4),
                     Func(self.finish)))
        tracks.append(soundTrack)
        tracks.start()
        self.tracks = tracks
Beispiel #15
0
    def _drop_brake(self, brake):
        """Drop braking shoes to slow down the locomotive.

        Args:
            brake (panda3d.core.NodePath): Brake model to drop.
        """
        brake.wrtReparentTo(base.train.model)  # noqa: F821

        if not base.train.r_brake:  # noqa: F821
            pos = 0.058
            base.train.r_brake = True  # noqa: F821
            side = "r"
        else:
            base.train.l_brake = True  # noqa: F821
            pos = -0.058
            side = "l"

        Sequence(
            Parallel(
                LerpPosInterval(brake, 0.5, (pos, 0.7, 0.025)),
                LerpHprInterval(brake, 0.5, (0, 0, 0)),
            ),
            LerpPosInterval(brake, 0.35, (pos, 0.38, 0.025)),
            Func(base.train.brake, side, brake),  # noqa: F821
        ).start()
Beispiel #16
0
    def buildShadow(self):
        self.cleanupShadow()
        if not self.dropShadowPath or not self.avatar: return

        self.dropShadow = NodePath('locationIndicatorRoot')

        cm = CardMaker('locationIndicator')
        cm.setFrame(-1, 1, -1, 1)
        indicatorNP = self.dropShadow.attachNewNode(cm.generate())
        indicatorNP.setBSPMaterial(self.crosshairMaterial, 1)
        indicatorNP.setScale(self.shadowScale * 2.5)
        indicatorNP.setDepthOffset(16)
        indicatorNP.setTransparency(1)
        indicatorNP.setP(-90)
        indicatorNP.flattenStrong()

        self.confirmIndTrack = Sequence(
            Parallel(
                LerpHprInterval(self.dropShadow,
                                duration=0.2,
                                hpr=(360, 0, 0),
                                startHpr=(0, 0, 0)),
                LerpScaleInterval(self.dropShadow,
                                  duration=0.2,
                                  scale=0.01,
                                  startScale=1)),
            Func(self.gag.cleanupLocationSeeker))
 def handlePickup(self, avId):
     avatar = self.cr.doId2do[avId]
     avatarGoneName = avatar.uniqueName('disable')
     self.accept(avatarGoneName, self.unexpectedExit)
     flyTime = 1.0
     self.stopSpin()
     self.spinIval = Sequence(
         LerpHprInterval(self.bean,
                         duration=1.5,
                         hpr=Vec3(360, 0, 0),
                         startHpr=self.bean.getHpr()))
     self.spinIval.loop()
     self.actuallyCollect(avId, 1.2)
     track = ParallelEndTogether(
         Sequence(
             LerpPosInterval(self.bean,
                             flyTime,
                             pos=Point3(0, 0, 3),
                             startPos=self.bean.getPos(avatar),
                             blendType='easeInOut'),
             Func(self.bean.detachNode), Func(self.ignore, avatarGoneName)),
         LerpColorScaleInterval(self.bean, flyTime, Vec4(0, 0, 0, 0.1),
                                Vec4(1, 1, 1, 1)))
     self.flyTrack = Sequence(track, name='treasureFlyTrack')
     self.bean.reparentTo(avatar)
     self.flyTrack.start()
Beispiel #18
0
 def makeToonGrabInterval(self, toon):
     toon.pose('leverNeutral', 0)
     toon.update()
     rightHandPos = toon.rightHand.getPos(toon)
     self.toonPitcherPosition = Point3(self.handPos[0] - rightHandPos[0],
                                       self.handPos[1] - rightHandPos[1], 0)
     destZScale = rightHandPos[2] / self.handPos[2]
     grabIval = Sequence(
         Func(toon.wrtReparentTo, self.waterPitcherNode),
         Func(toon.loop, 'neutral'),
         Parallel(
             ActorInterval(toon, 'jump'),
             Sequence(
                 Wait(0.43),
                 Parallel(
                     ProjectileInterval(toon,
                                        duration=0.9,
                                        startPos=toon.getPos(
                                            self.waterPitcherNode),
                                        endPos=self.toonPitcherPosition),
                     LerpHprInterval(toon, 0.9, Point3(0, 0, 0)),
                     LerpScaleInterval(self.waterPitcherModel, 0.9,
                                       Point3(1, 1, destZScale))))),
         Func(toon.setPos, self.toonPitcherPosition),
         Func(toon.loop, 'leverNeutral'))
     return grabIval
 def enterOpening(self, ts):
     bldgActor = self.getBuildingActor()
     rightDoor = bldgActor.controlJoint(None, 'modelRoot', 'def_right_door')
     if rightDoor.isEmpty():
         self.notify.warning('enterOpening(): did not find rightDoor')
         return
     otherNP = self.getDoorNodePath()
     trackName = 'doorOpen-%d' % self.doId
     if self.rightSwing:
         h = 100
     else:
         h = -100
     self.finishDoorTrack()
     self.doorTrack = Parallel(SoundInterval(self.openSfx, node=rightDoor),
                               Sequence(
                                   HprInterval(rightDoor, VBase3(0, 0, 0)),
                                   Wait(0.4),
                                   LerpHprInterval(nodePath=rightDoor,
                                                   duration=0.6,
                                                   hpr=VBase3(h, 0, 0),
                                                   startHpr=VBase3(0, 0, 0),
                                                   blendType='easeInOut')),
                               name=trackName)
     self.doorTrack.start(ts)
     return
 def spin(self):
     self.stopSpin()
     self.spinIval = LerpHprInterval(self.bean,
                                     duration=3.0,
                                     hpr=Vec3(360, 0, 0),
                                     startHpr=(0, 0, 0))
     self.spinIval.loop()
Beispiel #21
0
 def fillSlot(self, index, avId):
     toon = self.cr.doId2do.get(avId)
     if toon:
         point = ElevatorPoints[index]
         toon.stopSmooth()
         toon.wrtReparentTo(self.getElevatorModel())
         toon.headsUp(point)
         track = Sequence()
         track.append(Func(toon.animFSM.request, 'run'))
         track.append(
             LerpPosInterval(toon,
                             duration=0.5,
                             pos=point,
                             startPos=toon.getPos(self.getElevatorModel())))
         track.append(
             LerpHprInterval(toon,
                             duration=0.1,
                             hpr=(180, 0, 0),
                             startHpr=toon.getHpr(self.getElevatorModel())))
         track.append(Func(toon.animFSM.request, 'neutral'))
         if avId == base.localAvatar.doId:
             self.localAvOnElevator = True
             track.append(Func(self.showHopOffButton))
             base.localAvatar.stopSmartCamera()
             base.localAvatar.walkControls.setCollisionsActive(0)
             base.camera.wrtReparentTo(self.getElevatorModel())
             cameraBoardTrack = LerpPosHprInterval(camera, 1.5,
                                                   Point3(0, -16, 5.5),
                                                   Point3(0, 0, 0))
             cameraBoardTrack.start()
         track.start()
 def exitDoorEnterOpening(self, ts):
     bldgActor = self.getBuildingActor()
     leftDoor = bldgActor.controlJoint(None, 'modelRoot', 'def_left_door')
     if self.leftSwing:
         h = -100
     else:
         h = 100
     if not leftDoor.isEmpty():
         otherNP = self.getDoorNodePath()
         trackName = 'doorDoorExitTrack-%d' % self.doId
         self.finishDoorExitTrack()
         self.doorExitTrack = Parallel(SoundInterval(self.openSfx,
                                                     node=leftDoor),
                                       Sequence(
                                           LerpHprInterval(
                                               nodePath=leftDoor,
                                               duration=0.6,
                                               hpr=VBase3(h, 0, 0),
                                               startHpr=VBase3(0, 0, 0),
                                               blendType='easeInOut')),
                                       name=trackName)
         self.doorExitTrack.start(ts)
     else:
         self.notify.warning(
             'exitDoorEnterOpening(): did not find leftDoor')
     return
 def enterClosing(self, ts):
     bldgActor = self.getBuildingActor()
     rightDoor = bldgActor.controlJoint(None, 'modelRoot', 'def_right_door')
     if rightDoor.isEmpty():
         self.notify.warning('enterClosing(): did not find rightDoor')
         return
     otherNP = self.getDoorNodePath()
     trackName = 'doorClose-%d' % self.doId
     if self.rightSwing:
         h = 100
     else:
         h = -100
     self.finishDoorTrack()
     self.doorTrack = Sequence(LerpHprInterval(nodePath=rightDoor,
                                               duration=1.0,
                                               hpr=VBase3(0, 0, 0),
                                               startHpr=VBase3(h, 0, 0),
                                               blendType='easeInOut'),
                               SoundInterval(self.closeSfx, node=rightDoor),
                               name=trackName)
     self.doorTrack.start(ts)
     if hasattr(self, 'done'):
         request = self.getRequestStatus()
         messenger.send('doorDoneEvent', [request])
     return
Beispiel #24
0
    def getVictoryRunTrack(self):
        origPosTrack = Sequence()
        delayDeletes = []
        i = 0
        for victor in self.victorList:
            if victor != 0 and victor in self.cr.doId2do:
                toon = self.cr.doId2do[victor]
                delayDeletes.append(
                    DelayDelete.DelayDelete(toon, 'getVictoryRunTrack'))
                toon.stopSmooth()
                toon.setParent(CIGlobals.SPHidden)
                origPosTrack.append(
                    Func(toon.setPosHpr, self.elevatorNodePath,
                         apply(Point3, ElevatorPoints[i]), Point3(180, 0, 0)))
                origPosTrack.append(Func(toon.setParent, CIGlobals.SPRender))
            i += 1

        openDoors = getOpenInterval(self, self.leftDoor, self.rightDoor,
                                    self.openSfx, None)
        toonDoorPosHpr = self.cr.playGame.dnaStore.getDoorPosHprFromBlockNumber(
            self.block)
        useFarExitPoints = toonDoorPosHpr.getPos(render).getZ() > 1.0
        runOutAll = Parallel()
        i = 0
        for victor in self.victorList:
            if victor != 0 and victor in self.cr.doId2do:
                toon = self.cr.doId2do[victor]
                p0 = Point3(0, 0, 0)
                p1 = Point3(ElevatorPoints[i][0], ElevatorPoints[i][1] - 5.0,
                            ElevatorPoints[i][2])
                if useFarExitPoints:
                    p2 = Point3(ElevatorOutPointsFar[i][0],
                                ElevatorOutPointsFar[i][1],
                                ElevatorOutPointsFar[i][2])
                else:
                    p2 = Point3(ElevatorOutPoints[i][0],
                                ElevatorOutPoints[i][1],
                                ElevatorOutPoints[i][2])
                runOutSingle = Sequence(
                    Func(toon.animFSM.request, 'run'),
                    LerpPosInterval(toon,
                                    TOON_VICTORY_EXIT_TIME * 0.25,
                                    p1,
                                    other=self.elevatorNodePath),
                    Func(toon.headsUp, self.elevatorNodePath, p2),
                    LerpPosInterval(toon,
                                    TOON_VICTORY_EXIT_TIME * 0.5,
                                    p2,
                                    other=self.elevatorNodePath),
                    LerpHprInterval(toon,
                                    TOON_VICTORY_EXIT_TIME * 0.25,
                                    Point3(0, 0, 0),
                                    other=self.elevatorNodePath),
                    Func(toon.animFSM.request, 'neutral'),
                    Func(toon.startSmooth))
                runOutAll.append(runOutSingle)
            i += 1

        victoryRunTrack = Sequence(origPosTrack, openDoors, runOutAll)
        return (victoryRunTrack, delayDeletes)
Beispiel #25
0
 def handleJumpHardLand(self):
     down = Parallel(
         LerpPosInterval(base.cam,
                         0.1, (-0.1, 0, -0.2), (0, 0, 0),
                         blendType='easeOut'),
         LerpHprInterval(base.cam,
                         0.1, (0, 0, -2.5), (0, 0, 0),
                         blendType='easeOut'))
     up = Parallel(
         LerpPosInterval(base.cam,
                         0.7, (0, 0, 0), (-0.1, 0, -0.2),
                         blendType='easeInOut'),
         LerpHprInterval(base.cam,
                         0.7, (0, 0, 0), (0, 0, -2.5),
                         blendType='easeInOut'))
     Sequence(down, up).start()
 def turnDown(self, doInterval = DoIntervalDefault):
     self.faceUp = 0
     if doInterval:
         self.clearFlipIval()
         self.flipIval = Parallel(LerpHprInterval(self, self.FlipTime, Vec3(0, 0, 180)), SoundInterval(self.turnDownSound, node=self, listenerNode=base.localAvatar, cutOff=240))
         self.flipIval.start()
     else:
         self.setR(180)
Beispiel #27
0
 def spin(self):
     part = self.suit
     time = Globals.BossSpinTime
     degrees = 360 * Globals.BossSpinCount
     spinIval = LerpHprInterval(part,
                                time, (self.suit.getH() + degrees, 0, 0),
                                blendType='easeOut')
     spinIval.start()
Beispiel #28
0
 def addInterval(wallID, negRotation=False):
     self.seq.append(Func(reparentCubes, wallID))
     rot = rotations[wallID]["hpr"]
     if negRotation:
         rot = rot * -1.
     self.seq.append(LerpHprInterval(pivots[wallID], 0.0025, rot))
     self.seq.append(Func(updateCubeMembership, wallID, negRotation))
     print "Added " + ("negative " if negRotation else "") + wallID + " rotation."
Beispiel #29
0
 def aggIntervalo(wallID, negRotacion=False):
     self.sec.append(Func(reparentCubos, wallID))
     rot = rotaciones[wallID]["hpr"]
     if negRotacion:
         rot = rot * -1.
     # 1.0 es la velocidad de rotación, 2.5 es más lenta.
     self.sec.append(LerpHprInterval(pivotes[wallID], 0.5, rot))
     self.sec.append(Func(actualizarEstadoCubo, wallID, negRotacion))
Beispiel #30
0
Datei: t.py Projekt: locky12/AI
 def addInterval(wallID, negRotation=False):
     self.seq.append(Func(reparentCubes, wallID))
     rot = rotations[wallID]["hpr"]
     if negRotation:
         rot = rot * -1.
     #Revision: 1.0 is the speed of rotation, 2.5 is slower.
     self.seq.append(LerpHprInterval(pivots[wallID], 1.0, rot))
     self.seq.append(Func(updateCubeMembership, wallID, negRotation))