Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from toontown.minigame.DistributedMinigameAI import *
- from direct.fsm import ClassicFSM, State
- # PS: All the toons are kept on a list
- # self.avIdList
- class DistributedCoolGame(DistributedMinigame):
- def __init__(self, cr):
- DistributedMinigame.__init__(self, cr)
- # This is our game FSM, it defines all the states
- # the minigame is going to have, eg. toon dies, toon wins, etc.
- self.gameFSM = ClassicFSM.ClassicFSM(
- 'DistributedCoolGameAI', [
- ]
- )
- self.addChildGameFSM(self.gameFSM)
- # Here goes all your initial variables
- self.happynessDict = {}
- # You can include most of the client-side CoolGame
- # state handles here too, even though they might not
- # be useful in most cases.
- def enterPlay(self):
- # The game has just started, let's keep track of when it's
- # going to end so we can do our job of finishing it.
- taskMgr.doMethodLater(3 * 60, self.timeout, self.taskName("minigameTimer"))
- def timeout(self, t):
- # The game timed out, Minigame does
- # all the further work.
- self.gameOver()
- return t.done
- def exitPlay(self):
- # Handled exit, kill our task
- taskMgr.remove(self.taskName("minigameTimer"))
Add Comment
Please, Sign In to add comment