本文整理汇总了Python中toontown.battle.BattleParticles类的典型用法代码示例。如果您正苦于以下问题:Python BattleParticles类的具体用法?Python BattleParticles怎么用?Python BattleParticles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BattleParticles类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: unload
def unload(self):
self.unloadBattleAnims()
globalPropPool.unloadProps()
globalBattleSoundCache.clear()
BattleParticles.unloadParticles()
self.parentFSMState.removeChild(self.fsm)
del self.parentFSMState
del self.fsm
del self.streetClass
self.landmarkBlocks.removeNode()
del self.landmarkBlocks
self.hood.dnaStore.resetSuitPoints()
self.hood.dnaStore.resetBattleCells()
del self.hood
del self.nodeDict
del self.zoneDict
del self.fadeInDict
del self.fadeOutDict
del self.nodeList
self.geom.removeNode()
del self.geom
self.townBattle.unload()
self.townBattle.cleanup()
del self.townBattle
del self.battleMusic
del self.music
del self.activityMusic
del self.holidayPropTransforms
self.deleteAnimatedProps()
cleanupDialog('globalDialog')
ModelPool.garbageCollect()
TexturePool.garbageCollect()
示例2: createGoonExplosion
def createGoonExplosion(parent, explosionPoint, scale):
BattleParticles.loadParticles()
deathNode = NodePath('goonDeath')
deathNode.setPos(explosionPoint)
explosion = createExplosionTrack(parent, deathNode, scale)
smallGearExplosion = BattleParticles.createParticleEffect(
'GearExplosion', numParticles=10)
bigGearExplosion = BattleParticles.createParticleEffect(
'WideGearExplosion', numParticles=30)
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
return Parallel(
explosion,
SoundInterval(deathSound),
ParticleInterval(
smallGearExplosion,
deathNode,
worldRelative=0,
duration=4.3,
cleanup=True),
ParticleInterval(
bigGearExplosion,
deathNode,
worldRelative=0,
duration=1.0,
cleanup=True),
name='gears2MTrack')
示例3: __init__
def __init__(self, serialNum, maze, randomNumGen, difficulty, startTile, cogdoSuitType, walkAnimName = None):
data = Globals.SuitData[cogdoSuitType]
MazeSuit.__init__(self, serialNum, maze, randomNumGen, data['cellWalkPeriod'], difficulty, data['dnaName'], startTile=startTile, walkSameDirectionProb=Globals.SuitWalkSameDirectionProb, walkTurnAroundProb=Globals.SuitWalkTurnAroundProb, uniqueRandomNumGen=False, walkAnimName=walkAnimName)
FSM.__init__(self, 'CogdoMazeSuit')
CogdoMazeSplattable.__init__(self, self.suit, '%s-%i' % (Globals.SuitCollisionName, self.serialNum), 1.5)
if data.has_key('scale'):
self.suit.setScale(data['scale'])
self.hp = data['hp']
self.type = cogdoSuitType
self.memos = data['memos']
self.deathSuit = self.suit.getLoseActor()
self.deathSuit.pose('lose', 0)
BattleParticles.loadParticles()
self._initSfx()
示例4: __init__
def __init__(self, model, pos, serialNum, gameId, penalty = False):
self.serialNum = serialNum
self.penalty = penalty
center = model.getBounds().getCenter()
center = Point3(0, 0, 0)
self.nodePath = model.copyTo(render)
self.nodePath.setPos(pos[0] - center[0], pos[1] - center[1], pos[2] - center[2])
self.nodePath.setZ(0)
self.notify.debug('newPos = %s' % self.nodePath.getPos())
if self.penalty:
self.sphereName = 'penaltySphere-%s-%s' % (gameId, self.serialNum)
else:
self.sphereName = 'treasureSphere-%s-%s' % (gameId, self.serialNum)
self.collSphere = CollisionSphere(center[0], center[1], center[2], self.RADIUS)
self.collSphere.setTangible(0)
self.collNode = CollisionNode(self.sphereName)
self.collNode.setIntoCollideMask(ToontownGlobals.PieBitmask)
self.collNode.addSolid(self.collSphere)
self.collNodePath = render.attachNewNode(self.collNode)
self.collNodePath.setPos(pos[0] - center[0], pos[1] - center[1], pos[2] - center[2])
self.collNodePath.hide()
self.track = None
if self.penalty:
self.tip = self.nodePath.find('**/fusetip')
sparks = BattleParticles.createParticleEffect(file = 'icetnt')
self.sparksEffect = sparks
sparks.start(self.tip)
self.penaltyGrabSound = loader.loadSfx('phase_4/audio/sfx/MG_cannon_fire_alt.mp3')
self.penaltyGrabSound.setVolume(0.75)
kaboomAttachPoint = self.nodePath.attachNewNode('kaboomAttach')
kaboomAttachPoint.setZ(3)
self.kaboom = loader.loadModel('phase_4/models/minigames/ice_game_kaboom')
self.kaboom.reparentTo(kaboomAttachPoint)
self.kaboom.setScale(2.0)
self.kaboom.setBillboardPointEye()
示例5: enterFinaleBrainstormAttack
def enterFinaleBrainstormAttack(self, offset):
if Vec3(base.localAvatar.getPos(self)).length() <= 40:
# Currently, the cloud only forms over the local toon.
# Preferably it would form over all toons in the area, but I'm not sure how to go about doing that.
# That may not be good for performance either.
braincloud = BattleProps.globalPropPool.getProp('stormcloud')
braincloud.reparentTo(base.localAvatar)
braincloud.setScale(0)
braincloud.setZ(6)
brainstorm = BattleParticles.createParticleEffect(name='BrainStorm')
brainstorm.setDepthWrite(False)
def __checkNearCloud(task):
if Vec3(base.localAvatar.getPos(braincloud)).length() <= 5:
self.applyShakeAttack(base.localAvatar, SafezoneInvasionGlobals.FinaleSuitAttackDamage)
self.finaleBrainstormSequence = Sequence(
braincloud.scaleInterval(3, (3.5, 3.5, 2.5)),
Parallel(
Func(base.playSfx, self.brainstormSfx),
Func(braincloud.wrtReparentTo, render),
ParticleInterval(brainstorm, braincloud, worldRelative=0, duration=4.3, cleanup=True)
),
Wait(1),
braincloud.scaleInterval(1, (0.0, 0.0, 0.0)),
)
taskMgr.doMethodLater(4, __checkNearCloud, 'CheckNearBraincloud')
self.finaleBrainstormSequence.setT(offset)
self.finaleBrainstormSequence.start()
self.play('effort')
示例6: createSnow
def createSnow(geom):
snow = BattleParticles.loadParticleFile('snowdisk.ptf')
snow.setPos(0, 0, 5)
snowRender = geom.attachNewNode('snowRender')
snowRender.setDepthWrite(0)
snowRender.setBin('fixed', 1)
return snow, snowRender
示例7: __init__
def __init__(self, parent, smokeParent):
NodePath.__init__(self)
notify = DirectNotifyGlobal.directNotify.newCategory('RocketExplosionParticles')
self.effectNode = parent.attachNewNode('RocketExplosion')
self.effectNode.setBin('fixed', 1)
self.effectNode.setDepthWrite(1)
self.smokeEffectNode = smokeParent.attachNewNode('RocketSmoke')
self.smokeEffectNode.setBin('fixed', 1)
self.smokeEffectNode.setDepthWrite(0)
self.effect = BattleParticles.loadParticleFile('tt_p_efx_rocketLaunchFire.ptf')
self.smokeEffect = BattleParticles.loadParticleFile('tt_p_efx_rocketLaunchSmoke.ptf')
ren = self.effect.getParticlesNamed('particles-1').getRenderer()
ren.setTextureFromNode('phase_4/models/props/tt_m_efx_fireball', '**/*')
ren = self.smokeEffect.getParticlesNamed('particles-1').getRenderer()
ren.setTextureFromNode('phase_4/models/props/tt_m_efx_smoke', '**/*')
self.endSeq = None
self.cleanupCompleted = 0
示例8: setHillType
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)
示例9: destroy
def destroy(self):
if self.isDestroyed:
return None
self.isDestroyed = True
if hasattr(self.suit, 'prop') and self.suit.prop:
self.suit.prop.stash()
if self.propTrack:
self.propTrack.finish()
self.propTrack = None
if self.suitSound:
self.suitSound.stop()
del self.suitSound
if self.animTrack:
self.animTrack.finish()
self.animTrack = None
if self.shotTrack != None:
self.shotTrack.finish()
self.shotTrack = None
if self.deathTrack != None:
self.deathTrack.finish()
self.deathTrack = None
if self.deathSuit:
self.deathSuit.detachNode()
self.suit.cleanupLoseActor()
self.deathSuit = None
if self.moveIval:
self.moveIval.pause()
del self.moveIval
if self.suit:
self.suit.delete()
self.suit = None
BattleParticles.unloadParticles()
self.ignore(self.game.uniqueName('enter' + self.suitName))
self.game = None
self.enemyMgr = None
示例10: load
def load(self):
SafeZoneLoader.SafeZoneLoader.load(self)
self.windSound = map(base.loader.loadSfx, ['phase_8/audio/sfx/SZ_TB_wind_1.ogg',
'phase_8/audio/sfx/SZ_TB_wind_2.ogg',
'phase_8/audio/sfx/SZ_TB_wind_3.ogg'])
self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
self.snow.setPos(0, 0, 5)
self.snowRender = self.geom.attachNewNode('snowRender')
self.snowRender.setDepthWrite(0)
self.snowRender.setBin('fixed', 1)
示例11: __init__
def __init__(self, parent, renderParent):
NodePath.__init__(self)
notify = DirectNotifyGlobal.directNotify.newCategory('SparkParticles')
self.renderParent = renderParent.attachNewNode('sparkRenderParent')
self.renderParent.setBin('fixed', 0)
self.renderParent.setDepthWrite(0)
self.assign(parent.attachNewNode('sparks'))
self.effect = BattleParticles.loadParticleFile('sparks.ptf')
ren = self.effect.getParticlesNamed('particles-1').getRenderer()
ren.setTextureFromNode('phase_6/models/karting/particleSpark', '**/*')
示例12: __init__
def __init__(self, enemyMgr, index, suitAttribs):
self.enemyMgr = enemyMgr
self.game = self.enemyMgr.section.sectionMgr.game
self.index = index
self.moveIval = None
self.propTrack = None
self.animTrack = None
self.shotTrack = None
self.deathTrack = None
self.deathSuit = None
self.suitSound = None
self.deleteMeCallback = None
self.isMovingUpDown = False
self.isMovingLeftRight = False
self.showCollSpheres = False
self.isDestroyed = False
self.isGoingUp = False
self.setupEnemy(suitAttribs)
BattleParticles.loadParticles()
示例13: unload
def unload(self):
self.unloadBattleAnims()
globalPropPool.unloadProps()
globalBattleSoundCache.clear()
BattleParticles.unloadParticles()
self.parentFSMState.removeChild(self.fsm)
del self.parentFSMState
del self.fsm
del self.streetClass
self.landmarkBlocks.removeNode()
del self.landmarkBlocks
self.hood.dnaStore.resetSuitPoints()
self.hood.dnaStore.resetBattleCells()
del self.hood
del self.nodeDict
del self.zoneDict
del self.nodeToZone
del self.fadeInDict
del self.fadeOutDict
del self.nodeList
self.geom.removeNode()
del self.geom
self.townBattle.unload()
self.townBattle.cleanup()
del self.townBattle
del self.battleMusic
del self.music
del self.activityMusic
del self.holidayPropTransforms
self.deleteAnimatedProps()
cleanupDialog('globalDialog')
ModelPool.garbageCollect()
TexturePool.garbageCollect()
if base.config.GetBool('want-april-toons', 0):
self.pianoDropSequence.finish()
self.pianoDropSound.finish()
del self.pianoDropSequence
del self.pianoDropSound
self.piano.removeNode()
del self.pianoSfx
del self.dropSfx
del self.npc
示例14: load
def load(self):
SafeZoneLoader.SafeZoneLoader.load(self)
self.wind1Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_1.mp3')
self.wind2Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_2.mp3')
self.wind3Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_3.mp3')
self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
self.snow.setPos(0, 0, 5)
self.snowRender = self.geom.attachNewNode('snowRender')
self.snowRender.setDepthWrite(0)
self.snowRender.setBin('fixed', 1)
self.snowFade = None
示例15: doDeathTrack
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()