Beispiel #1
0
    def createTrack(self):
        self.trails = []
        self.trailEffects = []
        self.trailIval = Parallel()
        vels = None
        if self.numTrails >= 3 and self.numTrails <= 5:
            vels = self.trailsVel[self.numTrails - 3]
        for i in range(self.numTrails):
            self.trails.append(self.attachNewNode('trail'))
            vel = Vec3(0, 0, 0)
            if vels:
                vel = Vec3(vels[i][0] + random.randint(-20, 20), vels[i][1] + random.randint(-20, 20), vels[i][2] + random.randint(0, 50))
            else:
                vel = Vec3(random.randint(-200, 200), random.randint(-200, 200), random.randint(80, 150))
            vel *= self.effectScale
            dur = 2.0 + random.random() / 4.0
            self.trailIval.append(ProjectileInterval(self.trails[i], startVel=vel, duration=dur, gravityMult=2.0))
            self.trailEffects.append(SparksTrailLong.getEffect())
            if self.trailEffects[i]:
                self.trailEffects[i].reparentTo(self.trails[i])
                self.trailEffects[i].setLifespan(2.0)
                self.trailEffects[i].setEffectColor(self.effectColor)
                self.trailEffects[i].setEffectScale(self.effectScale)
                self.trailIval.append(Sequence(Func(self.trailEffects[i].startLoop), Wait(dur), Func(self.trailEffects[i].stopLoop)))

        self.track = Sequence(self.trailIval, Func(self.cleanUpEffect))
        return
 def createTrack(self):
     self.trails = []
     self.trailEffects = []
     self.trailIval = Parallel()
     vels = None
     if self.numTrails >= 3 and self.numTrails <= 5:
         vels = self.trailsVel[self.numTrails - 3]
     
     for i in range(self.numTrails):
         self.trails.append(self.attachNewNode('trail'))
         vel = Vec3(0, 0, 0)
         if vels:
             vel = Vec3(vels[i][0] + random.randint(-20, 20), vels[i][1] + random.randint(-20, 20), vels[i][2] + random.randint(0, 50))
         else:
             vel = Vec3(random.randint(-200, 200), random.randint(-200, 200), random.randint(80, 150))
         vel *= self.effectScale
         dur = 2.0 + random.random() / 4.0
         self.trailIval.append(ProjectileInterval(self.trails[i], startVel = vel, duration = dur, gravityMult = 2.0))
         self.trailEffects.append(SparksTrailLong.getEffect())
         if self.trailEffects[i]:
             self.trailEffects[i].reparentTo(self.trails[i])
             self.trailEffects[i].setLifespan(2.0)
             self.trailEffects[i].setEffectColor(self.effectColor)
             self.trailEffects[i].setEffectScale(self.effectScale)
             self.trailIval.append(Sequence(Func(self.trailEffects[i].startLoop), Wait(dur), Func(self.trailEffects[i].stopLoop)))
             continue
     
     self.track = Sequence(self.trailIval, Func(self.cleanUpEffect))
    def getTrailEffectsIval(self):
        if not self.trailEffectsIval:
            if self.trailTypeId is None:
                self.effectNode.setPos(self.velocity)
                self.trailEffectsIval = Wait(self.burstDelay)
                return self.trailEffectsIval

            self.trailEffectsIval = Parallel()
            self.trailEffectsIval.append(
                ProjectileInterval(self.effectsNode,
                                   startVel=self.velocity,
                                   duration=self.burstDelay,
                                   gravityMult=self.gravityMult))
            if self.trailTypeId is None:
                return self.trailEffectsIval

            theSoundInterval = SoundInterval(random.choice(self.trailSfx),
                                             node=self.effectsNode,
                                             cutOff=3000)
            self.trailEffectsIval.append(
                Func(self.setupSoundVolume, theSoundInterval))
            self.trailEffectsIval.append(theSoundInterval)
            if base.options.getSpecialEffectsSetting(
            ) == base.options.SpecialEffectsLow:
                if self.trailTypeId != FireworkTrailType.LongGlowSparkle:
                    self.trailTypeId = FireworkTrailType.Default

            if self.trailTypeId == FireworkTrailType.Default:
                glowEffect = Glow.getEffect()
                if glowEffect:
                    glowEffect.reparentTo(self.effectsNode)
                    glowEffect.setColorScale(Vec4(1, 1, 1, 1))
                    glowEffect.setScale(30.0)
                    self.trailEffects.append(glowEffect)
                    self.trailEffectsIval.append(Func(glowEffect.startLoop))

            elif self.trailTypeId == FireworkTrailType.Polygonal:
                r = 2.5
                mColor = Vec4(1, 1, 1, 1)
                vertex_list = [
                    Vec4(r, 0.0, r, 1.0),
                    Vec4(r, 0.0, -r, 1.0),
                    Vec4(-r, 0.0, -r, 1.0),
                    Vec4(-r, 0.0, r, 1.0),
                    Vec4(r, 0.0, r, 1.0)
                ]
                motion_color = [mColor, mColor, mColor, mColor, mColor]
                trailEffect = PolyTrail(None, vertex_list, motion_color, 0.5)
                trailEffect.setUnmodifiedVertexColors(motion_color)
                trailEffect.reparentTo(self.effectsNode)
                trailEffect.motion_trail.geom_node_path.setTwoSided(False)
                trailEffect.setBlendModeOn()
                trailEffect.setLightOff()
                self.trailEffects.append(trailEffect)
                self.trailEffectsIval.append(Func(trailEffect.beginTrail))
            elif self.trailTypeId == FireworkTrailType.Glow:
                trailEffect = GlowTrail.getEffect()
                if trailEffect:
                    trailEffect.reparentTo(self.effectsNode)
                    trailEffect.setEffectScale(self.scale * 0.75)
                    trailEffect.setEffectColor(Vec4(1, 1, 1, 1))
                    trailEffect.setLifespan(0.25)
                    self.trailEffects.append(trailEffect)
                    self.trailEffectsIval.append(Func(trailEffect.startLoop))

            elif self.trailTypeId == FireworkTrailType.Sparkle:
                trailEffect = SparksTrail.getEffect()
                if trailEffect:
                    trailEffect.reparentTo(self.effectsNode)
                    trailEffect.setEffectScale(self.scale)
                    trailEffect.setEffectColor(Vec4(1, 1, 1, 1))
                    self.trailEffects.append(trailEffect)
                    self.trailEffectsIval.append(Func(trailEffect.startLoop))

            elif self.trailTypeId == FireworkTrailType.GlowSparkle:
                glowEffect = Glow.getEffect()
                if glowEffect:
                    glowEffect.reparentTo(self.effectsNode)
                    glowEffect.setColorScale(Vec4(1, 1, 1, 1))
                    glowEffect.setScale(50.0)
                    self.trailEffects.append(glowEffect)
                    self.trailEffectsIval.append(Func(glowEffect.startLoop))

                trailEffect = SparksTrail.getEffect()
                if trailEffect:
                    trailEffect.reparentTo(self.effectsNode)
                    trailEffect.setEffectScale(self.scale)
                    trailEffect.setEffectColor(Vec4(1, 1, 1, 1))
                    self.trailEffects.append(trailEffect)
                    self.trailEffectsIval.append(Func(trailEffect.startLoop))

            elif self.trailTypeId == FireworkTrailType.LongSparkle:
                trailEffect = SparksTrailLong.getEffect()
                if trailEffect:
                    trailEffect.reparentTo(self.effectsNode)
                    trailEffect.setEffectScale(self.scale)
                    trailEffect.setEffectColor(Vec4(1, 1, 1, 1))
                    trailEffect.setLifespan(4.0)
                    self.trailEffects.append(trailEffect)
                    self.trailEffectsIval.append(Func(trailEffect.startLoop))

            elif self.trailTypeId == FireworkTrailType.LongGlowSparkle:
                trailEffect = SparksTrailLong.getEffect()
                if trailEffect:
                    trailEffect.reparentTo(self.effectsNode)
                    trailEffect.setEffectScale(self.scale)
                    trailEffect.setEffectColor(self.secondaryColor)
                    trailEffect.setLifespan(3.5)
                    self.trailEffects.append(trailEffect)
                    self.trailEffectsIval.append(Func(trailEffect.startLoop))

                if base.options.getSpecialEffectsSetting(
                ) >= base.options.SpecialEffectsMedium:
                    trailEffect = GlowTrail.getEffect()
                    if trailEffect:
                        trailEffect.reparentTo(self.effectsNode)
                        trailEffect.setEffectScale(self.scale)
                        trailEffect.setEffectColor(self.primaryColor)
                        trailEffect.setLifespan(1.0)
                        self.trailEffects.append(trailEffect)
                        self.trailEffectsIval.append(
                            Func(trailEffect.startLoop))

        return self.trailEffectsIval
Beispiel #4
0
 def getTrailEffectsIval(self):
     if not self.trailEffectsIval:
         if self.trailTypeId is None:
             self.effectNode.setPos(self.velocity)
             self.trailEffectsIval = Wait(self.burstDelay)
             return self.trailEffectsIval
         
         self.trailEffectsIval = Parallel()
         self.trailEffectsIval.append(ProjectileInterval(self.effectsNode, startVel = self.velocity, duration = self.burstDelay, gravityMult = self.gravityMult))
         if self.trailTypeId is None:
             return self.trailEffectsIval
         
         theSoundInterval = SoundInterval(random.choice(self.trailSfx), node = self.effectsNode, cutOff = 3000)
         self.trailEffectsIval.append(Func(self.setupSoundVolume, theSoundInterval))
         self.trailEffectsIval.append(theSoundInterval)
         if base.options.getSpecialEffectsSetting() == base.options.SpecialEffectsLow:
             if self.trailTypeId != FireworkTrailType.LongGlowSparkle:
                 self.trailTypeId = FireworkTrailType.Default
             
         
         if self.trailTypeId == FireworkTrailType.Default:
             glowEffect = Glow.getEffect()
             if glowEffect:
                 glowEffect.reparentTo(self.effectsNode)
                 glowEffect.setColorScale(Vec4(1, 1, 1, 1))
                 glowEffect.setScale(30.0)
                 self.trailEffects.append(glowEffect)
                 self.trailEffectsIval.append(Func(glowEffect.startLoop))
             
         elif self.trailTypeId == FireworkTrailType.Polygonal:
             r = 2.5
             mColor = Vec4(1, 1, 1, 1)
             vertex_list = [
                 Vec4(r, 0.0, r, 1.0),
                 Vec4(r, 0.0, -r, 1.0),
                 Vec4(-r, 0.0, -r, 1.0),
                 Vec4(-r, 0.0, r, 1.0),
                 Vec4(r, 0.0, r, 1.0)]
             motion_color = [
                 mColor,
                 mColor,
                 mColor,
                 mColor,
                 mColor]
             trailEffect = PolyTrail(None, vertex_list, motion_color, 0.5)
             trailEffect.setUnmodifiedVertexColors(motion_color)
             trailEffect.reparentTo(self.effectsNode)
             trailEffect.motion_trail.geom_node_path.setTwoSided(False)
             trailEffect.setBlendModeOn()
             trailEffect.setLightOff()
             self.trailEffects.append(trailEffect)
             self.trailEffectsIval.append(Func(trailEffect.beginTrail))
         elif self.trailTypeId == FireworkTrailType.Glow:
             trailEffect = GlowTrail.getEffect()
             if trailEffect:
                 trailEffect.reparentTo(self.effectsNode)
                 trailEffect.setEffectScale(self.scale * 0.75)
                 trailEffect.setEffectColor(Vec4(1, 1, 1, 1))
                 trailEffect.setLifespan(0.25)
                 self.trailEffects.append(trailEffect)
                 self.trailEffectsIval.append(Func(trailEffect.startLoop))
             
         elif self.trailTypeId == FireworkTrailType.Sparkle:
             trailEffect = SparksTrail.getEffect()
             if trailEffect:
                 trailEffect.reparentTo(self.effectsNode)
                 trailEffect.setEffectScale(self.scale)
                 trailEffect.setEffectColor(Vec4(1, 1, 1, 1))
                 self.trailEffects.append(trailEffect)
                 self.trailEffectsIval.append(Func(trailEffect.startLoop))
             
         elif self.trailTypeId == FireworkTrailType.GlowSparkle:
             glowEffect = Glow.getEffect()
             if glowEffect:
                 glowEffect.reparentTo(self.effectsNode)
                 glowEffect.setColorScale(Vec4(1, 1, 1, 1))
                 glowEffect.setScale(50.0)
                 self.trailEffects.append(glowEffect)
                 self.trailEffectsIval.append(Func(glowEffect.startLoop))
             
             trailEffect = SparksTrail.getEffect()
             if trailEffect:
                 trailEffect.reparentTo(self.effectsNode)
                 trailEffect.setEffectScale(self.scale)
                 trailEffect.setEffectColor(Vec4(1, 1, 1, 1))
                 self.trailEffects.append(trailEffect)
                 self.trailEffectsIval.append(Func(trailEffect.startLoop))
             
         elif self.trailTypeId == FireworkTrailType.LongSparkle:
             trailEffect = SparksTrailLong.getEffect()
             if trailEffect:
                 trailEffect.reparentTo(self.effectsNode)
                 trailEffect.setEffectScale(self.scale)
                 trailEffect.setEffectColor(Vec4(1, 1, 1, 1))
                 trailEffect.setLifespan(4.0)
                 self.trailEffects.append(trailEffect)
                 self.trailEffectsIval.append(Func(trailEffect.startLoop))
             
         elif self.trailTypeId == FireworkTrailType.LongGlowSparkle:
             trailEffect = SparksTrailLong.getEffect()
             if trailEffect:
                 trailEffect.reparentTo(self.effectsNode)
                 trailEffect.setEffectScale(self.scale)
                 trailEffect.setEffectColor(self.secondaryColor)
                 trailEffect.setLifespan(3.5)
                 self.trailEffects.append(trailEffect)
                 self.trailEffectsIval.append(Func(trailEffect.startLoop))
             
             if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium:
                 trailEffect = GlowTrail.getEffect()
                 if trailEffect:
                     trailEffect.reparentTo(self.effectsNode)
                     trailEffect.setEffectScale(self.scale)
                     trailEffect.setEffectColor(self.primaryColor)
                     trailEffect.setLifespan(1.0)
                     self.trailEffects.append(trailEffect)
                     self.trailEffectsIval.append(Func(trailEffect.startLoop))
                 
             
         
     
     return self.trailEffectsIval