本文整理汇总了Python中toontown.minigame.OrthoWalk.OrthoWalk.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python OrthoWalk.destroy方法的具体用法?Python OrthoWalk.destroy怎么用?Python OrthoWalk.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.minigame.OrthoWalk.OrthoWalk
的用法示例。
在下文中一共展示了OrthoWalk.destroy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DistributedPartyCatchActivity
# 需要导入模块: from toontown.minigame.OrthoWalk import OrthoWalk [as 别名]
# 或者: from toontown.minigame.OrthoWalk.OrthoWalk import destroy [as 别名]
#.........这里部分代码省略.........
self.__textGen = TextNode('partyCatchActivity')
self.__textGen.setFont(ToontownGlobals.getSignFont())
self.__textGen.setAlign(TextNode.ACenter)
self.activityFSM.request('Idle')
def __loadDropModels(self):
for objType in PartyGlobals.DropObjectTypes:
model = loader.loadModel(objType.modelPath)
self.dropObjModels[objType.name] = model
modelScales = {'apple': 0.7,
'orange': 0.7,
'pear': 0.5,
'coconut': 0.7,
'watermelon': 0.6,
'pineapple': 0.45}
if modelScales.has_key(objType.name):
model.setScale(modelScales[objType.name])
if objType == PartyGlobals.Name2DropObjectType['pear']:
model.setZ(-.6)
if objType == PartyGlobals.Name2DropObjectType['coconut']:
model.setP(180)
if objType == PartyGlobals.Name2DropObjectType['watermelon']:
model.setH(135)
model.setZ(-.5)
if objType == PartyGlobals.Name2DropObjectType['pineapple']:
model.setZ(-1.7)
if objType == PartyGlobals.Name2DropObjectType['anvil']:
model.setZ(-self.ObjRadius)
model.flattenStrong()
def unload(self):
DistributedPartyCatchActivity.notify.debug('unload')
self.finishAllDropIntervals()
self.destroyOrthoWalk()
DistributedPartyActivity.unload(self)
self.stopDropTask()
del self.activityFSM
del self.__textGen
for avId in self.toonSDs.keys():
if self.toonSDs.has_key(avId):
toonSD = self.toonSDs[avId]
toonSD.unload()
del self.toonSDs
self.treesAndFence.removeNode()
del self.treesAndFence
self.dropShadow.removeNode()
del self.dropShadow
base.cr.parentMgr.unregisterParent(self._avatarNodePathParentToken)
for model in self.dropObjModels.values():
model.removeNode()
del self.dropObjModels
del self.sndGoodCatch
del self.sndOof
del self.sndAnvilLand
del self.sndPerfect
def setStartTimestamp(self, timestamp32):
self.notify.info('setStartTimestamp(%s)' % (timestamp32,))
self._startTimestamp = globalClockDelta.networkToLocalTime(timestamp32, bits=32)
def getCurrentCatchActivityTime(self):
return globalClock.getFrameTime() - self._startTimestamp
def getObjModel(self, objName):
示例2: CogdoFlyingLocalPlayer
# 需要导入模块: from toontown.minigame.OrthoWalk import OrthoWalk [as 别名]
# 或者: from toontown.minigame.OrthoWalk.OrthoWalk import destroy [as 别名]
#.........这里部分代码省略.........
self.hasPickedUpFirstPropeller = False
self.surfacePoint = None
self.legalEagleHitting = False
self.propState = None
self.broadcastPeriod = Globals.AI.BroadcastPeriod
self.initSfx()
self.initLocalPlayerIntervals()
self.initCollisions()
self.initOrthoWalker()
self.playerNumber = -1
self.fuel = 0.0
self._guiMgr.setFuel(self.fuel)
self.setCheckpointPlatform(self._level.startPlatform)
def initSfx(self):
audioMgr = base.cogdoGameAudioMgr
self._deathSfx = audioMgr.createSfx('death')
self._hitByWhirlwindSfx = audioMgr.createSfx('toonInWhirlwind')
self._bladeBreakSfx = audioMgr.createSfx('bladeBreak')
self._collideSfx = audioMgr.createSfx('collide')
self._toonHitSfx = audioMgr.createSfx('toonHit')
self._getMemoSfx = audioMgr.createSfx('getMemo')
self._getLaffSfx = audioMgr.createSfx('getLaff')
self._getRedTapeSfx = audioMgr.createSfx('getRedTape')
self._refuelSfx = audioMgr.createSfx('refuel')
self._fanSfx = audioMgr.createSfx('fan')
self._invulDebuffSfx = audioMgr.createSfx('invulDebuff')
self._invulBuffSfx = audioMgr.createSfx('invulBuff')
self._winSfx = audioMgr.createSfx('win')
self._loseSfx = audioMgr.createSfx('lose')
self._refuelSpinSfx = audioMgr.createSfx('refuelSpin')
self._propellerSfx = audioMgr.createSfx('propeller', self.toon)
def destroySfx(self):
del self._deathSfx
del self._hitByWhirlwindSfx
del self._bladeBreakSfx
del self._collideSfx
del self._toonHitSfx
del self._propellerSfx
del self._getMemoSfx
del self._getLaffSfx
del self._refuelSfx
del self._fanSfx
del self._invulBuffSfx
del self._invulDebuffSfx
del self._getRedTapeSfx
del self._refuelSpinSfx
def setPlayerNumber(self, num):
self.playerNumber = num
def getPlayerNumber(self):
return self.playerNumber
def initOrthoWalker(self):
orthoDrive = OrthoDrive(9.778, maxFrameMove=0.5, wantSound=True)
self.orthoWalk = OrthoWalk(orthoDrive, broadcast=False, collisions=False, broadcastPeriod=Globals.AI.BroadcastPeriod)
def initLocalPlayerIntervals(self):
self.coolDownAfterHitInterval = Sequence(Wait(Globals.Gameplay.HitCooldownTime), Func(self.setEnemyHitting, False), name='coolDownAfterHitInterval-%i' % self.toon.doId)
self.deathInterval = Sequence(Func(self.resetVelocities), Parallel(Parallel(Func(self._deathSfx.play), LerpHprInterval(self.toon, 1.0, Vec3(720, 0, 0)), LerpFunctionInterval(self.toon.setScale, fromData=1.0, toData=0.1, duration=1.0), self.toon.posInterval(0.5, Vec3(0, 0, -25), other=self.toon)), Sequence(Wait(0.5), Func(base.transitions.irisOut))), Func(self.toon.stash), Wait(1.0), Func(self.toonSpawnFunc), name='%s.deathInterval' % self.__class__.__name__)
self.outOfTimeInterval = Sequence(Func(messenger.send, CogdoFlyingLocalPlayer.PlayWaitingMusicEventName), Func(self._loseSfx.play), Func(base.transitions.irisOut), Wait(1.0), Func(self.resetVelocities), Func(self._guiMgr.setMessage, '', transition=None), Func(self.toon.stash), Func(self.toonSpawnFunc), name='%s.outOfTimeInterval' % self.__class__.__name__)
self.spawnInterval = Sequence(Func(self.resetToonFunc), Func(self._cameraMgr.update, 0.0), Func(self._level.update), Func(self.toon.cnode.broadcastPosHprFull), Func(base.transitions.irisIn), Wait(0.5), Func(self.toon.setAnimState, 'TeleportIn'), Func(self.toon.unstash), Wait(1.5), Func(self.requestPostSpawnState), name='%s.spawnInterval' % self.__class__.__name__)
self.waitingForWinInterval = Sequence(Func(self._guiMgr.setMessage, TTLocalizer.CogdoFlyingGameWaiting % '.'), Wait(1.5), Func(self._guiMgr.setMessage, TTLocalizer.CogdoFlyingGameWaiting % '..'), Wait(1.5), Func(self._guiMgr.setMessage, TTLocalizer.CogdoFlyingGameWaiting % '...'), Wait(1.5), name='%s.waitingForWinInterval' % self.__class__.__name__)
self.waitingForWinSeq = Sequence(Func(self.setWaitingForWinState), Wait(4.0), Func(self.removeAllMemos), Wait(2.0), Func(self.game.distGame.d_sendRequestAction, Globals.AI.GameActions.LandOnWinPlatform, 0), Func(self.playWaitingForWinInterval), name='%s.waitingForWinSeq' % self.__class__.__name__)
示例3: DistributedPartyDanceActivityBase
# 需要导入模块: from toontown.minigame.OrthoWalk import OrthoWalk [as 别名]
# 或者: from toontown.minigame.OrthoWalk.OrthoWalk import destroy [as 别名]
class DistributedPartyDanceActivityBase(DistributedPartyActivity):
notify = directNotify.newCategory('DistributedPartyDanceActivity')
def __init__(self, cr, actId, dancePatternToAnims, model = 'phase_13/models/parties/danceFloor'):
DistributedPartyActivity.__init__(self, cr, actId, ActivityTypes.Continuous)
self.model = model
self.danceFloor = None
self.localToonDancing = False
self.keyCodes = None
self.gui = None
self.currentCameraMode = None
self.orthoWalk = None
self.cameraParallel = None
self.localToonDanceSequence = None
self.localPatternsMatched = []
self.dancePatternToAnims = dancePatternToAnims
self.dancingToonFSMs = {}
return
def generateInit(self):
self.notify.debug('generateInit')
DistributedPartyActivity.generateInit(self)
self.keyCodes = KeyCodes(patterns=self.dancePatternToAnims.keys())
self.gui = KeyCodesGui(self.keyCodes)
self.__initOrthoWalk()
self.activityFSM = DanceActivityFSM(self)
def announceGenerate(self):
DistributedPartyActivity.announceGenerate(self)
self.activityFSM.request('Active')
def load(self):
DistributedPartyActivity.load(self)
self.danceFloor = loader.loadModel(self.model)
self.danceFloor.reparentTo(self.getParentNodePath())
self.danceFloor.setPos(self.x, self.y, 0.0)
self.danceFloor.setH(self.h)
self.danceFloor.wrtReparentTo(render)
self.sign.setPos(22, -22, 0)
floor = self.danceFloor.find('**/danceFloor_mesh')
self.danceFloorSequence = Sequence(Wait(0.3), Func(floor.setH, floor, 36))
discoBall = self.danceFloor.find('**/discoBall_mesh')
self.discoBallSequence = Parallel(discoBall.hprInterval(6.0, Vec3(360, 0, 0)), Sequence(discoBall.posInterval(3, Point3(0, 0, 1), blendType='easeInOut'), discoBall.posInterval(3, Point3(0, 0, 0), blendType='easeInOut')))
def unload(self):
DistributedPartyActivity.unload(self)
self.activityFSM.request('Disabled')
if self.localToonDanceSequence is not None:
self.localToonDanceSequence.finish()
if self.localToonDancing:
self.__localStopDancing()
self.ignoreAll()
if self.discoBallSequence is not None:
self.discoBallSequence.finish()
if self.danceFloorSequence is not None:
self.danceFloorSequence.finish()
del self.danceFloorSequence
del self.discoBallSequence
del self.localToonDanceSequence
if self.danceFloor is not None:
self.danceFloor.removeNode()
self.danceFloor = None
self.__destroyOrthoWalk()
for toonId in self.dancingToonFSMs.keys():
self.dancingToonFSMs[toonId].destroy()
del self.dancingToonFSMs[toonId]
del self.dancingToonFSMs
del self.cameraParallel
del self.currentCameraMode
if self.keyCodes is not None:
self.keyCodes.destroy()
del self.keyCodes
del self.activityFSM
del self.gui
del self.localPatternsMatched
return
def handleToonDisabled(self, toonId):
self.notify.debug('handleToonDisabled avatar ' + str(toonId) + ' disabled')
if self.dancingToonFSMs.has_key(toonId):
self.dancingToonFSMs[toonId].request('cleanup')
self.dancingToonFSMs[toonId].destroy()
del self.dancingToonFSMs[toonId]
def getTitle(self):
self.notify.warning('define title for this dance activity')
return TTLocalizer.PartyDanceActivityTitle
def getInstructions(self):
self.notify.warning('define instructions for this dance activity')
return TTLocalizer.PartyDanceActivityInstructions
def startActive(self):
self.accept('enter' + DANCE_FLOOR_COLLISION, self.__handleEnterDanceFloor)
self.accept('exit' + DANCE_FLOOR_COLLISION, self.__handleExitDanceFloor)
self.danceFloorSequence.loop()
self.discoBallSequence.loop()
def finishActive(self):
#.........这里部分代码省略.........
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:103,代码来源:DistributedPartyDanceActivityBase.py
示例4: CogdoMazeLocalPlayer
# 需要导入模块: from toontown.minigame.OrthoWalk import OrthoWalk [as 别名]
# 或者: from toontown.minigame.OrthoWalk.OrthoWalk import destroy [as 别名]
class CogdoMazeLocalPlayer(CogdoMazePlayer):
notify = directNotify.newCategory('CogdoMazeLocalPlayer')
def __init__(self, id, toon, game, guiMgr):
CogdoMazePlayer.__init__(self, id, toon)
self.disableGagCollision()
self.game = game
self.maze = self.game.maze
self._guiMgr = guiMgr
self.cameraMgr = CogdoMazeCameraManager(self.toon, self.maze, camera, render)
self._proximityRadius = self.maze.cellWidth * Globals.CameraRemoteToonRadius
orthoDrive = OrthoDrive(Globals.ToonRunSpeed, maxFrameMove=self.maze.cellWidth / 2, customCollisionCallback=self.maze.doOrthoCollisions, wantSound=True)
self.orthoWalk = OrthoWalk(orthoDrive)
self._audioMgr = base.cogdoGameAudioMgr
self._getMemoSfx = self._audioMgr.createSfx('getMemo', source=self.toon)
self._waterCoolerFillSfx = self._audioMgr.createSfx('waterCoolerFill', source=self.toon)
self._hitByDropSfx = self._audioMgr.createSfx('toonHitByDrop', source=self.toon)
self._winSfx = self._audioMgr.createSfx('win')
self._loseSfx = self._audioMgr.createSfx('lose')
self.enabled = False
self.pickupCount = 0
self.numEntered = 0
self.throwPending = False
self.coolDownAfterHitInterval = Sequence(Wait(Globals.HitCooldownTime), Func(self.setInvulnerable, False), name='coolDownAfterHitInterval-%i' % self.toon.doId)
self.invulnerable = False
self.gagHandler = CollisionHandlerEvent()
self.gagHandler.addInPattern('%fn-into-%in')
self.exited = False
self.hints = {'find': False,
'throw': False,
'squashed': False,
'boss': False,
'minion': False}
self.accept('control', self.controlKeyPressed)
def destroy(self):
self.toon.showName()
self.ignoreAll()
self.coolDownAfterHitInterval.clearToInitial()
del self.coolDownAfterHitInterval
del self._getMemoSfx
del self._waterCoolerFillSfx
del self._hitByDropSfx
del self._winSfx
self.orthoWalk.stop()
self.orthoWalk.destroy()
del self.orthoWalk
CogdoMazePlayer.destroy(self)
def __initCollisions(self):
collSphere = CollisionSphere(0, 0, 0, Globals.PlayerCollisionRadius)
collSphere.setTangible(0)
self.mazeCollisionName = Globals.LocalPlayerCollisionName
collNode = CollisionNode(self.mazeCollisionName)
collNode.addSolid(collSphere)
collNodePath = self.toon.attachNewNode(collNode)
collNodePath.hide()
handler = CollisionHandlerEvent()
handler.addInPattern('%fn-into-%in')
base.cTrav.addCollider(collNodePath, handler)
self.handler = handler
self._collNodePath = collNodePath
def clearCollisions(self):
self.handler.clear()
def __disableCollisions(self):
self._collNodePath.removeNode()
del self._collNodePath
def _isNearPlayer(self, player):
return self.toon.getDistance(player.toon) <= self._proximityRadius
def update(self, dt):
if self.getCurrentOrNextState() != 'Off':
self._updateCamera(dt)
def _updateCamera(self, dt):
numPlayers = 0.0
for player in self.game.players:
if player != self and player.toon and self._isNearPlayer(player):
numPlayers += 1
d = clamp(Globals.CameraMinDistance + numPlayers / (CogdoGameConsts.MaxPlayers - 1) * (Globals.CameraMaxDistance - Globals.CameraMinDistance), Globals.CameraMinDistance, Globals.CameraMaxDistance)
self.cameraMgr.setCameraTargetDistance(d)
self.cameraMgr.update(dt)
def enterOff(self):
CogdoMazePlayer.enterOff(self)
def exitOff(self):
CogdoMazePlayer.exitOff(self)
self.toon.hideName()
def enterReady(self):
CogdoMazePlayer.enterReady(self)
self.cameraMgr.enable()
def exitReady(self):
CogdoMazePlayer.enterReady(self)
#.........这里部分代码省略.........
示例5: PartyCogActivityLocalPlayer
# 需要导入模块: from toontown.minigame.OrthoWalk import OrthoWalk [as 别名]
# 或者: from toontown.minigame.OrthoWalk.OrthoWalk import destroy [as 别名]
class PartyCogActivityLocalPlayer(PartyCogActivityPlayer):
def __init__(self, activity, position, team, exitActivityCallback = None):
PartyCogActivityPlayer.__init__(self, activity, base.localAvatar, position, team)
self.input = PartyCogActivityInput(exitActivityCallback)
self.gui = PartyCogActivityGui()
self.throwPiePrevTime = 0
self.lastMoved = 0
if base.localAvatar:
self.prevPos = base.localAvatar.getPos()
self.cameraManager = None
self.control = None
self.consecutiveShortThrows = 0
return
def destroy(self):
if self.enabled:
self.disable()
if self.cameraManager is not None:
self.cameraManager.setEnabled(False)
self.cameraManager.destroy()
del self.cameraManager
del self.gui
del self.input
if self.control is not None:
self.control.destroy()
del self.control
PartyCogActivityPlayer.destroy(self)
return
def _initOrthoWalk(self):
orthoDrive = OrthoDrive(9.778, customCollisionCallback=self.activity.view.checkOrthoDriveCollision)
self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
def _destroyOrthoWalk(self):
self.orthoWalk.stop()
self.orthoWalk.destroy()
del self.orthoWalk
def getPieThrowingPower(self, time):
elapsed = max(time - self.input.throwPiePressedStartTime, 0.0)
w = 1.0 / PartyGlobals.CogActivityPowerMeterTime * 2.0 * math.pi
power = int(round(-math.cos(w * elapsed) * 50.0 + 50.0))
return power
def isShortThrow(self, time):
elapsed = max(time - self.input.throwPiePressedStartTime, 0.0)
return elapsed <= PartyGlobals.CogActivityShortThrowTime
def checkForThrowSpam(self, time):
if self.isShortThrow(time):
self.consecutiveShortThrows += 1
else:
self.consecutiveShortThrows = 0
return self.consecutiveShortThrows >= PartyGlobals.CogActivityShortThrowSpam
def _startUpdateTask(self):
task = Task(self._updateTask)
task.lastPositionBroadcastTime = 0.0
self.throwPiePrevTime = 0
taskMgr.add(task, UPDATE_TASK_NAME)
def _stopUpdateTask(self):
taskMgr.remove(UPDATE_TASK_NAME)
def _updateTask(self, task):
self._update()
if base.localAvatar.getPos() != self.prevPos:
self.prevPos = base.localAvatar.getPos()
self.lastMoved = self.activity.getCurrentActivityTime()
if max(self.activity.getCurrentActivityTime() - self.lastMoved, 0) > PartyGlobals.ToonMoveIdleThreshold:
self.gui.showMoveControls()
if max(self.activity.getCurrentActivityTime() - self.throwPiePrevTime, 0) > PartyGlobals.ToonAttackIdleThreshold:
self.gui.showAttackControls()
if self.input.throwPieWasReleased:
if self.checkForThrowSpam(globalClock.getFrameTime()):
self.gui.showSpamWarning()
self.input.throwPieWasReleased = False
self.throwPie(self.getPieThrowingPower(globalClock.getFrameTime()))
return Task.cont
def throwPie(self, piePower):
if not self.activity.isState('Active'):
return
if self.activity.getCurrentActivityTime() - self.throwPiePrevTime > THROW_PIE_LIMIT_TIME:
self.throwPiePrevTime = self.activity.getCurrentActivityTime()
self.activity.b_pieThrow(self.toon, piePower)
def _update(self):
self.control.update()
def getLookat(self, whosLooking, refNode = None):
if refNode is None:
refNode = render
dist = 5.0
oldParent = self.tempNP.getParent()
self.tempNP.reparentTo(whosLooking)
self.tempNP.setPos(0.0, dist, 0.0)
pos = self.tempNP.getPos(refNode)
self.tempNP.reparentTo(oldParent)
#.........这里部分代码省略.........