Esempio n. 1
0
        def __getCloudTrack(cloud, useEffect = 1):
            track = Sequence(
                Func(cloud.pose, 'chan', 0),
                LerpScaleInterval(cloud, 1.5, scaleUpPoint, startScale = GagGlobals.PNT3NEAR0),
                Wait(rainDelay)
            )
            if useEffect == 1:
                pTrack = Parallel()
                delay = trickleDuration = cloudHold * 0.25
                trickleTrack = ParticleInterval(trickleFx, cloud, worldRelative=0, duration=trickleDuration, cleanup=True)
                track.append(trickleTrack)
                for i in range(0, 3):
                    dur = cloudHold - 2 * trickleDuration
                    pTrack.append(Sequence(Wait(delay), ParticleInterval(rainEffects[i], cloud, worldRelative=0, duration=dur, cleanup=True)))
                    delay += effectDelay

                pTrack.append(Sequence(
                    Wait(3 * effectDelay),
                    ActorInterval(cloud, 'chan', startTime = 1, duration = cloudHold))
                )
                damageTrack = Sequence()
                if cog.getHealth() - self.getDamage() <= 0:
                    damageTrack.append(Func(cog.d_disableMovement, wantRay = True))
                    damageTrack.append(Func(damageCog))
                else:
                    damageTrack.append(Wait(tContact))
                    damageTrack.append(Func(damageCog))
                pTrack.append(damageTrack)
                track.append(pTrack)
            else:
                track.append(ActorInterval(cloud, 'chan', startTime = 1, duration = cloudHold))
            track.append(LerpScaleInterval(cloud, 0.5, GagGlobals.PNT3NEAR0))
            track.append(Func(GagUtils.destroyProp, cloud))
            return track
 def __getPartTrack(self, particleEffect, startDelay, durationDelay, partExtraArgs, softStop = 0):
     pEffect = partExtraArgs[0]
     parent = partExtraArgs[1]
     if len(partExtraArgs) == 3:
         worldRelative = partExtraArgs[2]
     else:
         worldRelative = 1
     return Sequence(Wait(startDelay), ParticleInterval(pEffect, parent, worldRelative, duration=durationDelay, cleanup=True, softStopT=softStop))
Esempio n. 3
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 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)
Esempio n. 5
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)