本文整理汇总了Python中direct.gui.DirectGui.DirectWaitBar.getScale方法的典型用法代码示例。如果您正苦于以下问题:Python DirectWaitBar.getScale方法的具体用法?Python DirectWaitBar.getScale怎么用?Python DirectWaitBar.getScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectGui.DirectWaitBar
的用法示例。
在下文中一共展示了DirectWaitBar.getScale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DistributedMazeGame
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import getScale [as 别名]
#.........这里部分代码省略.........
def __hitBySuit(self, suitNum):
self.notify.debug('hitBySuit')
timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime())
self.sendUpdate('hitBySuit', [self.localAvId, timestamp])
self.__showToonHitBySuit(self.localAvId, timestamp)
def hitBySuit(self, avId, timestamp):
if not self.hasLocalToon:
return
if self.gameFSM.getCurrentState().getName() not in ['play', 'showScores']:
self.notify.warning('ignoring msg: av %s hit by suit' % avId)
return
self.notify.debug('avatar ' + `avId` + ' hit by a suit')
if avId != self.localAvId:
self.__showToonHitBySuit(avId, timestamp)
def __showToonHitBySuit(self, avId, timestamp):
toon = self.getAvatar(avId)
if toon == None:
return
rng = self.toonRNGs[self.avIdList.index(avId)]
curPos = toon.getPos(render)
oldTrack = self.toonHitTracks[avId]
if oldTrack.isPlaying():
oldTrack.finish()
toon.setPos(curPos)
toon.setZ(self.TOON_Z)
parentNode = render.attachNewNode('mazeFlyToonParent-' + `avId`)
parentNode.setPos(toon.getPos())
toon.reparentTo(parentNode)
toon.setPos(0,0,0)
startPos = parentNode.getPos()
dropShadow = toon.dropShadow.copyTo(parentNode)
dropShadow.setScale(toon.dropShadow.getScale(render))
trajectory = Trajectory.Trajectory(
0,
Point3(0,0,0),
Point3(0,0,50),
gravMult=1.0)
flyDur = trajectory.calcTimeOfImpactOnPlane(0.0)
while 1:
endTile = [rng.randint(2, self.maze.width-1), rng.randint(2, self.maze.height-1)]
if self.maze.isWalkable(endTile[0], endTile[1]):
break
endWorldCoords = self.maze.tile2world(endTile[0], endTile[1])
endPos = Point3(endWorldCoords[0], endWorldCoords[1], startPos[2])
def flyFunc(t, trajectory, startPos = startPos, endPos = endPos, dur = flyDur, moveNode = parentNode, flyNode = toon):
u = t/dur
moveNode.setX(startPos[0] + u * (endPos[0]-startPos[0]))
moveNode.setY(startPos[1] + u * (endPos[1]-startPos[1]))
flyNode.setPos(trajectory.getPos(t))
flyTrack = Sequence(
LerpFunctionInterval(flyFunc, fromData=0.0, toData=flyDur, duration=flyDur, extraArgs=[trajectory]),
name=toon.uniqueName('hitBySuit-fly'))
if avId != self.localAvId:
cameraTrack = Sequence()
else:
self.camParent.reparentTo(parentNode)
startCamPos = camera.getPos()
destCamPos = camera.getPos()
zenith = trajectory.getPos(flyDur/2.0)[2]
destCamPos.setZ(zenith*1.3)
destCamPos.setY(destCamPos[1]*0.3)
def camTask(task, zenith = zenith, flyNode = toon, startCamPos = startCamPos, camOffset = destCamPos - startCamPos):
u = flyNode.getZ()/zenith
camera.setPos(startCamPos + camOffset*u)