Python DustCloud Example

说明

python dustcloud示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Python

命名空间/包名称: pirateseffectsDustCloud

示例#1
文件: FlamingDebris.py项目: TTGhost/POTCOR-src

    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.getWater():
                entryWaterHeight = base.cr.activeWorld.getWater().calcHeight(pos[0], pos[1]) + 7.0
            else:
                entryWaterHeight = pos[2]
            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)
            dustCloudEffect = DustCloud.getEffect()
            if dustCloudEffect:
                dustCloudEffect.wrtReparentTo(render)
                dustCloudEffect.setPos(pos)
                dustCloudEffect.play()

            self.cnode.setFromCollideMask(PiratesGlobals.TargetBitmask.allOff())

示例#2
文件: ProjectileEffect.py项目: TTGhost/POTCOR-src

 def groundHitEffect(self, hitObject, pos, skillId, ammoSkillId):
     if ammoSkillId == InventoryType.CannonRoundShot and ammoSkillId == InventoryType.CannonChainShot and ammoSkillId == InventoryType.CannonBullet and ammoSkillId == InventoryType.CannonSkull or ammoSkillId == InventoryType.CannonBarShot:
         if self.cr:
             attacker = self.cr.doId2do.get(self.attackerId)
         else:
             attacker = None
         if attacker:
             pass
         unlimited = bool(attacker.isLocal())
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow:
             cannonExplosion = CannonExplosion.getEffect(unlimited)
             if cannonExplosion:
                 cannonExplosion.wrtReparentTo(base.effectsRoot)
                 cannonExplosion.setScale(1.0)
                 cannonExplosion.setPos(hitObject, pos)
                 cannonExplosion.play()
             
             rockShowerEffect = RockShower.getEffect(unlimited)
             if rockShowerEffect:
                 rockShowerEffect.wrtReparentTo(hitObject)
                 rockShowerEffect.setPos(hitObject, pos)
                 rockShowerEffect.play()
             
         
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium:
             dustCloudEffect = DustCloud.getEffect(unlimited)
             if dustCloudEffect:
                 dustCloudEffect.wrtReparentTo(hitObject)
                 dustCloudEffect.setPos(hitObject, pos)
                 dustCloudEffect.play()
             
             shockwaveRingEffect = ShockwaveRing.getEffect(unlimited)
             if shockwaveRingEffect:
                 shockwaveRingEffect.wrtReparentTo(base.effectsRoot)
                 shockwaveRingEffect.size = 40
                 shockwaveRingEffect.setPos(hitObject, pos)
                 shockwaveRingEffect.play()
             
             cameraShakerEffect = CameraShaker()
             cameraShakerEffect.wrtReparentTo(hitObject)
             cameraShakerEffect.setPos(hitObject, pos)
             cameraShakerEffect.shakeSpeed = 0.059999999999999998
             cameraShakerEffect.shakePower = 6.0
             cameraShakerEffect.numShakes = 3
             cameraShakerEffect.scalePower = 1
             cameraShakerEffect.play(80.0)
         
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh:
             dirtClodEffect = DirtClod.getEffect(unlimited)
             if dirtClodEffect:
                 dirtClodEffect.wrtReparentTo(hitObject)
                 dirtClodEffect.setPos(hitObject, pos)
                 dirtClodEffect.play()
             
         
     else:
         self.basicHitEffect(hitObject, pos, skillId, ammoSkillId)

展开阅读全文