Ejemplo n.º 1
0
 def enterState1(self):
     FourState.FourState.enterState1(self)
     beat = self.duration * 0.02
     slideSfx = base.loader.loadSfx(
         'phase_9/audio/sfx/CHQ_FACT_arms_retracting.ogg')
     self.setTrack(
         Sequence(
             Wait(beat * 1.0),
             Parallel(
                 SoundInterval(slideSfx, node=self.door.node, volume=0.8),
                 Sequence(
                     ShowInterval(self.leftNodePath),
                     ShowInterval(self.rightNodePath),
                     Parallel(
                         LerpPosInterval(nodePath=self.leftNodePath,
                                         other=self.lockedNodePath,
                                         duration=beat * 16.0,
                                         pos=Vec3(0.0),
                                         blendType='easeIn'),
                         LerpPosInterval(nodePath=self.rightNodePath,
                                         other=self.lockedNodePath,
                                         duration=beat * 16.0,
                                         pos=Vec3(0.0),
                                         blendType='easeIn')),
                     HideInterval(self.leftNodePath),
                     HideInterval(self.rightNodePath),
                     ShowInterval(self.lockedNodePath)))))
Ejemplo n.º 2
0
 def enterState3(self):
     FourState.FourState.enterState3(self)
     unlockSfx = base.loader.loadSfx(
         'phase_9/audio/sfx/CHQ_FACT_door_unlock.ogg')
     slideSfx = base.loader.loadSfx(
         'phase_9/audio/sfx/CHQ_FACT_arms_retracting.ogg')
     beat = self.duration * 0.02
     self.setTrack(
         Sequence(
             Wait(beat * 1),
             Parallel(
                 SoundInterval(unlockSfx, node=self.door.node, volume=0.8),
                 SoundInterval(slideSfx, node=self.door.node, volume=0.8),
                 Sequence(
                     HideInterval(self.lockedNodePath),
                     ShowInterval(self.leftNodePath),
                     ShowInterval(self.rightNodePath),
                     Parallel(
                         LerpPosInterval(nodePath=self.leftNodePath,
                                         other=self.lockedNodePath,
                                         duration=beat * 16,
                                         pos=self.slideLeft,
                                         blendType='easeOut'),
                         LerpPosInterval(nodePath=self.rightNodePath,
                                         other=self.lockedNodePath,
                                         duration=beat * 16,
                                         pos=self.slideRight,
                                         blendType='easeOut')),
                     HideInterval(self.leftNodePath),
                     HideInterval(self.rightNodePath)))))
 def setGrab(self, avId):
     self.collNodePath.stash()
     self.avId = avId
     if self.cr.doId2do.has_key(avId):
         self.av = self.cr.doId2do[avId]
     else:
         self.nodePath.detachNode()
         return
     if self.playSoundForRemoteToons or self.avId == base.localAvatar.doId:
         base.playSfx(self.grabSound, node=self.nodePath)
     if not self.fly:
         self.nodePath.detachNode()
         return
     self.cleanupTrack()
     taskMgr.remove(str(self.spinTaskName))
     avatarGoneName = self.av.uniqueName('disable')
     self.accept(avatarGoneName, self.handleUnexpectedExit)
     flyTime = 1.0
     track = Sequence(
         LerpPosInterval(self.nodePath,
                         flyTime,
                         pos=Point3(0, 0, 3),
                         startPos=self.nodePath.getPos(self.av),
                         blendType='easeInOut'),
         Func(self.nodePath.detachNode), Func(self.ignore, avatarGoneName))
     if self.shadow:
         self.treasureTrack = Sequence(HideInterval(self.dropShadow),
                                       track,
                                       ShowInterval(self.dropShadow),
                                       name='treasureFlyTrack')
     else:
         self.treasureTrack = Sequence(track, name='treasureFlyTrack')
     self.nodePath.reparentTo(self.av)
     self.treasureTrack.start()
Ejemplo n.º 4
0
    def init_shot_animation(self,
                            animate_stroke=True,
                            trailing_buffer=0,
                            leading_buffer=0):
        if not len(self.events):
            try:
                self.simulate()
            except:
                pass

        if not self.continuized:
            # playback speed / fps * 2.0 is basically the sweetspot for creating smooth
            # interpolations that capture motion. Any more is wasted computation and any less and
            # the interpolation starts to look bad.
            if self.playback_speed > 0.99:
                self.continuize(dt=self.playback_speed /
                                ani.settings['graphics']['fps'] * 2.5)
            else:
                self.continuize(dt=self.playback_speed /
                                ani.settings['graphics']['fps'] * 1.5)

        if self.ball_animations is None:
            # This takes ~90% of this method's execution time
            self.ball_animations = Parallel()
            for ball in self.balls.values():
                if not ball.rendered:
                    ball.render()
                ball.set_playback_sequence(playback_speed=self.playback_speed)
                self.ball_animations.append(ball.playback_sequence)

        if self.user_stroke and animate_stroke:
            # There exists a stroke trajectory, and animating the stroke has been requested
            self.cue.set_stroke_sequence()
            self.stroke_animation = Sequence(
                ShowInterval(self.cue.get_node('cue_stick')),
                self.cue.stroke_sequence,
                HideInterval(self.cue.get_node('cue_stick')),
            )
            self.shot_animation = Sequence(self.stroke_animation,
                                           self.ball_animations,
                                           Wait(trailing_buffer),
                                           Func(self.restart_ball_animations))
        else:
            self.cue.hide_nodes()
            self.stroke_animation = None
            self.shot_animation = Sequence(self.ball_animations,
                                           Wait(trailing_buffer),
                                           Func(self.restart_ball_animations))
Ejemplo n.º 5
0
    def init_shot_animation(self):

        self.ball_animations = Parallel()
        for ball in self.balls.values():
            ball.set_playback_sequence(playback_speed=self.playback_speed)
            self.ball_animations.append(ball.playback_sequence)

        self.cue.set_stroke_sequence()

        self.stroke_animation = Sequence(
            ShowInterval(self.cue.get_node('cue_stick')),
            self.cue.stroke_sequence,
            HideInterval(self.cue.get_node('cue_stick')),
        )

        self.shot_animation = Sequence(self.stroke_animation,
                                       self.ball_animations,
                                       Func(self.restart_ball_animations))