本文整理汇总了Python中toontown.battle.BattleParticles.getParticle方法的典型用法代码示例。如果您正苦于以下问题:Python BattleParticles.getParticle方法的具体用法?Python BattleParticles.getParticle怎么用?Python BattleParticles.getParticle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.battle.BattleParticles
的用法示例。
在下文中一共展示了BattleParticles.getParticle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeCrunchTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import getParticle [as 别名]
def makeCrunchTrack(self):
toonId = self.toon
toon = base.cr.doId2do.get(toonId)
if not toon:
return
self.virtualSuit.lookAt(toon)
if self.virtualSuit.style.body in ['a', 'b']:
throwDelay = 3
elif self.virtualSuit.style.body == 'c':
throwDelay = 2.3
else:
throwDelay = 2
numberNames = ['one',
'two',
'three',
'four',
'five',
'six']
BattleParticles.loadParticles()
numberSpill1 = BattleParticles.createParticleEffect(file='numberSpill')
numberSpill2 = BattleParticles.createParticleEffect(file='numberSpill')
spillTexture1 = random.choice(numberNames)
spillTexture2 = random.choice(numberNames)
BattleParticles.setEffectTexture(numberSpill1, 'audit-' + spillTexture1)
BattleParticles.setEffectTexture(numberSpill2, 'audit-' + spillTexture2)
numberSpillTrack1 = getPartTrack(numberSpill1, 1.1, 2.2, [numberSpill1, self.virtualSuit, 0])
numberSpillTrack2 = getPartTrack(numberSpill2, 1.5, 1.0, [numberSpill2, self.virtualSuit, 0])
numberSprayTracks = Parallel()
numOfNumbers = random.randint(5, 9)
for i in xrange(0, numOfNumbers - 1):
nextSpray = BattleParticles.createParticleEffect(file='numberSpray')
nextTexture = random.choice(numberNames)
BattleParticles.setEffectTexture(nextSpray, 'audit-' + nextTexture)
nextStartTime = random.random() * 0.6 + 3.03
nextDuration = random.random() * 0.4 + 1.4
nextSprayTrack = getPartTrack(nextSpray, nextStartTime, nextDuration, [nextSpray, self.virtualSuit, 0])
numberSprayTracks.append(nextSprayTrack)
def throwProp(prop):
if not self.virtualSuit:
return
toon = self.cr.doId2do.get(toonId)
if not toon:
self.cleanupProp(prop, False)
self.finishPropAttack()
return
self.virtualSuit.lookAt(toon)
prop.wrtReparentTo(render)
hitPos = toon.getPos() + Vec3(0, 0, 2.5)
distance = (prop.getPos() - hitPos).length()
speed = 50.0
throwSequence = Sequence(
prop.posInterval(distance / speed, hitPos),
Func(self.cleanupProp, prop, False)
)
throwSequence.start()
numberTracks = Parallel()
for i in xrange(0, numOfNumbers):
texture = random.choice(numberNames)
next = copyProp(BattleParticles.getParticle('audit-' + texture))
next.reparentTo(self.virtualSuit.getRightHand())
next.setScale(0.01, 0.01, 0.01)
next.setColor(Vec4(0.0, 0.0, 0.0, 1.0))
next.setPos(random.random() * 0.6 - 0.3, random.random() * 0.6 - 0.3, random.random() * 0.6 - 0.3)
next.setHpr(VBase3(-1.15, 86.58, -76.78))
# Make prop virtual:
next.setColorScale(1.0, 0.0, 0.0, 0.8)
next.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
# Prop collisions:
colNode = CollisionNode(self.uniqueName('SuitAttack'))
colNode.setTag('damage', str(self.attackInfo[1]))
bounds = next.getBounds()
center = bounds.getCenter()
radius = bounds.getRadius()
sphere = CollisionSphere(center.getX(), center.getY(), center.getZ(), radius)
sphere.setTangible(0)
colNode.addSolid(sphere)
colNode.setIntoCollideMask(WallBitmask)
next.attachNewNode(colNode)
numberTrack = Sequence(
Wait(throwDelay),
Parallel(
LerpScaleInterval(next, 0.6, Point3(1.0, 1.0, 1.0)),
Func(throwProp, next),
),
#.........这里部分代码省略.........
示例2: makeWriteOffTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import getParticle [as 别名]
def makeWriteOffTrack(self):
pad = BattleProps.globalPropPool.getProp('pad')
pad.setScale(1.89)
pencil = BattleProps.globalPropPool.getProp('pencil')
BattleParticles.loadParticles()
checkmark = copyProp(BattleParticles.getParticle('checkmark'))
checkmark.setBillboardPointEye()
# Make prop virtual:
pad.setColorScale(1.0, 0.0, 0.0, 0.8)
pad.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
pencil.setColorScale(1.0, 0.0, 0.0, 0.8)
pencil.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
checkmark.setColorScale(1.0, 0.0, 0.0, 0.8)
checkmark.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
# Prop collisions:
colNode = CollisionNode(self.uniqueName('SuitAttack'))
colNode.setTag('damage', str(self.attackInfo[1]))
bounds = checkmark.getBounds()
center = bounds.getCenter()
radius = bounds.getRadius()
sphere = CollisionSphere(center.getX(), center.getY(), center.getZ(), radius)
sphere.setTangible(0)
colNode.addSolid(sphere)
colNode.setIntoCollideMask(WallBitmask)
checkmark.attachNewNode(colNode)
toonId = self.toon
toon = base.cr.doId2do.get(toonId)
if not toon:
return
self.virtualSuit.lookAt(toon)
if self.virtualSuit.style.body in ['a', 'b']:
throwDelay = 3
elif self.virtualSuit.style.body == 'c':
throwDelay = 2.3
else:
throwDelay = 2
def throwProp():
if not self.virtualSuit:
return
toon = self.cr.doId2do.get(toonId)
if not toon:
self.cleanupProp(checkmark, False)
self.finishPropAttack()
return
self.virtualSuit.lookAt(toon)
checkmark.wrtReparentTo(render)
hitPos = toon.getPos() + Vec3(0, 0, 2.5)
distance = (checkmark.getPos() - hitPos).length()
speed = 50.0
if self.attackProp == 'teeth':
throwSequence = Sequence(
Parallel(
checkmark.posInterval(distance / speed, hitPos),
ActorInterval(checkmark, 'teeth', duration=distance / speed),
),
Func(self.cleanupProp, checkmark, False),
)
else:
throwSequence = Sequence(
checkmark.posInterval(distance / speed, hitPos),
Func(self.cleanupProp, checkmark, False)
)
throwSequence.start()
pencilTrack = Sequence(
Wait(0.5),
Func(pencil.setPosHpr, -0.47, 1.08, 0.28, 21.045, 12.702, -176.374),
Func(pencil.reparentTo, self.virtualSuit.getRightHand()),
LerpScaleInterval(pencil, 0.5, Point3(1.5, 1.5, 1.5),
startScale=Point3(0.01)),
Wait(throwDelay),
Func(checkmark.reparentTo, render),
Func(checkmark.setScale, 1.6),
Func(checkmark.setPosHpr, pencil, 0, 0, 0, 0, 0, 0),
Func(checkmark.setP, 0),
Func(checkmark.setR, 0),
Func(throwProp),
Wait(0.3),
LerpScaleInterval(pencil, 0.5, Point3(0.01, 0.01, 0.01)),
Func(pencil.removeNode),
)
suitTrack = Sequence(
ActorInterval(self.virtualSuit, 'hold-pencil'),
Func(self.virtualSuit.loop, 'neutral', 0),
)
#.........这里部分代码省略.........