本文整理汇总了Python中DistributedMinigame.DistributedMinigame类的典型用法代码示例。如果您正苦于以下问题:Python DistributedMinigame类的具体用法?Python DistributedMinigame怎么用?Python DistributedMinigame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DistributedMinigame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, cr):
try:
self.DistributedCameraShyGame_initialized
return
except:
self.DistributedCameraShyGame_initialized = 1
DistributedMinigame.__init__(self, cr)
self.headPanels.delete()
self.headPanels = CameraShyHeadPanels()
self.fsm.addState(State('countdown', self.enterCountdown, self.exitCountdown, ['play']))
self.fsm.addState(State('announceGameOver', self.enterAnnounceGameOver, self.exitAnnounceGameOver, ['showWinner']))
self.fsm.addState(State('showWinner', self.enterShowWinner, self.exitShowWinner, ['gameOver']))
self.fsm.getStateNamed('waitForOthers').addTransition('countdown')
self.fsm.getStateNamed('play').addTransition('announceGameOver')
self.maze = None
self.mazeCollModel = None
self.spawnPoints = []
self.remoteAvatars = []
self.myRemoteAvatar = None
self.thisPlayerWinsLbl = None
self.sky = None
self.firstPerson = CameraShyFirstPerson(self)
self.skyUtil = None
self.pbpText = None
return
示例2: enterPlay
def enterPlay(self):
DistributedMinigame.enterPlay(self)
self.music.setPlayRate(self.Round2MusicSpeed[self.getRound()])
self.createTimer()
if self.cannonId != None:
self.cannonFSM.request('control')
return
示例3: offstage
def offstage(self):
self.notify.debug('offstage')
if self.introTrack.isPlaying():
self.introTrack.finish()
del self.introTrack
for avId in self.toonHitTracks.keys():
track = self.toonHitTracks[avId]
if track.isPlaying():
track.finish()
self.__killCameraTask()
camera.wrtReparentTo(render)
self.camParent.removeNode()
del self.camParent
for panel in self.scorePanels:
panel.cleanup()
self.scorePanels = []
self.goalBar.destroy()
del self.goalBar
base.setCellsAvailable(base.rightCells, 1)
for suit in self.suits:
suit.offstage()
self.__unloadSuits()
for treasure in self.treasures:
treasure.destroy()
del self.treasures
del self.sndTable
del self.grabSounds
del self.toonRNGs
self.maze.offstage()
base.localAvatar.showName()
DistributedMinigame.offstage(self)
示例4: exitPlay
def exitPlay(self):
self.firstPerson.end()
self.firstPerson.enableMouse()
self.deleteTimer()
base.localAvatar.createChatInput()
base.localAvatar.chatInput.enableKeyboardShortcuts()
DistributedMinigame.exitPlay(self)
示例5: disable
def disable(self):
for triggerName in self.triggers:
self.ignore('enter' + triggerName)
base.localAvatar.createChatInput()
camera.reparentTo(render)
camera.setPosHpr(0, 0, 0, 0, 0, 0)
render.clearFog()
self.triggers = None
self.toonOof = None
self.hitEagleSfx = None
self.hitObstacleSfx = None
self.cannonMoveSfx = None
self.fallSfx = None
if self.world:
self.world.removeNode()
self.world = None
self.worldModelPath = None
self.nodesToStash = None
self.fog = None
self.round = None
for platform in self.platforms:
platform.removeNode()
self.platforms = None
self.cannonId = None
self.cannonBarrel = None
self.platformPositions = None
base.setBackgroundColor(CIGlobals.DefaultBackgroundColor)
self.bgColor = None
DistributedMinigame.disable(self)
return
示例6: __init__
def __init__(self, cr):
DistributedMinigame.__init__(self, cr)
self.gameFSM = ClassicFSM.ClassicFSM('DistributedMazeGame', [State.State('off', self.enterOff, self.exitOff, ['play']),
State.State('play', self.enterPlay, self.exitPlay, ['cleanup', 'showScores']),
State.State('showScores', self.enterShowScores, self.exitShowScores, ['cleanup']),
State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'off', 'cleanup')
self.addChildGameFSM(self.gameFSM)
self.usesLookAround = 1
示例7: load
def load(self):
self.createWorld()
self.setMinigameMusic('phase_6/audio/bgm/GS_Race_SS.mid')
self.setDescription('Be the first to take 3 pictures of all the other Toons with your camera. ' + 'Use WASD to move and the mouse to look around. Press the left mouse button to take a picture. ' + 'Your camera takes some time to recharge after taking a picture. ' + 'You know you have a good shot when the view finder is green!')
self.setWinnerPrize(30)
self.setLoserPrize(15)
base.render.hide()
base.setBackgroundColor(0, 0, 0)
DistributedMinigame.load(self)
示例8: disable
def disable(self):
self.myRemoteAvatar.cleanup()
self.myRemoteAvatar = None
for av in self.remoteAvatars:
av.cleanup()
del av
self.remoteAvatars = None
DistributedMinigame.disable(self)
return
示例9: unload
def unload(self):
self.notify.debug('unload')
DistributedMinigame.unload(self)
del self.toonHitTracks
self.maze.destroy()
del self.maze
self.treasureModel.removeNode()
del self.treasureModel
del self.music
self.removeChildGameFSM(self.gameFSM)
del self.gameFSM
示例10: onstage
def onstage(self):
self.notify.debug('onstage')
DistributedMinigame.onstage(self)
self.maze.onstage()
self.randomNumGen.shuffle(self.startPosHTable)
lt = base.localAvatar
lt.reparentTo(render)
lt.hideName()
self.__placeToon(self.localAvId)
lt.setAnimState('Happy', 1.0)
lt.setSpeed(0, 0)
self.camParent = render.attachNewNode('mazeGameCamParent')
self.camParent.reparentTo(base.localAvatar)
self.camParent.setPos(0, 0, 0)
self.camParent.setHpr(render, 0, 0, 0)
camera.reparentTo(self.camParent)
camera.setPos(self.camOffset)
self.__spawnCameraTask()
self.toonRNGs = []
for i in xrange(self.numPlayers):
self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen))
self.treasures = []
for i in xrange(self.maze.numTreasures):
self.treasures.append(MazeTreasure.MazeTreasure(self.treasureModel, self.maze.treasurePosList[i], i, self.doId))
self.__loadSuits()
for suit in self.suits:
suit.onstage()
self.sndTable = {'hitBySuit': [None] * self.numPlayers,
'falling': [None] * self.numPlayers}
for i in xrange(self.numPlayers):
self.sndTable['hitBySuit'][i] = base.loadSfx('phase_4/audio/sfx/MG_Tag_C.ogg')
self.sndTable['falling'][i] = base.loadSfx('phase_4/audio/sfx/MG_cannon_whizz.ogg')
self.grabSounds = []
for i in xrange(5):
self.grabSounds.append(base.loadSfx('phase_4/audio/sfx/MG_maze_pickup.ogg'))
self.grabSoundIndex = 0
for avId in self.avIdList:
self.toonHitTracks[avId] = Wait(0.1)
self.scores = [0] * self.numPlayers
self.goalBar = DirectWaitBar(parent=render2d, relief=DGG.SUNKEN, frameSize=(-0.35,
0.35,
-0.15,
0.15), borderWidth=(0.02, 0.02), scale=0.42, pos=(0.84, 0, 0.5 - 0.28 * self.numPlayers + 0.05), barColor=(0, 0.7, 0, 1))
self.goalBar.setBin('unsorted', 0)
self.goalBar.hide()
self.introTrack = self.getIntroTrack()
self.introTrack.start()
return
示例11: enterGameOver
def enterGameOver(self, winner, winnerDoId, allPrize):
try:
currentCamPos = base.camera.getPos(render)
currentCamHpr = base.camera.getHpr(render)
self.firstPerson.reallyEnd()
base.camera.setPos(currentCamPos)
base.camera.setHpr(currentCamHpr)
except:
pass
DistributedMinigame.enterGameOver(self, winner, winnerDoId, allPrize)
示例12: __init__
def __init__(self, cr):
try:
self.DistributedToonFPSGame_initialized
return
except:
self.DistributedToonFPSGame_initialized = 1
DistributedMinigame.__init__(self, cr)
self.remoteAvatars = []
self.myRemoteAvatar = None
return
示例13: setGameStart
def setGameStart(self, timestamp):
if not self.hasLocalToon:
return
self.notify.debug('setGameStart')
DistributedMinigame.setGameStart(self, timestamp)
if self.introTrack.isPlaying():
self.introTrack.finish()
for avId in self.remoteAvIdList:
toon = self.getAvatar(avId)
if toon:
toon.stopLookAround()
self.gameFSM.request('play')
示例14: load
def load(self):
self.notify.debug('load')
DistributedMinigame.load(self)
self.__defineConstants()
mazeName = MazeGameGlobals.getMazeName(self.doId, self.numPlayers, MazeData.mazeNames)
self.maze = Maze.Maze(mazeName)
model = loader.loadModel('phase_3.5/models/props/mickeySZ')
self.treasureModel = model.find('**/mickeySZ')
model.removeNode()
self.treasureModel.setScale(1.6)
self.treasureModel.setP(-90)
self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.ogg')
self.toonHitTracks = {}
self.scorePanels = []
示例15: disable
def disable(self):
if self.thisPlayerWinsLbl:
self.thisPlayerWinsLbl.destroy()
self.thisPlayerWinsLbl = None
base.camera.reparentTo(render)
base.camera.setPos(0, 0, 0)
base.camera.setHpr(0, 0, 0)
if self.myRemoteAvatar:
self.myRemoteAvatar.cleanup()
del self.myRemoteAvatar
self.firstPerson.cleanup()
del self.firstPerson
self.deleteWorld()
base.camLens.setMinFov(CIGlobals.DefaultCameraFov / (4.0 / 3.0))
DistributedMinigame.disable(self)
return