def pause(self, pauser): if self.gameState < self.STOPPED: wasPaused = self.isPaused self.__pauseTracker[pauser] = None #value is arbitrary if not wasPaused: #just paused self.__playPauseLerp() CToolbar.getClock().pause()
def resume(self, resumer): if self.gameState < self.STOPPED: if resumer in self.__pauseTracker: del self.__pauseTracker[resumer] if not self.isPaused: #just resumed self.__playPauseLerp() CToolbar.getClock().resume()
def start(self, startCell): if self.gameState == self.IDLE: self.field.layMines(self.__minesToLay, (startCell,)) self.__minesToLay = 0 self.__winTgt = reduce(operator.mul, self.field.dims) - \ self.field.nMines if not self.isPaused: CToolbar.getClock().start() else: CToolbar.getClock().reset() self.__gameState = self.PLAYING
def dispose(self): self.cTool = None CToolbar.getClock().stop() if self.__cameraControl: self.disposeCameraControl() self.removeNode()
def stop(self): if self.gameState < self.STOPPED: CToolbar.getClock().pause() self.__gameState = self.STOPPED