本文整理汇总了Python中toontown.minigame.OrthoWalk.OrthoWalk类的典型用法代码示例。如果您正苦于以下问题:Python OrthoWalk类的具体用法?Python OrthoWalk怎么用?Python OrthoWalk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrthoWalk类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: initGameWalk
def initGameWalk(self):
self.notify.debug('startOrthoWalk')
def doCollisions(oldPos, newPos, self = self):
x = bound(newPos[0], CTGG.StageHalfWidth, -CTGG.StageHalfWidth)
y = bound(newPos[1], CTGG.StageHalfHeight, -CTGG.StageHalfHeight)
newPos.setX(x)
newPos.setY(y)
return newPos
orthoDrive = OrthoDrive(self.ToonSpeed, customCollisionCallback=doCollisions, instantTurn=True)
self.gameWalk = OrthoWalk(orthoDrive, broadcast=not self.isSinglePlayer())
示例3: initOrthoWalk
def initOrthoWalk(self):
DistributedPartyCatchActivity.notify.debug('startOrthoWalk')
def doCollisions(oldPos, newPos, self = self):
x = bound(newPos[0], self.StageHalfWidth, -self.StageHalfWidth)
y = bound(newPos[1], self.StageHalfHeight, -self.StageHalfHeight)
newPos.setX(x)
newPos.setY(y)
return newPos
orthoDrive = OrthoDrive(self.ToonSpeed, instantTurn=True)
self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
示例4: initGameWalk
def initGameWalk(self):
self.notify.debug("startOrthoWalk")
if self.useOrthoWalk:
def doCollisions(oldPos, newPos, self=self):
x = bound(newPos[0], CTGG.StageHalfWidth, -(CTGG.StageHalfWidth))
y = bound(newPos[1], CTGG.StageHalfHeight, -(CTGG.StageHalfHeight))
newPos.setX(x)
newPos.setY(y)
return newPos
orthoDrive = OrthoDrive(self.ToonSpeed, customCollisionCallback=doCollisions, instantTurn=True)
self.gameWalk = OrthoWalk(orthoDrive, broadcast=not self.isSinglePlayer())
else:
self.gameWalk = CogThiefWalk.CogThiefWalk("walkDone")
forwardSpeed = self.ToonSpeed / 2.0
base.mouseInterfaceNode.setForwardSpeed(forwardSpeed)
multiplier = forwardSpeed / ToontownGlobals.ToonForwardSpeed
base.mouseInterfaceNode.setRotateSpeed(ToontownGlobals.ToonRotateSpeed * 4)
示例5: DistributedPartyCatchActivity
#.........这里部分代码省略.........
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):
示例6: DistributedCogThiefGame
#.........这里部分代码省略.........
self.toonHitTracks = {}
for key in self.toonPieTracks:
ival = self.toonPieTracks[key]
if ival.isPlaying():
ival.finish()
self.toonPieTracks = {}
for key in self.cogInfo:
cogThief = self.cogInfo[key]['suit']
cogThief.cleanup()
self.removeUpdateSuitsTask()
self.notify.debug('enterCleanup')
def exitCleanup(self):
pass
def __placeToon(self, avId):
toon = self.getAvatar(avId)
if toon:
index = self.avIdList.index(avId)
toon.setPos(CTGG.ToonStartingPositions[index])
toon.setHpr(0, 0, 0)
def moveCameraToTop(self):
camera.reparentTo(render)
p = self.cameraTopView
camera.setPosHpr(p[0], p[1], p[2], p[3], p[4], p[5])
base.camLens.setMinFov(46/(4./3.))
camera.setZ(camera.getZ() + base.config.GetFloat('cog-thief-z-camera-adjust', 0.0))
def destroyGameWalk(self):
self.notify.debug('destroyOrthoWalk')
self.gameWalk.destroy()
del self.gameWalk
def initGameWalk(self):
self.notify.debug('startOrthoWalk')
def doCollisions(oldPos, newPos, self = self):
x = bound(newPos[0], CTGG.StageHalfWidth, -CTGG.StageHalfWidth)
y = bound(newPos[1], CTGG.StageHalfHeight, -CTGG.StageHalfHeight)
newPos.setX(x)
newPos.setY(y)
return newPos
orthoDrive = OrthoDrive(self.ToonSpeed, customCollisionCallback=doCollisions, instantTurn=True)
self.gameWalk = OrthoWalk(orthoDrive, broadcast=not self.isSinglePlayer())
def initCogInfo(self):
for cogIndex in xrange(self.getNumCogs()):
self.cogInfo[cogIndex] = {'pos': Point3(CTGG.CogStartingPositions[cogIndex]),
'goal': CTGG.NoGoal,
'goalId': CTGG.InvalidGoalId,
'suit': None}
return
def loadCogs(self):
suitTypes = ['ds',
'ac',
'bc',
'ms']
for suitIndex in xrange(self.getNumCogs()):
st = self.randomNumGen.choice(suitTypes)
suit = CogThief.CogThief(suitIndex, st, self, self.getCogSpeed())
示例7: CogdoFlyingLocalPlayer
class CogdoFlyingLocalPlayer(CogdoFlyingPlayer):
notify = DirectNotifyGlobal.directNotify.newCategory('CogdoFlyingLocalPlayer')
BroadcastPosTask = 'CogdoFlyingLocalPlayerBroadcastPos'
PlayWaitingMusicEventName = 'PlayWaitingMusicEvent'
RanOutOfTimeEventName = 'RanOutOfTimeEvent'
PropStates = PythonUtil.Enum(('Normal', 'Overdrive', 'Off'))
def __init__(self, toon, game, level, guiMgr):
CogdoFlyingPlayer.__init__(self, toon)
self.defaultTransitions = {'Inactive': ['FreeFly', 'Running'],
'FreeFly': ['Inactive',
'OutOfTime',
'Death',
'FlyingUp',
'Running',
'HitWhileFlying',
'InWhirlwind'],
'FlyingUp': ['Inactive',
'OutOfTime',
'Death',
'FreeFly',
'Running',
'HitWhileFlying',
'InWhirlwind'],
'InWhirlwind': ['Inactive',
'OutOfTime',
'Death',
'FreeFly',
'HitWhileFlying'],
'HitWhileFlying': ['Inactive',
'OutOfTime',
'Death',
'FreeFly',
'InWhirlwind'],
'Death': ['Inactive', 'OutOfTime', 'Spawn'],
'Running': ['Inactive',
'OutOfTime',
'FreeFly',
'FlyingUp',
'Refuel',
'WaitingForWin',
'HitWhileRunning'],
'HitWhileRunning': ['Inactive',
'OutOfTime',
'Death',
'Running',
'FreeFly'],
'Spawn': ['Inactive',
'OutOfTime',
'Running',
'WaitingForWin'],
'OutOfTime': ['Inactive', 'Spawn'],
'WaitingForWin': ['Inactive', 'Win'],
'Win': ['Inactive']}
self.game = game
self._level = level
self._guiMgr = guiMgr
self._inputMgr = CogdoFlyingInputManager()
self._cameraMgr = CogdoFlyingCameraManager(camera, render, self, self._level)
self.velocity = Vec3(0.0, 0.0, 0.0)
self.instantaneousVelocity = Vec3(0.0, 0.0, 0.0)
self.controlVelocity = Vec3(0.0, 0.0, 0.0)
self.fanVelocity = Vec3(0.0, 0.0, 0.0)
self.activeFans = []
self.fansStillHavingEffect = []
self.fanIndex2ToonVelocity = {}
self.legalEagleInterestRequest = {}
self.activeWhirlwind = None
self.oldPos = Vec3(0.0, 0.0, 0.0)
self.checkpointPlatform = None
self.isHeadInCeiling = False
self.isToonOnFloor = False
self.fuel = 0.0
self.score = 0
self.postSpawnState = 'Running'
self.didTimeRunOut = False
self.hasPressedCtrlYet = False
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')
#.........这里部分代码省略.........
示例8: initOrthoWalker
def initOrthoWalker(self):
orthoDrive = OrthoDrive(9.778, maxFrameMove=0.5, wantSound=True)
self.orthoWalk = OrthoWalk(orthoDrive, broadcast=False, collisions=False, broadcastPeriod=Globals.AI.BroadcastPeriod)
示例9: CogdoMazeLocalPlayer
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)
#.........这里部分代码省略.........
示例10: DistributedPartyDanceActivityBase
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,代码行数:101,代码来源:DistributedPartyDanceActivityBase.py
示例11: __initOrthoWalk
def __initOrthoWalk(self):
self.notify.debug('Initialize Ortho Walk')
orthoDrive = OrthoDrive(9.778)
self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:4,代码来源:DistributedPartyDanceActivityBase.py
示例12: _initOrthoWalk
def _initOrthoWalk(self):
orthoDrive = OrthoDrive(9.778, customCollisionCallback=self.activity.view.checkOrthoDriveCollision)
self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
示例13: PartyCogActivityLocalPlayer
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)
#.........这里部分代码省略.........