def getTossPieInterval(self,
                           toon,
                           x,
                           y,
                           z,
                           h,
                           p,
                           r,
                           power,
                           beginFlyIval=Sequence()):
        ToontownBattleGlobals = ToontownBattleGlobals
        import toontown.toonbase
        BattleProps = BattleProps
        import toontown.battle
        pie = toon.getPieModel()
        pie.setScale(0.90000000000000002)
        flyPie = pie.copyTo(NodePath('a'))
        pieName = ToontownBattleGlobals.pieNames[toon.pieType]
        pieType = BattleProps.globalPropPool.getPropType(pieName)
        animPie = Sequence()
        if pieType == 'actor':
            animPie = ActorInterval(pie, pieName, startFrame=48)

        sound = loader.loadSfx('phase_3.5/audio/sfx/AA_pie_throw_only.mp3')
        t = power / 100.0
        dist = 100 - 70 * t
        time = 1 + 0.5 * t
        proj = ProjectileInterval(None,
                                  startPos=Point3(0, 0, 0),
                                  endPos=Point3(0, dist, 0),
                                  duration=time)
        relVel = proj.startVel

        def getVelocity(toon=toon, relVel=relVel):
            return render.getRelativeVector(toon, relVel) * 0.59999999999999998

        toss = Track(
            (0,
             Sequence(
                 Func(toon.setPosHpr, x, y, z, h, p, r),
                 Func(pie.reparentTo, toon.rightHand),
                 Func(pie.setPosHpr, 0, 0, 0, 0, 0, 0),
                 Parallel(
                     ActorInterval(
                         toon, 'throw', startFrame=48, partName='torso'),
                     animPie), Func(toon.loop, 'neutral'))),
            (16.0 / 24.0, Func(pie.detachNode)))
        fly = Track(
            (14.0 / 24.0, SoundInterval(sound, node=toon)),
            (16.0 / 24.0,
             Sequence(
                 Func(flyPie.reparentTo, render),
                 Func(flyPie.setPosHpr, toon, 0.52000000000000002,
                      0.96999999999999997, 2.2400000000000002, 0, -45, 0),
                 beginFlyIval,
                 ProjectileInterval(flyPie, startVel=getVelocity, duration=6),
                 Func(flyPie.detachNode))))
        return (toss, fly, flyPie)
示例#2
0
    def getThrowInterval(self, gag, x, y, z, h, p, r):
        toon = self.toon
        flyGag = self.createThrowGag(gag)
        throwSoundIval = self._throwSfx
        if throwSoundIval.isPlaying():
            throwSoundIval.finish()
        throwSoundIval.node = toon
        toonThrowIval1 = ActorInterval(toon, 'throw', startFrame=Globals.ThrowStartFrame, endFrame=Globals.ThrowEndFrame, playRate=Globals.ThrowPlayRate, partName='torso')
        toss = Track((0, Sequence(Func(toon.setPosHpr, x, y, z, h, p, r), Func(gag.reparentTo, toon.rightHand), Func(gag.setPosHpr, 0, 0, 0, 0, 0, 0), toonThrowIval1)), (toonThrowIval1.getDuration(), Parallel(Func(gag.detachNode), Sequence(ActorInterval(toon, 'throw', startFrame=Globals.ThrowEndFrame + 1, playRate=Globals.ThrowPlayRate, partName='torso'), Func(self.completeThrow)))))

        def getEndPos(toon = toon):
            return render.getRelativePoint(toon, Point3(0, Globals.ThrowDistance, 0))

        fly = Track((0, throwSoundIval), (toonThrowIval1.getDuration(), Sequence(Func(flyGag.reparentTo, render), Func(flyGag.setPosHpr, toon, 0.52, 0.97, 2.24, 0, -45, 0), ProjectileInterval(flyGag, endPos=getEndPos, duration=Globals.ThrowDuration), Func(flyGag.detachNode))))
        return (toss, fly, flyGag)
 def setHillType(self, type):
     if self.isUp:
         if (self.hillType == MoleFieldBase.HILL_MOLE or type == MoleFieldBase.HILL_BOMB or self.hillType == MoleFieldBase.HILL_BOMB) and type == MoleFieldBase.HILL_MOLE:
             return None
         
     self.hillType = type
     self.moleHead.remove()
     if type == MoleFieldBase.HILL_MOLE:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm')
         self.moleColNodePath.setScale(3.0)
         self.moleHead.setH(0)
         self.mole.setBillboardAxis(localAvatar, 0)
     
     if type == MoleFieldBase.HILL_BOMB or type == MoleFieldBase.HILL_COGWHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_cog')
         self.moleColNodePath.setScale(1.0)
         self.mole.setBillboardAxis(localAvatar, 0)
         if type == MoleFieldBase.HILL_COGWHACKED:
             self.doMoleDown()
             BattleParticles.loadParticles()
             singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles = 1)
             smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles = 10)
             bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles = 30)
             gears2MTrack = Track((0.0, ParticleInterval(singleGear, self.hill, worldRelative = 1, duration = 5.7000000000000002, cleanup = True)), (0.0, ParticleInterval(smallGearExplosion, self.hill, worldRelative = 0, duration = 1.2, cleanup = True)), (0.29999999999999999, ParticleInterval(bigGearExplosion, self.hill, worldRelative = 0, duration = 1.0, cleanup = True)), name = 'gears2MTrack')
             gears2MTrack.start()
             self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.23000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.28000000000000003)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.34999999999999998, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28000000000000003, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.31, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.32000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.47999999999999998)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28999999999999998, 0.0)))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_BOMB))
             self.popIval.start()
         else:
             self.moleHead.setH(0)
     
     if type == MoleFieldBase.HILL_WHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_hit')
         self.mole.setBillboardAxis(0)
         self.moleColNodePath.setScale(0.0)
         if self.popIval:
             self.popIval.finish()
         
         if self.downIval:
             self.downIval.finish()
         
         self.mole.setPos(0.0, 0.0, 0.0)
         self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.14999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.12, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.14999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.16, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17000000000000001)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.0))), Sequence(LerpScaleInterval(self.moleHead, 0.5, 3.5), LerpScaleInterval(self.moleHead, 0.5, 1.0))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_MOLE))
         self.popIval.start()
     
     self.moleHead.reparentTo(self.mole)
示例#4
0
 def setHillType(self, type):
     if self.isUp:
         if (self.hillType == MoleFieldBase.HILL_MOLE or type == MoleFieldBase.HILL_BOMB or self.hillType == MoleFieldBase.HILL_BOMB) and type == MoleFieldBase.HILL_MOLE:
             return None
         
     self.hillType = type
     self.moleHead.remove()
     if type == MoleFieldBase.HILL_MOLE:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm')
         self.moleColNodePath.setScale(3.0)
         self.moleHead.setH(0)
         self.mole.setBillboardAxis(localAvatar, 0)
     
     if type == MoleFieldBase.HILL_BOMB or type == MoleFieldBase.HILL_COGWHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_cog')
         self.moleColNodePath.setScale(1.0)
         self.mole.setBillboardAxis(localAvatar, 0)
         if type == MoleFieldBase.HILL_COGWHACKED:
             self.doMoleDown()
             BattleParticles.loadParticles()
             singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles = 1)
             smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles = 10)
             bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles = 30)
             gears2MTrack = Track((0.0, ParticleInterval(singleGear, self.hill, worldRelative = 1, duration = 5.7000000000000002, cleanup = True)), (0.0, ParticleInterval(smallGearExplosion, self.hill, worldRelative = 0, duration = 1.2, cleanup = True)), (0.29999999999999999, ParticleInterval(bigGearExplosion, self.hill, worldRelative = 0, duration = 1.0, cleanup = True)), name = 'gears2MTrack')
             gears2MTrack.start()
             self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.23000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.28000000000000003)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.34999999999999998, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28000000000000003, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.31, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.32000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.47999999999999998)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28999999999999998, 0.0)))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_BOMB))
             self.popIval.start()
         else:
             self.moleHead.setH(0)
     
     if type == MoleFieldBase.HILL_WHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_hit')
         self.mole.setBillboardAxis(0)
         self.moleColNodePath.setScale(0.0)
         if self.popIval:
             self.popIval.finish()
         
         if self.downIval:
             self.downIval.finish()
         
         self.mole.setPos(0.0, 0.0, 0.0)
         self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.14999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.12, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.14999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.16, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17000000000000001)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.0))), Sequence(LerpScaleInterval(self.moleHead, 0.5, 3.5), LerpScaleInterval(self.moleHead, 0.5, 1.0))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_MOLE))
         self.popIval.start()
     
     self.moleHead.reparentTo(self.mole)
 def makeFlashTrack(self):
     return Track(
         (0.25, Func(self.text.setTextColor, *TEXT_GREEN)),
         (0.50, Func(self.text.setTextColor, *TEXT_WHITE)),
         (0.75, Func(self.text.setTextColor, *TEXT_GREEN)),
         (1.0, Func(self.text.setTextColor, *TEXT_WHITE)),
         (1.25, Func(self.text.setTextColor, *TEXT_GREEN)),
         (1.50, Func(self.text.setTextColor, *TEXT_WHITE)),
         (1.75, Func(self.text.setTextColor, *TEXT_GREEN)),
         (2.0, Func(self.text.setTextColor, *TEXT_WHITE)),
     )
示例#6
0
 def makeFlashTrack(self, tNode, damage):
     return Track(
         (0.25, Func(tNode.setTextColor, *TEXT_GREEN)),
         (0.50, Func(tNode.setTextColor, *TEXT_WHITE)),
         (0.50, Func(tNode.setText, damage)),
         (0.75, Func(tNode.setTextColor, *TEXT_GREEN)),
         (1.0, Func(tNode.setTextColor, *TEXT_WHITE)),
         (1.25, Func(tNode.setTextColor, *TEXT_GREEN)),
         (1.50, Func(tNode.setTextColor, *TEXT_WHITE)),
         (1.75, Func(tNode.setTextColor, *TEXT_GREEN)),
         (2.0, Func(tNode.setTextColor, *TEXT_WHITE)),
     )
    def showSuitsFalling(self, suits, ts, name, callback):
        if self.bossCog is None:
            return
        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
    def showSuitsFalling(self, suits, ts, name, callback):
        if self.bossCog is None:
            return
        suitTrack = Parallel()
        delay = 0
        for suit in suits:
            suit.makeWaiter()
            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)
            flyIval = suit.beginSupaFlyMove(destPos, True, 'flyIn')
            suitTrack.append(
                Track(
                    (delay,
                     Sequence(
                         flyIval,
                         Func(
                             suit.loop,
                             'neutral')))))
            delay += 1

        if self.hasLocalToon():
            camera.reparentTo(self)
            if random.choice([0, 1]):
                camera.setPosHpr(20, -4, 7, 60, 0, 0)
            else:
                camera.setPosHpr(-20, -4, 7, -60, 0, 0)
        done = Func(callback)
        track = Sequence(suitTrack, done, name=name)
        track.start(ts)
        self.storeInterval(track, name)
        return
示例#9
0
    def doDeathTrack(self):

        def removeDeathSuit(suit, deathSuit):
            if not deathSuit.isEmpty():
                deathSuit.detachNode()
                suit.cleanupLoseActor()

        self.deathSuit.reparentTo(self.suit.getParent())
        self.deathSuit.setScale(self.suit.getScale())
        self.deathSuit.setPos(render, self.suit.getPos(render))
        self.deathSuit.setHpr(render, self.suit.getHpr(render))
        self.suit.hide()
        self.collNodePath.reparentTo(self.deathSuit)
        gearPoint = Point3(0, 0, self.suit.height / 2.0 + 2.0)
        smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
        singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
        smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
        bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
        smallGears.setPos(gearPoint)
        singleGear.setPos(gearPoint)
        smallGearExplosion.setPos(gearPoint)
        bigGearExplosion.setPos(gearPoint)
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        suitTrack = Sequence(Func(self.collNodePath.stash), ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140), Func(removeDeathSuit, self.suit, self.deathSuit, name='remove-death-suit'))
        explosionTrack = Sequence(Wait(1.5), MovieUtil.createKapowExplosionTrack(self.deathSuit, explosionPoint=gearPoint))
        gears1Track = Sequence(ParticleInterval(smallGears, self.deathSuit, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
        gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, self.deathSuit, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')

        def removeParticle(particle):
            if particle and hasattr(particle, 'renderParent'):
                particle.cleanup()
                del particle

        removeParticles = Sequence(Func(removeParticle, smallGears), Func(removeParticle, singleGear), Func(removeParticle, smallGearExplosion), Func(removeParticle, bigGearExplosion))
        self.deathTrack = Sequence(Parallel(suitTrack, gears2MTrack, gears1Track, self._deathSoundIval), removeParticles)
        self.deathTrack.start()
    def showSuitsFalling(self, suits, ts, name, callback):
        assert (len(suits) > 0)

        if self.bossCog == None:
            # Hmm, no boss cog?  Maybe not generated yet.
            return

        suitTrack = Parallel()

        delay = 0
        for suit in suits:
            """
            This is done by the AI now.
            if self.battleNumber == 2:
                # Battle 2 features skelecogs only.
                suit.makeSkeleton()
                suit.corpMedallion.hide()
                suit.healthBar.show()
                """
            suit.makeWaiter()
            suit.setState('Battle')
            #RAU lawbot boss battle hack,
            if suit.dna.dept == 'l':
                suit.reparentTo(self.bossCog)
                suit.setPos(0, 0, 0)

            #suit.setScale(3.8 / suit.height)

            # Move all suits into position
            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)

            flyIval = suit.beginSupaFlyMove(destPos, True, 'flyIn')
            suitTrack.append(
                Track(
                    #(delay, self.createAdjustInterval(suit, destPos, destHpr)),
                    (delay, Sequence(flyIval, Func(suit.loop, 'neutral')))))
            delay += 1

        if (self.hasLocalToon()):
            # Parent the camera to the battle and position it to watch the
            # suits join.
            camera.reparentTo(self)

            # Choose either a left or a right view at random.
            if random.choice([0, 1]):
                camera.setPosHpr(20, -4, 7, 60, 0, 0)
            else:
                camera.setPosHpr(-20, -4, 7, -60, 0, 0)

        done = Func(callback)
        track = Sequence(suitTrack, done, name=name)
        track.start(ts)
        self.storeInterval(track, name)
示例#11
0
    def setHillType(self, type):
        if self.isUp and (((self.hillType == MoleFieldBase.HILL_MOLE) and
                           (type == MoleFieldBase.HILL_BOMB)) or
                          ((self.hillType == MoleFieldBase.HILL_BOMB) and
                           (type == MoleFieldBase.HILL_MOLE))):
            return
        self.hillType = type
        self.moleHead.remove()
        if type == MoleFieldBase.HILL_MOLE:
            self.moleHead = loader.loadModel(
                "phase_12/models/bossbotHQ/mole_norm")
            self.moleColNodePath.setScale(3.0)
            self.moleHead.setH(0)
            self.mole.setBillboardAxis(localAvatar, 0)
        if type == MoleFieldBase.HILL_BOMB or type == MoleFieldBase.HILL_COGWHACKED:
            self.moleHead = loader.loadModel(
                "phase_12/models/bossbotHQ/mole_cog")
            self.moleColNodePath.setScale(1.0)
            self.mole.setBillboardAxis(localAvatar, 0)
            if type == MoleFieldBase.HILL_COGWHACKED:
                self.doMoleDown()
                BattleParticles.loadParticles()
                #smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
                singleGear = BattleParticles.createParticleEffect(
                    'GearExplosion', numParticles=1)
                smallGearExplosion = BattleParticles.createParticleEffect(
                    'GearExplosion', numParticles=10)
                bigGearExplosion = BattleParticles.createParticleEffect(
                    'BigGearExplosion', numParticles=30)
                #gearPoint = Point3(self.hill.getX(render), self.hill.getY(render), self.hill.getZ(render))
                #smallGears.setPos(gearPoint)
                #singleGear.setPos(gearPoint)
                #smallGears.setDepthWrite(False)
                #singleGear.setDepthWrite(False)
                #smallGearExplosion.setPos(gearPoint)
                #bigGearExplosion.setPos(gearPoint)
                #smallGearExplosion.setDepthWrite(False)
                #bigGearExplosion.setDepthWrite(False)
                gears2MTrack = Track((0.0,
                                      ParticleInterval(singleGear,
                                                       self.hill,
                                                       worldRelative=1,
                                                       duration=5.7,
                                                       cleanup=True)),
                                     (0.0,
                                      ParticleInterval(smallGearExplosion,
                                                       self.hill,
                                                       worldRelative=0,
                                                       duration=1.2,
                                                       cleanup=True)),
                                     (0.3,
                                      ParticleInterval(bigGearExplosion,
                                                       self.hill,
                                                       worldRelative=0,
                                                       duration=1.0,
                                                       cleanup=True)),
                                     name='gears2MTrack')
                #gearTrack = Parallel(gears2MTrack)
                #gearTrack.start()
                gears2MTrack.start()

                self.popIval = Sequence(
                    Parallel(
                        Sequence(
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(0.28, 0.0, 0.0)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(0.0, -0.23, 0.0)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(0.0, 0.0, 0.28)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(-0.35, 0.0, 0.0)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(0.0, 0.28, 0.0)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(0.31, 0.0, 0.0)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(0.0, -0.32, 0.0)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(0.0, 0.0, 0.48)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(-0.28, 0.0, 0.0)),
                            LerpPosInterval(self.moleHead, 0.05,
                                            Point3(0.0, 0.29, 0.0)),
                        ), ),
                    LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)),
                    Func(self.setHillType, MoleFieldBase.HILL_BOMB),
                )
                self.popIval.start()

            else:
                self.moleHead.setH(0)

        if type == MoleFieldBase.HILL_WHACKED:
            self.moleHead = loader.loadModel(
                "phase_12/models/bossbotHQ/mole_hit")
            self.mole.setBillboardAxis(0)
            self.moleColNodePath.setScale(0.0)
            if self.popIval:
                self.popIval.finish()
            if self.downIval:
                self.downIval.finish()
            self.mole.setPos(0.0, 0.0, 0.0)
            self.popIval = Sequence(
                Parallel(
                    Sequence(
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.18, 0.0, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, -0.13, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, 0.0, 0.18)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(-0.15, 0.0, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, 0.18, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.11, 0.0, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, -0.12, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, 0.0, 0.18)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(-0.18, 0.0, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, 0.13, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.18, 0.0, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, -0.15, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, 0.0, 0.18)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(-0.16, 0.0, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, 0.18, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.11, 0.0, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, -0.18, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, 0.0, 0.17)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(-0.18, 0.0, 0.0)),
                        LerpPosInterval(self.moleHead, 0.05,
                                        Point3(0.0, 0.0, 0.0)),
                    ),
                    Sequence(
                        LerpScaleInterval(self.moleHead, 0.5, 3.5),
                        LerpScaleInterval(self.moleHead, 0.5, 1.0),
                    ),
                ),
                LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)),
                Func(self.setHillType, MoleFieldBase.HILL_MOLE),
            )
            self.popIval.start()
        self.moleHead.reparentTo(self.mole)
    def showSuitsFalling(self, suits, ts, name, callback):
        assert (len(suits) > 0)

        if self.bossCog == None:
            # Hmm, no boss cog?  Maybe not generated yet.
            return

        suitTrack = Parallel()

        delay = 0
        for suit in suits:
            """
            This is done by the AI now.
            if self.battleNumber == 2:
                # Battle 2 features skelecogs only.
                suit.makeSkeleton()
                suit.corpMedallion.hide()
                suit.healthBar.show()
                """

            suit.setState('Battle')
            #RAU lawbot boss battle hack,
            if suit.dna.dept == 'l':
                suit.reparentTo(self.bossCog)
                suit.setPos(0, 0, 0)

            #suit.setScale(3.8 / suit.height)

            # Move all suits into position
            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()):
            # Parent the camera to the battle and position it to watch the
            # suits join.
            camera.reparentTo(self)

            # Choose a back angle to see the diners flying to their battle position
            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)