本文整理汇总了Python中BattleParticles类的典型用法代码示例。如果您正苦于以下问题:Python BattleParticles类的具体用法?Python BattleParticles怎么用?Python BattleParticles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BattleParticles类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __healSprinkle
def __healSprinkle(heal, hasInteractivePropHealBonus):
toon = heal['toon']
target = heal['target']['toon']
hp = heal['target']['hp']
ineffective = heal['sidestep']
level = heal['level']
track = Sequence(__runToHealSpot(heal))
sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray')
dropEffect = BattleParticles.createParticleEffect(file='pixieDrop')
explodeEffect = BattleParticles.createParticleEffect(file='pixieExplode')
poofEffect = BattleParticles.createParticleEffect(file='pixiePoof')
wallEffect = BattleParticles.createParticleEffect(file='pixieWall')
def face90(toon = toon, target = target):
vec = Point3(target.getPos() - toon.getPos())
vec.setZ(0)
temp = vec[0]
vec.setX(-vec[1])
vec.setY(temp)
targetPoint = Point3(toon.getPos() + vec)
toon.headsUp(render, targetPoint)
delay = 2.5
mtrack = Parallel(__getPartTrack(sprayEffect, 1.5, 0.5, [sprayEffect, toon, 0]), __getPartTrack(dropEffect, 1.9, 2.0, [dropEffect, target, 0]), __getPartTrack(explodeEffect, 2.7, 1.0, [explodeEffect, toon, 0]), __getPartTrack(poofEffect, 3.4, 1.0, [poofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=4.1, node=toon), Sequence(Func(face90), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp, ineffective, hasInteractivePropHealBonus)))
track.append(mtrack)
track.append(__returnToBase(heal))
track.append(Func(target.clearChat))
return track
示例2: __doSprinkle
def __doSprinkle(attack, recipients, hp = 0):
toon = NPCToons.createLocalNPC(attack['npcId'])
if toon == None:
return
targets = attack[recipients]
level = 4
battle = attack['battle']
track = Sequence(teleportIn(attack, toon))
def face90(target, toon, battle):
vec = Point3(target.getPos(battle) - toon.getPos(battle))
vec.setZ(0)
temp = vec[0]
vec.setX(-vec[1])
vec.setY(temp)
targetPoint = Point3(toon.getPos(battle) + vec)
toon.headsUp(battle, targetPoint)
delay = 2.5
effectTrack = Sequence()
for target in targets:
sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray')
dropEffect = BattleParticles.createParticleEffect(file='pixieDrop')
explodeEffect = BattleParticles.createParticleEffect(file='pixieExplode')
poofEffect = BattleParticles.createParticleEffect(file='pixiePoof')
wallEffect = BattleParticles.createParticleEffect(file='pixieWall')
mtrack = Parallel(__getPartTrack(sprayEffect, 1.5, 0.5, [sprayEffect, toon, 0]), __getPartTrack(dropEffect, 1.9, 2.0, [dropEffect, target, 0]), __getPartTrack(explodeEffect, 2.7, 1.0, [explodeEffect, toon, 0]), __getPartTrack(poofEffect, 3.4, 1.0, [poofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=3.1, node=toon), Sequence(Func(face90, target, toon, battle), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp)))
effectTrack.append(mtrack)
track.append(effectTrack)
track.append(Func(toon.setHpr, Vec3(180.0, 0.0, 0.0)))
track.append(teleportOut(attack, toon))
return track
示例3: __healSprinkle
def __healSprinkle(heal):
toon = heal['toon']
target = heal['target']['toon']
hp = heal['target']['hp']
ineffective = heal['sidestep']
level = heal['level']
ivals = __runToHealSpot(heal)
sprayEffect = BattleParticles.createParticleEffect(file = 'pixieSpray')
dropEffect = BattleParticles.createParticleEffect(file = 'pixieDrop')
explodeEffect = BattleParticles.createParticleEffect(file = 'pixieExplode')
poofEffect = BattleParticles.createParticleEffect(file = 'pixiePoof')
wallEffect = BattleParticles.createParticleEffect(file = 'pixieWall')
def face90(toon = toon, target = target):
vec = Point3(target.getPos() - toon.getPos())
vec.setZ(0)
temp = vec[0]
vec.setX(-vec[1])
vec.setY(temp)
targetPoint = Point3(toon.getPos() + vec)
toon.headsUp(render, targetPoint)
delay = 2.5
mtrack = MultiTrack([
__getPartTrack(sprayEffect, 1.5, 0.5, [
sprayEffect,
toon,
0]),
__getPartTrack(dropEffect, 1.8999999999999999, 2.0, [
dropEffect,
target,
0]),
__getPartTrack(explodeEffect, 2.7000000000000002, 1.0, [
explodeEffect,
toon,
0]),
__getPartTrack(poofEffect, 3.3999999999999999, 1.0, [
poofEffect,
target,
0]),
__getPartTrack(wallEffect, 4.0499999999999998, 1.2, [
wallEffect,
toon,
0]),
__getSoundTrack(level, 2, duration = 4.0999999999999996, node = toon),
Track([
FunctionInterval(face90),
ActorInterval(toon, 'sprinkle-dust')]),
Track([
(delay, FunctionInterval(__healToon, extraArgs = [
target,
hp,
ineffective]))])])
ivals.append(mtrack)
ivals += __returnToBase(heal)
ivals.append(FunctionInterval(target.clearChat))
return Track(ivals)
示例4: __createToonInterval
def __createToonInterval(sound, delay, toon, operaInstrument = None):
isNPC = 0
if sound.get('npc'):
isNPC = 1
battle = sound['battle']
hasLuredSuits = __hasLuredSuits(sound)
if not isNPC:
oldPos, oldHpr = battle.getActorPosHpr(toon)
newPos = Point3(oldPos)
newPos.setY(newPos.getY() - DISTANCE_TO_WALK_BACK)
retval = Sequence(Wait(delay))
if DISTANCE_TO_WALK_BACK and hasLuredSuits and not isNPC:
retval.append(Parallel(ActorInterval(toon, 'walk', startTime=1, duration=TIME_TO_WALK_BACK, endTime=0.0001), LerpPosInterval(toon, TIME_TO_WALK_BACK, newPos, other=battle)))
if operaInstrument:
sprayEffect = BattleParticles.createParticleEffect(file='soundWave')
sprayEffect.setDepthWrite(0)
sprayEffect.setDepthTest(0)
sprayEffect.setTwoSided(1)
I1 = 2.8
retval.append(ActorInterval(toon, 'sound', playRate=1.0, startTime=0.0, endTime=I1))
retval.append(Func(setPosFromOther, sprayEffect, operaInstrument, (0, 1.6, -0.18)))
retval.append(__getPartTrack(sprayEffect, 0.0, 6.0, [sprayEffect, toon, 0], softStop=-3.5))
retval.append(ActorInterval(toon, 'sound', playRate=1.0, startTime=I1))
else:
retval.append(ActorInterval(toon, 'sound'))
if DISTANCE_TO_WALK_BACK and hasLuredSuits and not isNPC:
retval.append(Parallel(ActorInterval(toon, 'walk', startTime=0.0001, duration=TIME_TO_WALK_BACK, endTime=1), LerpPosInterval(toon, TIME_TO_WALK_BACK, oldPos, other=battle)))
retval.append(Func(toon.loop, 'neutral'))
return retval
示例5: 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.snowRender = self.geom.attachNewNode("snowRender")
self.snowFade = None
示例6: __getSuitTrack
def __getSuitTrack(sound, lastSoundThatHit, delay, hitCount, targets, totalDamage, hpbonus, toon, npcs):
tracks = Parallel()
attacks = 0
uberDelay = 0.0
isUber = 0
if sound['level'] >= ToontownBattleGlobals.UBER_GAG_LEVEL_INDEX:
uberDelay = 3.0
isUber = 1
for target in targets:
suit = target['suit']
if totalDamage > 0 and sound == lastSoundThatHit:
hp = target['hp']
died = target['died']
battle = sound['battle']
kbbonus = target['kbbonus']
suitTrack = Sequence()
showDamage = Func(suit.showHpText, -totalDamage, openEnded=0)
updateHealthBar = Func(suit.updateHealthBar, totalDamage)
if isUber:
breakEffect = BattleParticles.createParticleEffect(file='soundBreak')
breakEffect.setDepthWrite(0)
breakEffect.setDepthTest(0)
breakEffect.setTwoSided(1)
breakEffect.setBin('fixed', 10)
soundEffect = globalBattleSoundCache.getSound(hitSoundFiles[0])
suitTrack.append(Wait(delay + tSuitReact))
if isUber:
delayTime = random.random()
suitTrack.append(Wait(delayTime + 2.0))
suitTrack.append(Func(setPosFromOther, breakEffect, suit, Point3(0, 0.0, suit.getHeight() - 1.0)))
suitTrack.append(Parallel(showDamage, updateHealthBar, SoundInterval(soundEffect, node=suit), __getPartTrack(breakEffect, 0.0, 1.0, [breakEffect, suit, 0], softStop=-0.5)))
else:
suitTrack.append(showDamage)
suitTrack.append(updateHealthBar)
if hitCount == 1:
suitTrack.append(Parallel(ActorInterval(suit, 'squirt-small-react'), MovieUtil.createSuitStunInterval(suit, 0.5, 1.8)))
else:
suitTrack.append(ActorInterval(suit, 'squirt-small-react'))
if kbbonus == 0:
suitTrack.append(__createSuitResetPosTrack(suit, battle))
suitTrack.append(Func(battle.unlureSuit, suit))
bonusTrack = None
if hpbonus > 0:
bonusTrack = Sequence(Wait(delay + tSuitReact + delay + 0.75 + uberDelay), Func(suit.showHpText, -hpbonus, 1, openEnded=0))
suitTrack.append(Func(suit.loop, 'neutral'))
if bonusTrack == None:
tracks.append(suitTrack)
else:
tracks.append(Parallel(suitTrack, bonusTrack))
elif totalDamage <= 0:
tracks.append(Sequence(Wait(2.9), Func(MovieUtil.indicateMissed, suit, 1.0)))
return tracks
示例7: midairSuitExplodeTrack
def midairSuitExplodeTrack(suit, battle):
suitTrack = Sequence()
suitPos, suitHpr = battle.getActorPosHpr(suit)
suitPos.setZ(suitPos.getZ() + 17)
suitTrack.append(Wait(0.15))
suitTrack.append(Func(MovieUtil.avatarHide, suit))
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
deathSoundTrack = Sequence(Wait(0.5), SoundInterval(deathSound, volume=0.8))
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(suitPos.getX(), suitPos.getY(), suitPos.getZ() + suit.height - 0.2)
smallGears.setPos(gearPoint)
singleGear.setPos(gearPoint)
smallGears.setDepthWrite(False)
singleGear.setDepthWrite(False)
smallGearExplosion.setPos(gearPoint)
bigGearExplosion.setPos(gearPoint)
smallGearExplosion.setDepthWrite(False)
bigGearExplosion.setDepthWrite(False)
explosionTrack = Sequence()
explosionTrack.append(MovieUtil.createKapowExplosionTrack(battle, explosionPoint=gearPoint))
gears1Track = Sequence(Wait(0.5), ParticleInterval(smallGears, battle, worldRelative=0, duration=1.0, cleanup=True), name='gears1Track')
gears2MTrack = Track(
(0.1, ParticleInterval(singleGear, battle, worldRelative=0, duration=0.4, cleanup=True)),
(0.5, ParticleInterval(smallGearExplosion, battle, worldRelative=0, duration=0.5, cleanup=True)),
(0.9, ParticleInterval(bigGearExplosion, battle, worldRelative=0, duration=2.0, cleanup=True)), name='gears2MTrack'
)
return Parallel(suitTrack, explosionTrack, deathSoundTrack, gears1Track, gears2MTrack, Wait(4.5))
示例8: createSuitReviveTrack
def createSuitReviveTrack(suit, toon, battle, npcs = []):
suitTrack = Sequence()
suitPos, suitHpr = battle.getActorPosHpr(suit)
if hasattr(suit, 'battleTrapProp') and suit.battleTrapProp and suit.battleTrapProp.getName() == 'traintrack' and not suit.battleTrapProp.isHidden():
suitTrack.append(createTrainTrackAppearTrack(suit, toon, battle, npcs))
deathSuit = suit.getLoseActor()
suitTrack.append(Func(notify.debug, 'before insertDeathSuit'))
suitTrack.append(Func(insertReviveSuit, suit, deathSuit, battle, suitPos, suitHpr))
suitTrack.append(Func(notify.debug, 'before actorInterval lose'))
suitTrack.append(ActorInterval(deathSuit, 'lose', duration=SUIT_LOSE_REVIVE_DURATION))
suitTrack.append(Func(notify.debug, 'before removeDeathSuit'))
suitTrack.append(Func(removeReviveSuit, suit, deathSuit, name='remove-death-suit'))
suitTrack.append(Func(notify.debug, 'after removeDeathSuit'))
suitTrack.append(ActorInterval(suit, 'slip-forward', startTime=2.48, duration=0.1))
suitTrack.append(ActorInterval(suit, 'slip-forward', startTime=2.58))
suitTrack.append(Func(suit.loop, 'neutral'))
suitTrack.append(Func(messenger.send, suit.uniqueName('hpChange')))
spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg')
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
deathSoundTrack = Sequence(Wait(0.8), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8), SoundInterval(deathSound, volume=0.32))
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(suitPos.getX(), suitPos.getY(), suitPos.getZ() + suit.height - 0.2)
smallGears.setPos(gearPoint)
singleGear.setPos(gearPoint)
smallGears.setDepthWrite(False)
singleGear.setDepthWrite(False)
smallGearExplosion.setPos(gearPoint)
bigGearExplosion.setPos(gearPoint)
smallGearExplosion.setDepthWrite(False)
bigGearExplosion.setDepthWrite(False)
explosionTrack = Sequence()
explosionTrack.append(Wait(5.4))
explosionTrack.append(createKapowExplosionTrack(battle, explosionPoint=gearPoint))
gears1Track = Sequence(Wait(2.1), ParticleInterval(smallGears, battle, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, battle, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, battle, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, battle, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')
toonMTrack = Parallel(name='toonMTrack')
for mtoon in battle.toons:
toonMTrack.append(Sequence(Wait(1.0), ActorInterval(mtoon, 'duck'), ActorInterval(mtoon, 'duck', startTime=1.8), Func(mtoon.loop, 'neutral')))
for mtoon in npcs:
toonMTrack.append(Sequence(Wait(1.0), ActorInterval(mtoon, 'duck'), ActorInterval(mtoon, 'duck', startTime=1.8), Func(mtoon.loop, 'neutral')))
return Parallel(suitTrack, deathSoundTrack, gears1Track, gears2MTrack, toonMTrack)
示例9: createSuitDeathTrack
def createSuitDeathTrack(suit, toon, battle, npcs=[]):
suitTrack = Sequence()
suitPos, suitHpr = battle.getActorPosHpr(suit)
if (
hasattr(suit, "battleTrapProp")
and suit.battleTrapProp
and suit.battleTrapProp.getName() == "traintrack"
and not suit.battleTrapProp.isHidden()
):
suitTrack.append(createTrainTrackAppearTrack(suit, toon, battle, npcs))
deathSuit = suit.getLoseActor()
suitTrack.append(Func(notify.debug, "before insertDeathSuit"))
suitTrack.append(Func(insertDeathSuit, suit, deathSuit, battle, suitPos, suitHpr))
suitTrack.append(Func(notify.debug, "before actorInterval lose"))
suitTrack.append(ActorInterval(deathSuit, "lose", duration=SUIT_LOSE_DURATION))
suitTrack.append(Func(notify.debug, "before removeDeathSuit"))
suitTrack.append(Func(removeDeathSuit, suit, deathSuit, name="remove-death-suit"))
suitTrack.append(Func(notify.debug, "after removeDeathSuit"))
spinningSound = base.loadSfx("phase_3.5/audio/sfx/Cog_Death.ogg")
deathSound = base.loadSfx("phase_3.5/audio/sfx/ENC_cogfall_apart.ogg")
deathSoundTrack = Sequence(
Wait(0.8),
SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2, node=deathSuit),
SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8, node=deathSuit),
SoundInterval(deathSound, volume=0.32, node=deathSuit),
)
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(suitPos.getX(), suitPos.getY(), suitPos.getZ() + suit.height - 0.2)
smallGears.setPos(gearPoint)
singleGear.setPos(gearPoint)
smallGears.setDepthWrite(False)
singleGear.setDepthWrite(False)
smallGearExplosion.setPos(gearPoint)
bigGearExplosion.setPos(gearPoint)
smallGearExplosion.setDepthWrite(False)
bigGearExplosion.setDepthWrite(False)
explosionTrack = Sequence()
explosionTrack.append(Wait(5.4))
explosionTrack.append(createKapowExplosionTrack(battle, explosionPoint=gearPoint))
gears1Track = Sequence(
Wait(2.1), ParticleInterval(smallGears, battle, worldRelative=0, duration=4.3, cleanup=True), name="gears1Track"
)
gears2MTrack = Track(
(0.0, explosionTrack),
(0.7, ParticleInterval(singleGear, battle, worldRelative=0, duration=5.7, cleanup=True)),
(5.2, ParticleInterval(smallGearExplosion, battle, worldRelative=0, duration=1.2, cleanup=True)),
(5.4, ParticleInterval(bigGearExplosion, battle, worldRelative=0, duration=1.0, cleanup=True)),
name="gears2MTrack",
)
toonMTrack = Parallel(name="toonMTrack")
for mtoon in battle.toons:
toonMTrack.append(
Sequence(
Wait(1.0),
ActorInterval(mtoon, "duck"),
ActorInterval(mtoon, "duck", startTime=1.8),
Func(mtoon.loop, "neutral"),
)
)
for mtoon in npcs:
toonMTrack.append(
Sequence(
Wait(1.0),
ActorInterval(mtoon, "duck"),
ActorInterval(mtoon, "duck", startTime=1.8),
Func(mtoon.loop, "neutral"),
)
)
return Parallel(suitTrack, deathSoundTrack, gears1Track, gears2MTrack, toonMTrack)
示例10: __createThrownTrapMultiTrack
#.........这里部分代码省略.........
animTrack = ActorInterval(
thrownProp, propName, startTime=throwDelay + 0.9)
scaleTrack = LerpScaleInterval(
thrownProp, throwDuration, scale=MovieUtil.PNT3_ONE)
soundTrack = getSoundTrack('TL_marbles.ogg', delay=0.1, node=toon)
throwTrack.append(Wait(0.2))
throwTrack.append(
Parallel(
moveTrack,
animTrack,
scaleTrack,
soundTrack))
elif trapName == 'rake':
trapPoint, trapHpr = battle.getActorPosHpr(suit)
trapPoint.setY(MovieUtil.SUIT_TRAP_RAKE_DISTANCE)
throwDuration = 1.1
throwingTrack = createThrowingTrack(
thrownProp, trapPoint, duration=throwDuration, parent=suit)
hprTrack = LerpHprInterval(
thrownProp, throwDuration, hpr=VBase3(
63.43, -90.0, 63.43))
scaleTrack = LerpScaleInterval(
thrownProp, 0.9, scale=Point3(
0.7, 0.7, 0.7))
soundTrack = SoundInterval(globalBattleSoundCache.getSound(
'TL_rake_throw_only.ogg'), duration=1.1, node=suit)
throwTrack.append(Wait(0.2))
throwTrack.append(
Parallel(
throwingTrack,
hprTrack,
scaleTrack,
soundTrack))
else:
notify.warning(
'__createThrownTrapMultiTrack() - Incorrect trap: %s thrown from toon' %
trapName)
def placeTrap(trapProp, suit, battle=battle, trapName=trapName):
if not trapProp or trapProp.isEmpty():
return
trapProp.wrtReparentTo(suit)
trapProp.show()
if trapName == 'rake':
trapProp.setPos(0, MovieUtil.SUIT_TRAP_RAKE_DISTANCE, 0)
trapProp.setHpr(Point3(0, 270, 0))
trapProp.setScale(Point3(0.7, 0.7, 0.7))
rakeOffset = MovieUtil.getSuitRakeOffset(suit)
trapProp.setY(trapProp.getY() + rakeOffset)
elif trapName == 'banana':
trapProp.setHpr(0, 0, 0)
trapProp.setPos(0, MovieUtil.SUIT_TRAP_DISTANCE, -0.35)
trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1)
elif trapName == 'marbles':
trapProp.setHpr(Point3(94, 0, 0))
trapProp.setPos(0, MovieUtil.SUIT_TRAP_MARBLES_DISTANCE, 0)
trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1)
elif trapName == 'tnt':
trapProp.setHpr(0, 90, 0)
trapProp.setPos(0, MovieUtil.SUIT_TRAP_TNT_DISTANCE, 0.4)
else:
notify.warning(
'placeTrap() - Incorrect trap: %s placed on a suit' %
trapName)
dustNode = hidden.attachNewNode('DustNode')
def placeDustExplosion(
dustNode=dustNode,
thrownProp=thrownProp,
battle=battle):
dustNode.reparentTo(battle)
dustNode.setPos(thrownProp.getPos(battle))
if explode == 1:
throwTrack.append(Func(thrownProp.wrtReparentTo, hidden))
throwTrack.append(Func(placeDustExplosion))
throwTrack.append(
createCartoonExplosionTrack(
dustNode,
'dust',
explosionPoint=Point3(
0,
0,
0)))
throwTrack.append(Func(battle.removeTrap, suit))
else:
throwTrack.append(Func(placeTrap, trapProp, suit))
if trapName == 'tnt':
tip = trapProp.find('**/joint_attachEmitter')
sparks = BattleParticles.createParticleEffect(file='tnt')
trapProp.sparksEffect = sparks
throwTrack.append(Func(sparks.start, tip))
throwTrack.append(Func(MovieUtil.removeProps, propList))
toonTrack = Sequence(
Func(
toon.headsUp, battle, targetPos), ActorInterval(
toon, 'toss'), Func(
toon.loop, 'neutral'))
return Parallel(propTrack, throwTrack, toonTrack)
示例11: __doGeyser
def __doGeyser(squirt, delay, fShowStun, uberClone = 0):
toon = squirt['toon']
level = squirt['level']
hpbonus = squirt['hpbonus']
tracks = Parallel()
tButton = 0.0
dButtonScale = 0.5
dButtonHold = 3.0
tContact = 2.9
tSpray = 1
tSuitDodges = 1.8
button = globalPropPool.getProp('button')
button2 = MovieUtil.copyProp(button)
buttons = [button, button2]
hands = toon.getLeftHands()
battle = squirt['battle']
origHpr = toon.getHpr(battle)
suit = squirt['target'][0]['suit']
suitPos = suit.getPos(battle)
toonTrack = Sequence(Func(MovieUtil.showProps, buttons, hands), Func(toon.headsUp, battle, suitPos), ActorInterval(toon, 'pushbutton'), Func(MovieUtil.removeProps, buttons), Func(toon.loop, 'neutral'), Func(toon.setHpr, battle, origHpr))
tracks.append(toonTrack)
for target in squirt['target']:
suit = target['suit']
hp = target['hp']
kbbonus = target['kbbonus']
died = target['died']
revived = target['revived']
leftSuits = target['leftSuits']
rightSuits = target['rightSuits']
suitPos = suit.getPos(battle)
hitSuit = hp > 0
scale = sprayScales[level]
soundTrack = __getSoundTrack(level, hitSuit, 1.8, toon)
delayTime = random.random()
tracks.append(Wait(delayTime))
tracks.append(soundTrack)
cloud = globalPropPool.getProp('geyser')
cloud2 = MovieUtil.copyProp(cloud)
BattleParticles.loadParticles()
geyserHeight = battle.getH()
geyserPosPoint = Point3(0, 0, geyserHeight)
scaleUpPoint = Point3(1.8, 1.8, 1.8)
rainEffects = []
rainDelay = 2.5
effectDelay = 0.3
if hp > 0:
geyserHold = 1.5
else:
geyserHold = 0.5
def getGeyserTrack(geyser, suit, geyserPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, geyserHold, useEffect, battle = battle):
geyserMound = MovieUtil.copyProp(geyser)
geyserRemoveM = geyserMound.findAllMatches('**/Splash*')
geyserRemoveM.addPathsFrom(geyserMound.findAllMatches('**/spout'))
for i in range(geyserRemoveM.getNumPaths()):
geyserRemoveM[i].removeNode()
geyserWater = MovieUtil.copyProp(geyser)
geyserRemoveW = geyserWater.findAllMatches('**/hole')
geyserRemoveW.addPathsFrom(geyserWater.findAllMatches('**/shadow'))
for i in range(geyserRemoveW.getNumPaths()):
geyserRemoveW[i].removeNode()
track = Sequence(Wait(rainDelay), Func(MovieUtil.showProp, geyserMound, battle, suit.getPos(battle)), Func(MovieUtil.showProp, geyserWater, battle, suit.getPos(battle)), LerpScaleInterval(geyserWater, 1.0, scaleUpPoint, startScale=MovieUtil.PNT3_NEARZERO), Wait(geyserHold * 0.5), LerpScaleInterval(geyserWater, 0.5, MovieUtil.PNT3_NEARZERO, startScale=scaleUpPoint))
track.append(LerpScaleInterval(geyserMound, 0.5, MovieUtil.PNT3_NEARZERO))
track.append(Func(MovieUtil.removeProp, geyserMound))
track.append(Func(MovieUtil.removeProp, geyserWater))
track.append(Func(MovieUtil.removeProp, geyser))
return track
if not uberClone:
tracks.append(Sequence(Wait(delayTime), getGeyserTrack(cloud, suit, geyserPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, geyserHold, useEffect=1)))
if hp > 0 or delay <= 0:
tracks.append(Sequence(Wait(delayTime), __getSuitTrack(suit, tContact, tSuitDodges, hp, hpbonus, kbbonus, 'soak', died, leftSuits, rightSuits, battle, toon, fShowStun, beforeStun=2.6, afterStun=2.3, geyser=1, uberRepeat=uberClone, revived=revived)))
return tracks
示例12: __doStormCloud
def __doStormCloud(squirt, delay, fShowStun):
toon = squirt['toon']
level = squirt['level']
hpbonus = squirt['hpbonus']
target = squirt['target']
suit = target['suit']
hp = target['hp']
kbbonus = target['kbbonus']
died = target['died']
revived = target['revived']
leftSuits = target['leftSuits']
rightSuits = target['rightSuits']
battle = squirt['battle']
suitPos = suit.getPos(battle)
origHpr = toon.getHpr(battle)
hitSuit = hp > 0
scale = sprayScales[level]
tButton = 0.0
dButtonScale = 0.5
dButtonHold = 3.0
tContact = 2.9
tSpray = 1
tSuitDodges = 1.8
tracks = Parallel()
soundTrack = __getSoundTrack(level, hitSuit, 2.3, toon)
soundTrack2 = __getSoundTrack(level, hitSuit, 4.6, toon)
tracks.append(soundTrack)
tracks.append(soundTrack2)
button = globalPropPool.getProp('button')
button2 = MovieUtil.copyProp(button)
buttons = [button, button2]
hands = toon.getLeftHands()
toonTrack = Sequence(Func(MovieUtil.showProps, buttons, hands), Func(toon.headsUp, battle, suitPos), ActorInterval(toon, 'pushbutton'), Func(MovieUtil.removeProps, buttons), Func(toon.loop, 'neutral'), Func(toon.setHpr, battle, origHpr))
tracks.append(toonTrack)
cloud = globalPropPool.getProp('stormcloud')
cloud2 = MovieUtil.copyProp(cloud)
BattleParticles.loadParticles()
trickleEffect = BattleParticles.createParticleEffect(file='trickleLiquidate')
rainEffect = BattleParticles.createParticleEffect(file='liquidate')
rainEffect2 = BattleParticles.createParticleEffect(file='liquidate')
rainEffect3 = BattleParticles.createParticleEffect(file='liquidate')
cloudHeight = suit.height + 3
cloudPosPoint = Point3(0, 0, cloudHeight)
scaleUpPoint = Point3(3, 3, 3)
rainEffects = [rainEffect, rainEffect2, rainEffect3]
rainDelay = 1
effectDelay = 0.3
if hp > 0:
cloudHold = 4.7
else:
cloudHold = 1.7
def getCloudTrack(cloud, suit, cloudPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, cloudHold, useEffect, battle = battle, trickleEffect = trickleEffect):
track = Sequence(Func(MovieUtil.showProp, cloud, suit, cloudPosPoint), Func(cloud.pose, 'stormcloud', 0), LerpScaleInterval(cloud, 1.5, scaleUpPoint, startScale=MovieUtil.PNT3_NEARZERO), Wait(rainDelay))
if useEffect == 1:
ptrack = Parallel()
delay = trickleDuration = cloudHold * 0.25
trickleTrack = Sequence(Func(battle.movie.needRestoreParticleEffect, trickleEffect), ParticleInterval(trickleEffect, cloud, worldRelative=0, duration=trickleDuration, cleanup=True), Func(battle.movie.clearRestoreParticleEffect, trickleEffect))
track.append(trickleTrack)
for i in range(0, 3):
dur = cloudHold - 2 * trickleDuration
ptrack.append(Sequence(Func(battle.movie.needRestoreParticleEffect, rainEffects[i]), Wait(delay), ParticleInterval(rainEffects[i], cloud, worldRelative=0, duration=dur, cleanup=True), Func(battle.movie.clearRestoreParticleEffect, rainEffects[i])))
delay += effectDelay
ptrack.append(Sequence(Wait(3 * effectDelay), ActorInterval(cloud, 'stormcloud', startTime=1, duration=cloudHold)))
track.append(ptrack)
else:
track.append(ActorInterval(cloud, 'stormcloud', startTime=1, duration=cloudHold))
track.append(LerpScaleInterval(cloud, 0.5, MovieUtil.PNT3_NEARZERO))
track.append(Func(MovieUtil.removeProp, cloud))
return track
tracks.append(getCloudTrack(cloud, suit, cloudPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, cloudHold, useEffect=1))
tracks.append(getCloudTrack(cloud2, suit, cloudPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, cloudHold, useEffect=0))
if hp > 0 or delay <= 0:
tracks.append(__getSuitTrack(suit, tContact, tSuitDodges, hp, hpbonus, kbbonus, 'soak', died, leftSuits, rightSuits, battle, toon, fShowStun, beforeStun=2.6, afterStun=2.3, revived=revived))
return tracks
示例13: createSuitDeathTrack
def createSuitDeathTrack(suit, toon, battle):
suitIvals = []
deathSuit = suit.getLoseActor()
(suitPos, suitHpr) = battle.getActorPosHpr(suit)
suitIvals.append(FunctionInterval(insertDeathSuit, extraArgs = [
suit,
deathSuit,
battle,
suitPos]))
suitIvals.append(ActorInterval(deathSuit, 'lose', duration = SUIT_LOSE_DURATION))
suitIvals.append(FunctionInterval(removeDeathSuit, name = 'remove-death-suit', extraArgs = [
suit,
deathSuit]))
suitTrack = Track(suitIvals)
spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.mp3')
deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.mp3')
deathSoundTrack = Track([
WaitInterval(0.80000000000000004),
SoundInterval(spinningSound, duration = 1.2, startTime = 1.5, volume = 0.20000000000000001, node = suit),
SoundInterval(spinningSound, duration = 3.0, startTime = 0.59999999999999998, volume = 0.90000000000000002, node = suit),
SoundInterval(deathSound, volume = 0.40000000000000002, node = suit)])
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(suitPos.getX(), suitPos.getY(), suitPos.getZ() + suit.height - 0.20000000000000001)
smallGears.setPos(gearPoint)
singleGear.setPos(gearPoint)
smallGearExplosion.setPos(gearPoint)
bigGearExplosion.setPos(gearPoint)
explosionIvals = []
explosionIvals.append(WaitInterval(5.4000000000000004))
explosionIvals.extend(createKapowExplosionIvals(battle, explosionPoint = gearPoint))
explosionTrack = Track(explosionIvals)
gears1Track = Track([
(2.1000000000000001, ParticleInterval(smallGears, battle, worldRelative = 0, duration = 4.2999999999999998))], name = 'gears1Track')
gears2MTrack = MultiTrack([
Track([
(0.69999999999999996, ParticleInterval(singleGear, battle, worldRelative = 0, duration = 5.7000000000000002))]),
Track([
(5.2000000000000002, ParticleInterval(smallGearExplosion, battle, worldRelative = 0, duration = 1.2))]),
Track([
(5.4000000000000004, ParticleInterval(bigGearExplosion, battle, worldRelative = 0, duration = 1.0))]),
explosionTrack], name = 'gears2MTrack')
toonTracks = []
for mtoon in battle.toons:
toonTracks.append(Track([
WaitInterval(1.0),
ActorInterval(mtoon, 'duck'),
ActorInterval(mtoon, 'duck', startTime = 1.8),
FunctionInterval(mtoon.loop, extraArgs = [
'neutral'])]))
toonMTrack = MultiTrack(toonTracks)
return MultiTrack([
suitTrack,
deathSoundTrack,
gears1Track,
gears2MTrack,
toonMTrack])
示例14: startSparksIval
def startSparksIval(tntProp):
tip = tntProp.find('**/joint_attachEmitter')
sparks = BattleParticles.createParticleEffect(file='tnt')
return Func(sparks.start, tip)
示例15: __createThrownTrapMultiTrack
#.........这里部分代码省略.........
Point3(94, 0, 0)]),
LerpPosInterval(thrownProp, flingDuration, pos = landPoint, other = suit),
LerpPosInterval(thrownProp, rollDuration, pos = throwPoint, other = suit)])
animTrack = Track([
ActorInterval(thrownProp, propName, startTime = throwDelay + 0.90000000000000002)])
scaleTrack = Track([
LerpScaleInterval(thrownProp, throwDuration, scale = MovieUtil.PNT3_ONE)])
soundTrack = getSoundTrack('TL_marbles.mp3', delay = 0.10000000000000001, node = toon)
throwIvals.append(WaitInterval(0.20000000000000001))
throwIvals.append(MultiTrack([
moveTrack,
animTrack,
scaleTrack,
soundTrack]))
elif trapName == 'rake':
(trapPoint, trapHpr) = battle.getActorPosHpr(suit)
trapPoint.setY(MovieUtil.SUIT_TRAP_RAKE_DISTANCE)
throwDuration = 1.1000000000000001
throwingTrack = Track(createThrowIvals(thrownProp, trapPoint, duration = throwDuration, parent = suit))
hprTrack = Track([
LerpHprInterval(thrownProp, throwDuration, hpr = Point3(180, 90, -180))])
scaleTrack = Track([
LerpScaleInterval(thrownProp, 0.90000000000000002, scale = Point3(0.69999999999999996, 0.69999999999999996, 0.69999999999999996))])
soundTrack = Track([
SoundInterval(globalBattleSoundCache.getSound('TL_rake_throw_only.mp3'), duration = 1.1000000000000001, node = suit)])
throwIvals.append(WaitInterval(0.20000000000000001))
throwIvals.append(MultiTrack([
throwingTrack,
hprTrack,
scaleTrack,
soundTrack]))
else:
notify.warning('__createThrownTrapMultiTrack() - Incorrect trap: %s thrown from toon' % trapName)
def placeTrap(trapProp, suit, battle = battle, trapName = trapName):
if not trapProp or trapProp.isEmpty():
return None
trapProp.wrtReparentTo(suit)
trapProp.show()
if trapName == 'rake':
trapProp.setPos(0, MovieUtil.SUIT_TRAP_RAKE_DISTANCE, 0)
trapProp.setHpr(Point3(0, 270, 0))
trapProp.setScale(Point3(0.69999999999999996, 0.69999999999999996, 0.69999999999999996))
rakeOffset = MovieUtil.getSuitRakeOffset(suit)
trapProp.setY(trapProp.getY() + rakeOffset)
elif trapName == 'banana':
trapProp.setHpr(0, 0, 0)
trapProp.setPos(0, MovieUtil.SUIT_TRAP_DISTANCE, -0.34999999999999998)
trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1)
elif trapName == 'marbles':
trapProp.setHpr(Point3(94, 0, 0))
trapProp.setPos(0, MovieUtil.SUIT_TRAP_MARBLES_DISTANCE, 0)
trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1)
elif trapName == 'tnt':
trapProp.setHpr(0, 90, 0)
trapProp.setPos(0, MovieUtil.SUIT_TRAP_TNT_DISTANCE, 0.40000000000000002)
else:
notify.warning('placeTrap() - Incorrect trap: %s placed on a suit' % trapName)
dustNode = hidden.attachNewNode('DustNode')
def placeDustExplosion(dustNode = dustNode, thrownProp = thrownProp, battle = battle):
dustNode.reparentTo(battle)
dustNode.setPos(thrownProp.getPos(battle))
if explode == 1:
throwIvals.append(FunctionInterval(thrownProp.wrtReparentTo, extraArgs = [
hidden]))
throwIvals.append(FunctionInterval(placeDustExplosion))
throwIvals.extend(createCartoonExplosionIvals(dustNode, 'dust', explosionPoint = Point3(0, 0, 0)))
throwIvals.append(FunctionInterval(battle.removeTrap, extraArgs = [
suit]))
else:
throwIvals.append(FunctionInterval(placeTrap, extraArgs = [
trapProp,
suit]))
if trapName == 'tnt':
tip = trapProp.find('**/joint-attachEmitter')
sparks = BattleParticles.createParticleEffect(file = 'tnt')
trapProp.sparksEffect = sparks
throwIvals.append(FunctionInterval(sparks.start, extraArgs = [
tip]))
throwIvals.append(FunctionInterval(MovieUtil.removeProps, extraArgs = [
propList]))
propTrack = Track(propIvals)
if trapName == 'tnt':
throwTrack = Track(throwIvals)
else:
throwTrack = Track(throwIvals)
toonTrack = Track([
FunctionInterval(toon.headsUp, extraArgs = [
battle,
targetPos]),
ActorInterval(toon, 'toss')])
return MultiTrack([
propTrack,
throwTrack,
toonTrack])