本文整理匯總了Python中result.Result.setTeam方法的典型用法代碼示例。如果您正苦於以下問題:Python Result.setTeam方法的具體用法?Python Result.setTeam怎麽用?Python Result.setTeam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類result.Result
的用法示例。
在下文中一共展示了Result.setTeam方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: FSMGame
# 需要導入模塊: from result import Result [as 別名]
# 或者: from result.Result import setTeam [as 別名]
class FSMGame(FSM):
def __init__(self):
FSM.__init__(self, "FSM-Game")
self.menu = Menu()
self.gameResult = Result()
self.numNPCs = 7
self.musicMenu = loader.loadMusic("Eraplee Noisewall Orchestra - Bermuda Fire.ogg")
self.musicMenu.setLoop(True)
self.musicGame = loader.loadMusic("Echovolt - Nothing to Fear.ogg")
self.musicGame.setLoop(True)
def enterMenu(self):
helper.show_cursor()
self.menu.show()
self.musicMenu.play()
def exitMenu(self):
self.menu.hide()
self.musicMenu.stop()
def enterSingleplayer(self):
helper.hide_cursor()
self.musicGame.play()
self.world = World()
self.player = Player()
self.player.setPos(self.world.getStartPos(1))
self.player.setTeam("Yellow")
self.player.setColor(LPoint3f(1, 1, 0))
#self.player.setSpectator(self.world.getSpectatorNode())
# create non player characters
self.npcs = []
for i in range(self.numNPCs):
self.npcs.append(NPC())
self.npcs[i].setPos(self.world.getStartPos(i+2))
self.npcs[i].setBunker(self.world.getBunker())
if i < self.numNPCs/2:
self.npcs[i].setTeam("Yellow")
self.npcs[i].setColor(LPoint3f(1, 1, 0))
else:
self.npcs[i].setTeam("Blue")
self.npcs[i].setColor(LPoint3f(0, 0, 1))
for i in range(self.numNPCs):
el = []
if self.npcs[i].playerTeam != self.player.playerTeam:
el.append(self.player)
for j in range(self.numNPCs):
if self.npcs[i].playerTeam != self.npcs[j].playerTeam:
el.append(self.npcs[j])
self.npcs[i].setEnemies(el)
number = OnscreenText(
text = "",
scale = 0.75,
pos = (0, -0.1875),
fg = (1,1,1,1),
align = TextNode.ACenter)
def startSingleplayer():
number.destroy()
self.world.run()
self.player.run()
for npc in self.npcs:
npc.run()
taskMgr.add(self.checkGameOver, "checkGameOver")
def setNumber(num):
number["text"] = str(num)
number["scale"] = 0.75
inter = number.scaleInterval(1.0, 0)
# setup a sequence that will count down for us
self.countdownSeq = Sequence(
Func(setNumber, 3),
inter,
Func(setNumber, 2),
inter,
Func(setNumber, 1),
inter,
Func(setNumber, "GO"),
inter,
Func(startSingleplayer))
self.countdownSeq.start()
def exitSingleplayer(self):
self.countdownSeq.finish()
self.player.stop()
for i in range(len(self.npcs)):
self.npcs[i].stop()
self.npcs = []
self.world.stop()
del self.world
self.gameResult.hide()
taskMgr.remove("checkGameOver")
#.........這裏部分代碼省略.........