本文整理汇总了Python中direct.particles.ParticleEffect.ParticleEffect.disable方法的典型用法代码示例。如果您正苦于以下问题:Python ParticleEffect.disable方法的具体用法?Python ParticleEffect.disable怎么用?Python ParticleEffect.disable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.particles.ParticleEffect.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.disable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Saucer
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import disable [as 别名]
#.........这里部分代码省略.........
def drop(self,env): #Drop all
for object in self.abductlist:
object.abduct = False
object.pickup.wrtReparentTo(env)
#object.pickup.setPos(self.dummy2.getX(),self.dummy2.getY(),self.dummy2.getZ())
self.abductlist[:] = []
def lightTask(self,task):
if not self.beamon:
self.glownode.setColor(.1,.06,.92,1)
self.glownode2.setColor(.1,.06,.92,1)
if self.beamon:
s = self.beamspeed/25
self.glownode.setColor(.12 - s/10,1 - s,.08 - s/10,1)
self.glownode2.setColor(.12 - s/10,1 - s,.08- s/10,1)
return task.cont
def abductTask(self,task):
if self.updown:
self.dummy.setZ(self.ship.getZ())
self.updown = False
else:
self.dummy.setZ(36)
self.updown = True
for obj in self.abductlist:
obj.rise(self)
return Task.cont
def cowbig(self,me):
if me > self.panda and me > self.pigs and me > self.sheep:
return True
def pigbig(self,me):
if me > self.cows and me > self.sheep and me > self.panda:
return True
def sheepbig(self,me):
if me > self.cows and me > self.pigs and me > self.panda:
return True
def pandabig(self,me):
if me > self.cows and me > self.pigs and me > self.sheep:
return True
def biggest(self):
if self.cowbig(self.cows):
return self.cows - ((self.pigs + self.sheep + self.panda) / 3)
if self.pigbig(self.pigs):
return self.pigs - ((self.cows + self.sheep + self.panda) / 3)
if self.sheepbig(self.sheep):
return self.sheep - ((self.pigs + self.cows + self.panda) / 3)
if self.pandabig(self.panda):
return self.panda - ((self.pigs + self.sheep + self.cows) / 3)
return 0
def findSpeed(self):
self.cows = 0
self.pigs = 0
self.sheep = 0
self.panda = 0
for animal in self.animals:
if animal.type2 == 'cow':
self.cows += 1
if animal.type2 == 'pig':
self.pigs += 1
if animal.type2 == 'sheep':
self.sheep += 1
if animal.type2 == 'panda':
self.panda += 1
speedadd = self.biggest() * 1.7
speeddeduct = len(self.inanimates)
self.beamspeed = self.basebeamspeed - speeddeduct + speedadd
self.stuntime = self.stunbase - (self.beamspeed * 1.5)
if self.stuntime < 2:
self.stuntime = 2
#Minimum beam speed
if self.beamspeed < 2:
self.beamspeed = 2
def abductAnimal(self):
self.pcount = self.particletime
#self.abductp.start(parent = self.ship, renderParent = self.ship)
self.collected += 1
def particleTask(self,task):
if self.pcount > 0:
self.pcount -= 1
elif self.pcount == 0:
self.pcount = -1
self.abductp.reset()
self.abductp.disable()
return task.cont
示例2: Pickupable
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import disable [as 别名]
#.........这里部分代码省略.........
self.pickup.setZ(-36 + self.height)
self.fallspeed = 0
if self.type1 == 'animal':
if self.height < self.abductheight:
self.height += .01 * self.weight * ship.beamspeed
self.pickup.setHpr(self.pickup.getH() + 1,0,0)
else:
self.abducted()
else:
if self.height < self.abductheight:
self.height += .01 * self.weight * ship.beamspeed
self.pickup.setHpr(self.pickup.getH() + .5,0,0)
else:
ship.abductlist.remove(self)
self.explode()
def playPickupSound(self):
randSound = random.choice(self.pickupSounds)
randSound.play()
def abducted(self):
self.suckSound.play()
self.die()
def die(self): #Set self to dead, remove from render node. For recycler.
self.myship.abductAnimal()
self.pickup.detachNode()
self.pickup.remove()
if self in self.myship.abductlist:
self.myship.abductlist.remove(self)
if self in self.myship.animals:
self.myship.animals.remove(self)
if self in self.myship.inanimates:
self.myship.inanimates.remove(self)
self.myship.findSpeed()
self.alive = False
self.particle.disable()
def particleTask(self,task):
if self.pcount > 0:
self.pcount -= 1
elif (self.pcount <= 0) and (self.pcount != -6.66):
self.pcount = -6.66
self.particle.disable()
if self.willdie:
self.die()
return task.cont
def moveTask(self,task): #Responsible for falling when dropped, walking around(??)
if not self.willdie:
if self.stunned:
if self.lr == False:
self.lr = True
self.shakex = self.pickup.getX()
self.shakey = self.pickup.getY()
self.shakez = self.pickup.getZ()
else:
self.pickup.setPos(self.shakex + random.uniform(-.1,.1),self.shakey + random.uniform(-.1,.1),self.shakez + random.uniform(-.1,.1))
self.stuncount += 1
if self.stuncount > 35:
self.resetStun()
if self.abduct == False:
if self.height > 0:
self.falling = True
self.fallspeed = self.fallspeed + ((2 - self.fallspeed) * .01)
self.height -= self.fallspeed
self.pickup.setZ(self.pickup,-self.fallspeed)
elif self.height <= 0:
if self.falling:
self.height = 0
self.explode()
self.falling = False
return task.cont
def resetStun(self):
self.stunned = False
self.lr = False
self.stuncount = 0
self.pickup.setPos(self.shakex,self.shakey,self.shakez)
def explode(self):
self.pcount = self.particletime
if self.type1 == 'animal':
self.particle = self.bloodp
else:
self.particle = self.explodep
self.particle.start(parent = self.pickup, renderParent = self.pickup)
self.splatSound.play()
#self.myship.isSplat = True
self.pickup.setAlphaScale(0)
self.pickup.setTransparency(TransparencyAttrib.MAlpha)
self.willdie = True
self.falling = False