Esempio n. 1
0
 def exitSquish(self):
     if self.track:
         self.ignore(self.track.getName())
         DelayDelete.cleanupDelayDeletes(self.track)
         self.track.finish()
         self.track = None
     self.playingAnim = 'neutral'
     return
Esempio n. 2
0
 def exitDied(self):
     if self.track != None:
         self.ignore(self.track.getDoneEvent())
         self.track.finish()
         DelayDelete.cleanupDelayDeletes(self.track)
         self.track = None
     self.rescaleToon()
     self.playingAnim = 'neutral'
     return
Esempio n. 3
0
 def cleanup(self):
     if self.suitTrack != None:
         self.ignore(self.suitTrack.getDoneEvent())
         self.suitTrack.finish()
         DelayDelete.cleanupDelayDeletes(self.suitTrack)
         self.suitTrack = None
     self.attack = None
     self.suit = None
     self.attacksClass = None
     self.attackName2attackId = None
     return
Esempio n. 4
0
 def exitTeleportOut(self):
     self.notify.info(str(self.doId) + '-' + str(self.zoneId) + ': exitTeleportOut')
     if self.track != None:
         self.ignore(self.track.getName())
         self.track.finish()
         DelayDelete.cleanupDelayDeletes(self.track)
         self.track = None
     if self.portal1:
         self.portal1.cleanup()
         self.portal1 = None
     self.playingAnim = 'neutral'
     return
Esempio n. 5
0
 def stopAnimations(self):
     if hasattr(self, 'animFSM'):
         if not self.animFSM.isInternalStateInFlux():
             self.animFSM.request('off')
         else:
             notify.warning('animFSM in flux, state=%s, not requesting off' % self.animFSM.getCurrentState().getName())
     else:
         notify.warning('animFSM has been deleted')
     if self.track != None:
         self.track.finish()
         DelayDelete.cleanupDelayDeletes(self.track)
         self.track = None
     return
Esempio n. 6
0
 def exitTeleportIn(self):
     if self.track != None:
         self.ignore(self.track.getName())
         self.track.finish()
         DelayDelete.cleanupDelayDeletes(self.track)
         self.track = None
     if self.portal2:
         self.portal2.cleanup()
         self.portal2 = None
     if self.getGeomNode():
         self.getGeomNode().show()
     if self.getNameTag():
         self.getNameTag().show()
     self.playingAnim = 'neutral'
     return
Esempio n. 7
0
 def disable(self):
     self.busy = None
     taskMgr.remove(self.uniqueName('sBAL'))
     taskMgr.remove(self.uniqueName('blinkOnTurn'))
     if self.track != None:
         self.track.finish()
         DelayDelete.cleanupDelayDeletes(self.track)
         self.track = None
     self.stopBlink()
     self.__removeHeadMeter()
     self.ignore('showAvId')
     self.ignore('showName')
     self.token = None
     Toon.Toon.disable(self)
     DistributedAvatar.disable(self)
     return
 def enterTeleportIn(self, ts=0, callback=None, extraArgs=[]):
     self.playingAnim = 'happy'
     self.portal2 = Actor(
         "phase_3.5/models/props/portal-mod.bam",
         {"chan": "phase_3.5/models/props/portal-chan.bam"})
     self.show()
     self.getGeomNode().hide()
     self.nametag3d.hide()
     self.track = self.getTeleportInTrack(self.portal2)
     self.track.setDoneEvent(self.track.getName())
     self.acceptOnce(self.track.getName(), self.teleportInDone,
                     [callback, extraArgs])
     self.track.delayDelete = DelayDelete.DelayDelete(
         self, self.track.getName())
     self.track.start(ts)
Esempio n. 9
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 enterDied(self, ts=0, callback=None, extraArgs=[]):
     self.playingAnim = 'lose'
     self.isdying = True
     self.play("lose")
     self.track = Sequence(Wait(2.2),
                           Func(self.dieSfx),
                           Wait(2.8),
                           self.getGeomNode().scaleInterval(
                               2,
                               Point3(0.01),
                               startScale=(self.getGeomNode().getScale())),
                           Func(self.delToon),
                           name=self.uniqueName('enterDied'))
     self.track.setDoneEvent(self.track.getName())
     self.acceptOnce(self.track.getDoneEvent(), self.diedDone,
                     [callback, extraArgs])
     self.track.delayDelete = DelayDelete.DelayDelete(
         self, 'enterTeleportOut')
     self.track.start(ts)
    def enterDie(self, ts = 0):
        self.show()
        self.generateLoserSuit()
        self.clearChat()
        self.state = "dead"
        self.play("lose")
        deathSound = base.audio3d.loadSfx("phase_3.5/audio/sfx/Cog_Death_Full.ogg")
        base.audio3d.attachSoundToObject(deathSound, self)
        trackName = self.uniqueName('enterDie')

        smallGears = ParticleLoader.loadParticleEffect('phase_3.5/etc/gearExplosionSmall.ptf')
        smallGears.getParticlesNamed('particles-1').setPoolSize(30)

        singleGear = ParticleLoader.loadParticleEffect('phase_3.5/etc/gearExplosion.ptf')
        singleGear.getParticlesNamed('particles-1').setPoolSize(1)

        smallGearExplosion = ParticleLoader.loadParticleEffect('phase_3.5/etc/gearExplosion.ptf')
        smallGearExplosion.getParticlesNamed('particles-1').setPoolSize(10)

        bigGearExplosion = ParticleLoader.loadParticleEffect('phase_3.5/etc/gearExplosionBig.ptf')
        bigGearExplosion.getParticlesNamed('particles-1').setPoolSize(30)

        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)

        self.smallGears = smallGears
        self.smallGears.setPos(self.find('**/joint_head').getPos() + (0,0, 2))
        self.singleGear = singleGear
        self.smallGearExp = smallGearExplosion
        self.bigGearExp = bigGearExplosion

        gearTrack = Sequence(Wait(0.7), Func(self.doSingleGear), Wait(1.5), Func(self.doSmallGears), Wait(3.0), Func(self.doBigExp))
        self.suitTrack = Parallel(Sequence(Wait(0.7), Func(self.doSingleGear), Wait(4.3),
                Func(self.suitExplode), Wait(1.0), Func(self.delSuit)), gearTrack, name = trackName)
        self.suitTrack.setDoneEvent(self.suitTrack.getName())
        Sequence(Wait(0.8), SoundInterval(deathSound)).start()
        self.acceptOnce(self.suitTrack.getName(), self.exitDie)
        if "Distributed" in self.__class__.__name__:
            self.suitTrack.delayDelete = DelayDelete.DelayDelete(self, trackName)
        self.suitTrack.start(ts)
        del deathSound
Esempio n. 12
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)
Esempio n. 13
0
 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 getAvatarExitTrack(self, av):
     track = Sequence(name=av.uniqueName('avatarExitDoorTrack'))
     track.append(Wait(1.3))
     track.append(Func(av.setAnimState, 'walk'))
     av.setPos(self.exitDoorWalkFromNode.getPos(render))
     av.headsUp(self.exitDoorWalkToNode)
     track.append(
         LerpPosInterval(av,
                         duration=1.2,
                         pos=self.exitDoorWalkToNode.getPos(render),
                         startPos=av.getPos(render)))
     track.append(Func(av.loop, 'neutral'))
     if base.localAvatar.doId == av.doId:
         track.append(
             Func(messenger.send,
                  'DistributedDoor_localAvatarCameOutOfDoor'))
     else:
         track.append(Func(av.startSmooth))
     track.setDoneEvent(track.getName())
     track.delayDelete = DelayDelete.DelayDelete(av, track.getName())
     self.acceptOnce(track.getDoneEvent(), self.__avatarTrackDone, [track])
     return track
 def enterFlyAway(self, ts = 0):
     self.show()
     self.fa_sfx = base.audio3d.loadSfx("phase_5/audio/sfx/ENC_propeller_out.ogg")
     self.prop = Actor("phase_4/models/props/propeller-mod.bam",
                     {"chan": "phase_4/models/props/propeller-chan.bam"})
     base.audio3d.attachSoundToObject(self.fa_sfx, self.prop)
     self.fa_sfx.play()
     self.prop.reparentTo(self.find('**/joint_head'))
     self.prop.setPlayRate(-1.0, "chan")
     if hasattr(self, 'uniqueName'):
         name = self.uniqueName('enterFlyAway')
     else:
         name = 'enterFlyAway'
     self.suitTrack = Sequence(Func(self.prop.play, 'chan', fromFrame=3),
                         Wait(1.75),
                         Func(self.prop.play, 'chan', fromFrame=0, toFrame=3), name = name)
     self.suitTrack.setDoneEvent(self.suitTrack.getName())
     self.acceptOnce(self.suitTrack.getDoneEvent(), self.exitFlyAway)
     self.suitTrack.delayDelete = DelayDelete.DelayDelete(self, name)
     self.suitTrack.start(ts)
     self.setPlayRate(-1.0, 'land')
     self.play('land')
 def getAvatarEnterTrack(self, av):
     track = Sequence(name=av.uniqueName('avatarEnterDoorTrack'))
     track.append(Func(av.setAnimState, 'walkBack'))
     track.append(
         ParallelEndTogether(
             LerpPosInterval(av,
                             duration=0.5,
                             pos=self.enterDoorWalkBackNode.getPos(render),
                             startPos=av.getPos(render)),
             LerpQuatInterval(av,
                              duration=0.5,
                              quat=self.enterDoorWalkInNode.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,
             pos=self.enterDoorWalkInNode.getPos(render),
             startPos=self.enterDoorWalkBackNode.getPos(render)))
     if base.localAvatar.doId == av.doId:
         parallel.append(
             Sequence(
                 Wait(0.5),
                 Func(messenger.send,
                      'DistributedDoor_localAvatarGoingInDoor'), Wait(1.0)))
     track.append(parallel)
     if base.localAvatar.doId == av.doId:
         track.append(
             Func(messenger.send, 'DistributedDoor_localAvatarWentInDoor'))
     track.setDoneEvent(track.getName())
     track.delayDelete = DelayDelete.DelayDelete(av, track.getName())
     self.acceptOnce(track.getDoneEvent(), self.__avatarTrackDone, [track])
     return track
Esempio n. 17
0
 def enterFlyDown(self, ts = 0):
     self.disableRay()
     self.enableShadowRay()
     if not self.propeller:
         self.generatePropeller()
     sfx = self.propellerSounds['in']
     base.playSfx(sfx, node = self)
     groundF = 28
     dur = self.getDuration('land')
     fr = self.getFrameRate('land')
     if fr:
         animTimeInAir = groundF / fr
     else:
         animTimeInAir = groundF
     impactLength = dur - animTimeInAir
     timeTillLanding = 6.5 - impactLength
     waitTime = timeTillLanding - animTimeInAir
     lastSpinFrame = 8
     propDur = self.propeller.getDuration('chan')
     fr = self.propeller.getFrameRate('chan')
     spinTime = lastSpinFrame / fr
     openTime = (lastSpinFrame + 1) / fr
     if hasattr(self, 'uniqueName'):
         name = self.uniqueName('enterFlyDown')
     else:
         name = 'enterFlyDown'
     animTrack = Sequence(Func(self.pose, 'land', 0), Wait(waitTime), ActorInterval(self, 'land', duration=dur))
     propTrack = Parallel(SoundInterval(sfx, duration=waitTime + dur, node=self), Sequence(ActorInterval(self.propeller, 'chan', constrainedLoop=1, duration=waitTime + spinTime, startTime=0.0, endTime=spinTime), ActorInterval(self.propeller, 'chan', duration=propDur - openTime, startTime=openTime)))
     self.suitTrack = Parallel(animTrack, propTrack, name=self.taskName('flyDown'))
     if not self.hasSpawned:
         self.show()
         fadeInTrack = Sequence(Func(self.setTransparency, 1), self.colorScaleInterval(1, colorScale=VBase4(1, 1, 1, 1), startColorScale=VBase4(1, 1, 1, 0)), Func(self.clearColorScale), Func(self.clearTransparency))
         self.hasSpawned = True
         self.suitTrack.append(fadeInTrack)
     self.suitTrack.setDoneEvent(self.suitTrack.getName())
     self.acceptOnce(self.suitTrack.getDoneEvent(), self.exitFlyDown)
     self.suitTrack.delayDelete = DelayDelete.DelayDelete(self, name)
     self.suitTrack.start(ts)
Esempio n. 18
0
 def _deleteTransitionTrack(self):
     if self.transitionTrack:
         DelayDelete.cleanupDelayDeletes(self.transitionTrack)
         self.transitionTrack = None
Esempio n. 19
0
 def __avatarTrackDone(self, track):
     if track:
         DelayDelete.cleanupDelayDeletes(track)
         if self.avatarTracks:
             self.avatarTracks.remove(track)
Esempio n. 20
0
    def enterDie(self, ts=0):
        self.show()
        self.clearStunnedIval()
        self.generateCog(isLose=1)
        self.nametag.clearChatText()
        self.deleteNameTag()
        self.deathSound = base.audio3d.loadSfx(
            "phase_3.5/audio/sfx/Cog_Death_Full.ogg")
        base.audio3d.attachSoundToObject(self.deathSound, self)
        trackName = self.uniqueName('enterDie')

        smallGears = ParticleLoader.loadParticleEffect(
            'phase_3.5/etc/gearExplosionSmall.ptf')
        #smallGears.getParticlesNamed('particles-1').setPoolSize(30)

        singleGear = ParticleLoader.loadParticleEffect(
            'phase_3.5/etc/gearExplosion.ptf')
        singleGear.getParticlesNamed('particles-1').setPoolSize(1)

        smallGearExplosion = ParticleLoader.loadParticleEffect(
            'phase_3.5/etc/gearExplosion.ptf')
        smallGearExplosion.getParticlesNamed('particles-1').setPoolSize(10)

        bigGearExplosion = ParticleLoader.loadParticleEffect(
            'phase_3.5/etc/gearExplosionBig.ptf')
        bigGearExplosion.getParticlesNamed('particles-1').setPoolSize(30)

        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)

        gearPoint = self.getPos(render) + (0, 0, self.getHeight() - 0.2)

        self.smallGears = smallGears
        self.smallGears.setPos(gearPoint)
        self.singleGear = singleGear
        self.singleGear.setPos(gearPoint)
        self.smallGearExp = smallGearExplosion
        self.smallGearExp.setPos(gearPoint)
        self.bigGearExp = bigGearExplosion
        self.bigGearExp.setPos(gearPoint)

        gearTrack = Sequence(Wait(0.7), Func(self.doSingleGear), Wait(1.5),
                             Func(self.doSmallGears), Wait(3.0),
                             Func(self.doBigExp))
        self.suitTrack = Parallel(
            Sequence(Wait(0.8), SoundInterval(self.deathSound, duration=4.28)),
            Sequence(Wait(0.7), Func(self.doSingleGear), Wait(4.5),
                     Func(self.suitExplode), Wait(1.0),
                     Func(self.disableBodyCollisions)),
            gearTrack,
            Sequence(ActorInterval(self, 'lose', duration=6),
                     Func(self.getGeomNode().hide)),
            name=trackName)
        self.suitTrack.setDoneEvent(self.suitTrack.getName())
        self.acceptOnce(self.suitTrack.getName(), self.exitDie)
        if self.isDistributed():
            self.suitTrack.delayDelete = DelayDelete.DelayDelete(
                self, trackName)
        self.suitTrack.start(ts)