本文整理汇总了Python中direct.interval.MetaInterval.Parallel.clearToInitial方法的典型用法代码示例。如果您正苦于以下问题:Python Parallel.clearToInitial方法的具体用法?Python Parallel.clearToInitial怎么用?Python Parallel.clearToInitial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.interval.MetaInterval.Parallel
的用法示例。
在下文中一共展示了Parallel.clearToInitial方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CogdoFlyingPlayer
# 需要导入模块: from direct.interval.MetaInterval import Parallel [as 别名]
# 或者: from direct.interval.MetaInterval.Parallel import clearToInitial [as 别名]
class CogdoFlyingPlayer(FSM):
notify = DirectNotifyGlobal.directNotify.newCategory('CogdoFlyingPlayer')
def __init__(self, toon):
FSM.__init__(self, 'CogdoFlyingPlayer')
self.toon = toon
self.toon.reparentTo(render)
self.legalEaglesTargeting = []
self.activeBuffs = []
self.initModels()
self.initIntervals()
self.netTimeSentToStartDeath = 0
self.backpackState = -1
self.lastBackpackState = -1
self.lastPropellerSpinRate = Globals.Gameplay.NormalPropSpeed
self.propellerSpinRate = Globals.Gameplay.NormalPropSpeed
self.setFuelState(Globals.Gameplay.FuelStates.FuelNoPropeller)
self.setOldFuelState(self.fuelState)
CogdoFlyingPlayer.setBlades(self, Globals.Gameplay.FuelStates.FuelNoPropeller)
self.setBackpackState(Globals.Gameplay.BackpackStates.Normal)
def initModels(self):
self.createPropeller()
self.createRedTapeRing()
def createPropeller(self):
self.propellerSmoke = DustCloud.DustCloud(self.toon, wantSound=False)
self.propellerSmoke.setBillboardPointEye()
self.propellerSmoke.setBin('fixed', 5002)
self.backpack = CogdoUtil.loadFlyingModel('propellerPack')
self.backpack.setScale(1.3)
self.backpack.setHpr(180.0, 0.0, 0.0)
self.backpackInstances = []
self.backpackTextureCard = CogdoUtil.loadFlyingModel('propellerPack_card')
parts = self.toon.getTorsoParts()
for part in parts:
backpackInstance = part.attachNewNode('backpackInstance')
animal = self.toon.style.getAnimal()
bodyScale = ToontownGlobals.toonBodyScales[animal]
backpackHeight = ToontownGlobals.torsoHeightDict[self.toon.style.torso] * bodyScale - 0.5
backpackInstance.setPos(0.0, -0.325, backpackHeight)
self.backpackInstances.append(backpackInstance)
self.backpack.instanceTo(backpackInstance)
self.propInstances = []
self.propeller = CogdoUtil.loadFlyingModel('toonPropeller')
for part in self.backpackInstances:
propInstance = part.attachNewNode('propInstance')
propInstance.setPos(0.0, -0.275, 0.0)
propInstance.setHpr(0.0, 20.0, 0.0)
propInstance.setScale(1.0, 1.0, 1.25)
self.propInstances.append(propInstance)
self.propeller.instanceTo(propInstance)
self.blades = []
self.activeBlades = []
index = 1
blade = self.propeller.find('**/propeller%d' % index)
while not blade.isEmpty():
self.blades.append(blade)
index += 1
blade = self.propeller.find('**/propeller%d' % index)
for blade in self.blades:
self.activeBlades.append(blade)
def createRedTapeRing(self):
self.redTapeRing = CogdoUtil.loadFlyingModel('redTapeRing')
self.redTapeRing.setTwoSided(True)
self.redTapeRing.reparentTo(self.toon)
self.redTapeRing.hide()
self.redTapeRing.setScale(1.25)
self.redTapeRing.setZ(self.toon.getHeight() / 2.0)
def initIntervals(self):
self.baseSpinDuration = 1.0
self.propellerSpinLerp = LerpFunctionInterval(self.propeller.setH, fromData=0.0, toData=360.0, duration=self.baseSpinDuration, name='%s.propellerSpinLerp-%s' % (self.__class__.__name__, self.toon.doId))
singleBlinkTime = Globals.Gameplay.TargetedWarningSingleBlinkTime
blinkTime = Globals.Gameplay.TargetedWarningBlinkTime
self.blinkLoop = Sequence(Wait(singleBlinkTime / 2.0), Func(self.setBackpackTexture, Globals.Gameplay.BackpackStates.Attacked), Wait(singleBlinkTime / 2.0), Func(self.setBackpackTexture, Globals.Gameplay.BackpackStates.Targeted), name='%s.blinkLoop-%s' % (self.__class__.__name__, self.toon.doId))
self.blinkWarningSeq = Sequence(Func(self.blinkLoop.loop), Wait(blinkTime), Func(self.blinkLoop.clearToInitial), name='%s.blinkWarningSeq-%s' % (self.__class__.__name__, self.toon.doId))
dur = Globals.Gameplay.BackpackRefuelDuration
self.refuelSeq = Sequence(Func(self.setPropellerSpinRate, Globals.Gameplay.RefuelPropSpeed), Wait(dur), Func(self.returnBackpackToLastStateFunc), name='%s.refuelSeq-%s' % (self.__class__.__name__, self.toon.doId))
scale = self.redTapeRing.getScale()
pulseTime = 1.0
self.pulseBubbleSeq = Parallel(Sequence(LerpFunctionInterval(self.redTapeRing.setScale, fromData=scale, toData=scale * 1.1, duration=pulseTime / 2.0, blendType='easeInOut'), LerpFunctionInterval(self.redTapeRing.setScale, fromData=scale * 1.1, toData=scale, duration=pulseTime / 2.0, blendType='easeInOut')), LerpHprInterval(self.redTapeRing, pulseTime, Vec3(360, 0, 0), startHpr=Vec3(0, 0, 0)), name='%s.pulseBubbleSeq-%s' % (self.__class__.__name__, self.toon.doId))
bouncePercent = 1.2
scaleTime = 0.5
scaleBounceTime = 0.25
self.popUpBubbleLerp = LerpScaleInterval(self.redTapeRing, scaleTime, scale * bouncePercent, startScale=0.0, blendType='easeInOut')
self.popUpBubbleSeq = Sequence(Func(self.updateLerpStartScale, self.popUpBubbleLerp, self.redTapeRing), Func(self.redTapeRing.show), self.popUpBubbleLerp, LerpScaleInterval(self.redTapeRing, scaleBounceTime, scale, startScale=scale * bouncePercent, blendType='easeInOut'), Func(self.pulseBubbleSeq.loop), name='%s.popUpBubbleSeq-%s' % (self.__class__.__name__, self.toon.doId))
self.removeBubbleLerp = LerpScaleInterval(self.redTapeRing, scaleBounceTime, scale * bouncePercent, startScale=scale, blendType='easeInOut')
self.removeBubbleSeq = Sequence(Func(self.pulseBubbleSeq.clearToInitial), Func(self.updateLerpStartScale, self.removeBubbleLerp, self.redTapeRing), self.removeBubbleLerp, LerpScaleInterval(self.redTapeRing, scaleTime, 0.0, startScale=scale * bouncePercent, blendType='easeInOut'), Func(self.redTapeRing.hide), name='%s.removeBubbleSeq-%s' % (self.__class__.__name__, self.toon.doId))
self.redTapeRing.setScale(0.0)
self.deathInterval = Sequence(Parallel(LerpHprInterval(self.toon, 1.0, Vec3(720, 0, 0)), LerpFunctionInterval(self.toon.setScale, fromData=1.0, toData=0.1, duration=1.0)), Func(self.toon.stash), name='%s.deathInterval-%s' % (self.__class__.__name__, self.toon.doId))
self.spawnInterval = Sequence(Func(self.toon.stash), Func(self.resetToon), Wait(1.0), Func(self.toon.setAnimState, 'TeleportIn'), Func(self.toon.unstash), name='%s.spawnInterval-%s' % (self.__class__.__name__, self.toon.doId))
singleBlinkTime = Globals.Gameplay.InvulSingleBlinkTime
blinkTime = Globals.Gameplay.InvulBlinkTime
invulBuffTime = Globals.Gameplay.InvulBuffTime
self.blinkBubbleLoop = Sequence(LerpFunctionInterval(self.redTapeRing.setAlphaScale, fromData=1.0, toData=0.0, duration=singleBlinkTime / 2.0, blendType='easeInOut'), LerpFunctionInterval(self.redTapeRing.setAlphaScale, fromData=0.0, toData=1.0, duration=singleBlinkTime / 2.0, blendType='easeInOut'), name='%s.blinkBubbleLoop-%s' % (self.__class__.__name__, self.toon.doId))
#.........这里部分代码省略.........