def enterCountdown(self): base.transitions.noTransitions() self.firstPerson.start() self.firstPerson.disableMouse() self.setRound(self.getRound() + 1) self.infoText.setText(DistributedDodgeballGame.GetSnowBalls) self.countdownText = getGameText() self.countdownIval = Parallel(Sequence( Func(self.countdownText.setText, "Round {0}".format(self.getRound())), getRoundIval(self.countdownText), Func(self.countdownText.setText, "5"), getCountdownIval(self.countdownText), Func(self.countdownText.setText, "4"), getCountdownIval(self.countdownText), Func(self.countdownText.setText, "3"), getCountdownIval(self.countdownText), Func(self.countdownText.setText, "2"), getCountdownIval(self.countdownText), Func(self.countdownText.setText, "1"), getCountdownIval(self.countdownText)), getAlertPulse(self.infoText), name="COUNTDOWNIVAL") self.countdownIval.setDoneEvent(self.countdownIval.getName()) self.acceptOnce(self.countdownIval.getDoneEvent(), self.__handleCountdownDone) self.countdownIval.start()
def enterDisplayWinners(self): base.localAvatar.stopLookAround() base.localAvatar.resetHeadHpr() base.localAvatar.getGeomNode().show() camera.reparentTo(render) camera.setPos((-2.5, 12, 3.5)) camera.setHpr((-175.074, -5.47218, 0)) base.transitions.fadeIn() base.playSfx(self.danceSound, looping=1) if self.winnerTeam == self.team: base.playMusic(self.winnerMusic) else: base.playMusic(self.loserMusic) winnerPositions = [(-2, 0, 0), (2, 0, 0), (6, 0, 0), (-6, 0, 0)] loserPositions = [(-3.5, -10, 0), (-1.5, -15, 0), (3.0, -8, 0), (5.5, -12, 0)] for team in [RED, BLUE]: for avId in self.playerListByTeam[team]: av = self.cr.doId2do.get(avId) if av: av.stopSmooth() av.setHpr(0, 0, 0) if team == self.winnerTeam: posList = winnerPositions av.setAnimState("off") av.stop() if not self.getRemoteAvatar(avId).isFrozen: av.loop("win") else: posList = loserPositions av.setAnimState('off') av.stop() if not self.getRemoteAvatar(avId).isFrozen: av.loop("pout") pos = random.choice(posList) posList.remove(pos) av.setPos(pos) if self.winnerTeam == self.team: text = "YOU WIN!" else: text = "YOU LOSE!" self.gameOverLbl.setText(text) self.track = Sequence(Wait(2.0), Func(self.gameOverLbl.setScale, 0.01), Func(self.gameOverLbl.show), getAlertPulse(self.gameOverLbl, 0.27, 0.25)) self.track.start() base.localAvatar.collisionsOff()
def enterCountdown(self): self.firstPerson.start() self.firstPerson.disableMouse() self.infoText.setText(DistributedDodgeballGame.GetSnowBalls) self.countdownText = getGameText() self.countdownIval = Parallel(Sequence(Func(self.countdownText.setText, '5'), getCountdownIval(self.countdownText), Func(self.countdownText.setText, '4'), getCountdownIval(self.countdownText), Func(self.countdownText.setText, '3'), getCountdownIval(self.countdownText), Func(self.countdownText.setText, '2'), getCountdownIval(self.countdownText), Func(self.countdownText.setText, '1'), getCountdownIval(self.countdownText)), getAlertPulse(self.infoText), name='COUNTDOWNIVAL') self.countdownIval.setDoneEvent(self.countdownIval.getName()) self.acceptOnce(self.countdownIval.getDoneEvent(), self.__handleCountdownDone) self.countdownIval.start()