def playSharkAttack(self, pos):
     if self.sharkActor.getCurrentAnim() == None:
         self.sharkActor.wrtReparentTo(self.getModelRoot())
         self.sharkActor.setPos(self, pos)
         self.sharkActor.setScale(20)
         self.sharkActor.play('attack')
         sharkAttackEffect = None
         if base.options.getSpecialEffectsSetting(
         ) >= base.options.SpecialEffectsLow:
             effect = CannonSplash.getEffect()
             if effect:
                 effect.reparentTo(base.effectsRoot)
                 effect.setPos(self, pos)
                 effect.setZ(1)
                 effect.play()
             sharkAttackEffect = Func(self.playAttackEffect, pos)
         hprIvalShip = LerpHprInterval(self.getModelRoot(),
                                       duration=3,
                                       hpr=(0, 0, -180))
         s1 = Sequence(Wait(0.75), hprIvalShip,
                       Func(self.getModelRoot().stash))
         s2 = Sequence(Wait(0.75), sharkAttackEffect, Wait(0.5),
                       sharkAttackEffect)
         self.sharkParallel = Parallel(s1, s2)
         self.sharkParallel.start()
         taskMgr.doMethodLater(self.sharkActor.getDuration('attack'),
                               self.detachShark,
                               self.uniqueName('playSharkAttack'),
                               extraArgs=[])
     return
示例#2
0
    def weaponHitObject(self, entry):
        if not entry.hasSurfacePoint() or not entry.hasInto():
            return None

        if not entry.getInto().isTangible():
            return None

        hitObject = entry.getIntoNodePath()
        objType = hitObject.getNetTag('objType')
        if not objType:
            return None

        objType = int(objType)
        if objType == PiratesGlobals.COLL_SEA and base.cr.wantSpecialEffects:
            pos = entry.getSurfacePoint(render)
            if base.cr.activeWorld and base.cr.activeWorld.getWater():
                entryWaterHeight = base.cr.activeWorld.getWater().calcHeight(
                    pos[0], pos[1]) + 7.0
            else:
                entryWaterHeight = pos[2]
            if self.bigSplash:
                splashEffect = CannonSplash.getEffect()
                if splashEffect:
                    splashEffect.reparentTo(render)
                    splashEffect.setPos(pos[0], pos[1], entryWaterHeight)
                    splashEffect.play()

            else:
                splashEffect = SmallSplash.getEffect()
                if splashEffect:
                    splashEffect.reparentTo(render)
                    splashEffect.setPos(pos[0], pos[1], entryWaterHeight)
                    splashEffect.play()

            self.cnode.setFromCollideMask(
                PiratesGlobals.TargetBitmask.allOff())
        elif objType == PiratesGlobals.COLL_LAND and base.cr.wantSpecialEffects:
            pos = entry.getSurfacePoint(render)
            dustRingEffect = DustRing.getEffect()
            if dustRingEffect:
                dustRingEffect.reparentTo(render)
                dustRingEffect.setPos(pos)
                dustRingEffect.play()

            self.cnode.setFromCollideMask(
                PiratesGlobals.TargetBitmask.allOff())
示例#3
0
 def waterHitEffect(self, hitObject, pos, skillId, ammoSkillId):
     np = render.attachNewNode('temp')
     np.setPos(hitObject, pos)
     pos = np.getPos(render)
     np.removeNode()
     if self.cr:
         if self.cr.activeWorld.getWater():
             entryWaterHeight = base.cr.activeWorld.getWater().calcHeight(pos[0], pos[1])
         else:
             entryWaterHeight = pos[2]
     else:
         entryWaterHeight = pos[2]
     if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow:
         splashEffect = CannonSplash.getEffect()
         if splashEffect:
             splashEffect.wrtReparentTo(render)
             splashEffect.setPos(pos[0], pos[1], entryWaterHeight)
             splashEffect.play()
示例#4
0
 def waterHitEffect(self, hitObject, pos, skillId, ammoSkillId):
     np = render.attachNewNode('temp')
     np.setPos(hitObject, pos)
     pos = np.getPos(render)
     np.removeNode()
     if self.cr:
         if self.cr.activeWorld.getWater():
             entryWaterHeight = base.cr.activeWorld.getWater().calcHeight(pos[0], pos[1])
         else:
             entryWaterHeight = pos[2]
     else:
         entryWaterHeight = pos[2]
     if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow:
         splashEffect = CannonSplash.getEffect()
         if splashEffect:
             splashEffect.wrtReparentTo(render)
             splashEffect.setPos(pos[0], pos[1], entryWaterHeight)
             splashEffect.play()
 def weaponHitObject(self, entry):
     if not entry.hasSurfacePoint() or not entry.hasInto():
         return None
     
     if not entry.getInto().isTangible():
         return None
     
     hitObject = entry.getIntoNodePath()
     objType = hitObject.getNetTag('objType')
     if not objType:
         return None
     
     objType = int(objType)
     if objType == PiratesGlobals.COLL_SEA and base.cr.wantSpecialEffects:
         pos = entry.getSurfacePoint(render)
         if base.cr.activeWorld and base.cr.activeWorld.getWater():
             entryWaterHeight = base.cr.activeWorld.getWater().calcHeight(pos[0], pos[1]) + 7.0
         else:
             entryWaterHeight = pos[2]
         if self.bigSplash:
             splashEffect = CannonSplash.getEffect()
             if splashEffect:
                 splashEffect.reparentTo(render)
                 splashEffect.setPos(pos[0], pos[1], entryWaterHeight)
                 splashEffect.play()
             
         else:
             splashEffect = SmallSplash.getEffect()
             if splashEffect:
                 splashEffect.reparentTo(render)
                 splashEffect.setPos(pos[0], pos[1], entryWaterHeight)
                 splashEffect.play()
             
         self.cnode.setFromCollideMask(PiratesGlobals.TargetBitmask.allOff())
     elif objType == PiratesGlobals.COLL_LAND and base.cr.wantSpecialEffects:
         pos = entry.getSurfacePoint(render)
         dustRingEffect = DustRing.getEffect()
         if dustRingEffect:
             dustRingEffect.reparentTo(render)
             dustRingEffect.setPos(pos)
             dustRingEffect.play()
         
         self.cnode.setFromCollideMask(PiratesGlobals.TargetBitmask.allOff())