Beispiel #1
0
    def _initModel(self):
        codeFrameGap = Globals.BossCodeFrameGap
        codeFrameWidth = Globals.BossCodeFrameWidth
        self._model = CogdoUtil.loadMazeModel('bossCog', group='gui')
        self._model.reparentTo(self)
        self._model.find('**/frame').setBin('fixed', 1)
        titleLabelPos = self._model.find('**/title_label_loc').getPos()
        self._titleLabel = DirectLabel(
            parent=self,
            relief=None,
            scale=Globals.BossGuiTitleLabelScale,
            text=TTLocalizer.CogdoMazeGameBossGuiTitle.upper(),
            pos=titleLabelPos,
            text_align=TextNode.ACenter,
            text_fg=(0, 0, 0, 1),
            text_shadow=(0, 0, 0, 0),
            text_font=ToontownGlobals.getSuitFont())
        self._titleLabel.setBin('fixed', 1)
        bossCard = self._model.find('**/bossCard')
        self._openDoor = self._model.find('**/doorOpen')
        self._closedDoor = self._model.find('**/doorClosed')
        self._openDoor.stash()
        spacingX = codeFrameWidth + codeFrameGap
        startX = -0.5 * ((self._codeLength - 1) * spacingX - codeFrameGap)
        for i in xrange(self._codeLength):
            marker = CogdoMazeBossCodeFrame(i, self._code[i], bossCard)
            marker.reparentTo(self)
            marker.setPos(bossCard, startX + spacingX * i, 0, 0)
            self._markers.append(marker)

        bossCard.removeNode()
Beispiel #2
0
 def _initModel(self):
     baseName = '**/tt_t_gui_cmg_miniMap_'
     cardModel = CogdoUtil.loadMazeModel('miniMap_cards', group='gui')
     cm = CardMaker('bg')
     cm.setFrame(-1.1, 1.1, -1.1, 1.1)
     bg = self.attachNewNode(cm.generate())
     bg.setColor(*self._bgColor)
     bg.setBin('fixed', 0)
     frame = cardModel.find(baseName + 'frame')
     frame.reparentTo(self)
     frame.setScale(2.5)
     frame.setPos(0.01, 0, -0.01)
     self._entrance = cardModel.find(baseName + 'entrance')
     self._entrance.reparentTo(self)
     self._entrance.setScale(0.35)
     self._entrance.hide()
     self._exit = NodePath('exit')
     self._exit.setScale(0.35)
     self._exit.reparentTo(self)
     self._exitOpen = cardModel.find(baseName + 'exitOpen')
     self._exitOpen.reparentTo(self._exit)
     self._exitClosed = cardModel.find(baseName + 'exitClosed')
     self._exitClosed.reparentTo(self._exit)
     self._suitMarkerTemplate = cardModel.find(baseName + 'cogIcon')
     self._suitMarkerTemplate.detachNode()
     self._suitMarkerTemplate.setScale(0.225)
     self._waterCoolerTemplate = cardModel.find(baseName + 'waterDrop')
     self._waterCoolerTemplate.detachNode()
     self._waterCoolerTemplate.setScale(0.225)
     self._exit.hide()
     cardModel.removeNode()
Beispiel #3
0
 def __init__(self, game, id, x, y):
     NodePath.__init__(self, 'dropNode%s' % id)
     self.game = game
     self.id = id
     self.reparentTo(hidden)
     self.setPos(x, y, 0)
     shadow = loader.loadModel('phase_3/models/props/square_drop_shadow')
     shadow.setZ(0.2)
     shadow.setBin('ground', 10)
     shadow.setColor(1, 1, 1, 1)
     shadow.reparentTo(self)
     self.shadow = shadow
     drop = CogdoUtil.loadMazeModel('cabinetSmFalling')
     roll = random.randint(-15, 15)
     drop.setHpr(0, 0, roll)
     drop.setZ(Globals.DropHeight)
     self.collTube = CollisionTube(0, 0, 0, 0, 0, 4,
                                   Globals.DropCollisionRadius)
     self.collTube.setTangible(0)
     name = Globals.DropCollisionName
     self.collNode = CollisionNode(name)
     self.collNode.addSolid(self.collTube)
     self.collNodePath = drop.attachNewNode(self.collNode)
     self.collNodePath.hide()
     self.collNodePath.setTag('isFalling', str('True'))
     drop.reparentTo(self)
     self.drop = drop
     self._dropSfx = base.cogdoGameAudioMgr.createSfxIval('drop',
                                                          volume=0.6)
Beispiel #4
0
 def __init__(self, object, name, collisionRadius):
     self.object = object
     self.splat = CogdoUtil.loadMazeModel('splash')
     self.splat.setBillboardPointEye()
     self.splat.setBin('fixed', 40)
     self.splat.setDepthTest(False)
     self.splat.setDepthWrite(False)
     self.splatTrack = None
     self._splatSfxIval = base.cogdoGameAudioMgr.createSfxIval('splat')
     self.initGagCollision(name, collisionRadius)
 def __init__(self, id, toon):
     FSM.__init__(self, 'CogdoMazePlayer')
     CogdoMazeSplattable.__init__(
         self, toon, '%s-%i' % (Globals.PlayerCollisionName, id), 0.5)
     self.id = id
     self.toon = toon
     self.defaultTransitions = {
         'Off': ['Ready'],
         'Ready': ['Normal', 'Off'],
         'Normal': ['Hit', 'Done', 'Off'],
         'Hit': ['Normal', 'Done', 'Off'],
         'Done': ['Off']
     }
     self.toon.reparentTo(render)
     self.gagModel = CogdoUtil.loadMazeModel('waterBalloon')
     self.equippedGag = None
     self._toonHitSfx = base.cogdoGameAudioMgr.createSfx(
         'toonHit', self.toon)
     self._throwSfx = base.cogdoGameAudioMgr.createSfxIval('throw')
     self.accept(toon.getDisableEvent(), self.removed)
     self.request('Off')
Beispiel #6
0
    def _loadAndBuildMazeModel(self, flatten=False):
        self.getMazeData()
        self._model = NodePath('CogdoMazeModel')
        levelModel = CogdoUtil.loadMazeModel('level')
        self.quadrants = []
        quadrantUnitSize = int(self.quadrantSize * self.cellWidth)
        frameActualSize = self.frameWallThickness * self.cellWidth
        size = quadrantUnitSize + frameActualSize
        halfWidth = int(self.width / 2)
        halfHeight = int(self.height / 2)
        i = 0
        for y in xrange(self.height):
            for x in xrange(self.width):
                ax = (x - halfWidth) * size
                ay = (y - halfHeight) * size
                extension = ''
                if hasattr(getBase(), 'air'):
                    extension = '.bam'
                filepath = self.quadrantData[i][0] + extension
                angle = self.quadrantData[i][2]
                m = self._createQuadrant(filepath, i, angle, quadrantUnitSize)
                m.setPos(ax, ay, 0)
                m.reparentTo(self._model)
                self.quadrants.append(m)
                i += 1

        quadrantHalfUnitSize = quadrantUnitSize * 0.5
        barrierModel = CogdoUtil.loadMazeModel('grouping_blockerDivider').find(
            '**/divider')
        y = 3
        for x in xrange(self.width):
            if x == (self.width - 1) / 2:
                continue
            ax = (x - halfWidth) * size
            ay = (y - halfHeight) * size - quadrantHalfUnitSize - (
                self.cellWidth - 0.5)
            b = NodePath('barrier')
            barrierModel.instanceTo(b)
            b.setPos(ax, ay, 0)
            b.reparentTo(self._model)

        offset = self.cellWidth - 0.5
        for x in (0, 3):
            for y in xrange(self.height):
                ax = (
                    x - halfWidth
                ) * size - quadrantHalfUnitSize - frameActualSize + offset
                ay = (y - halfHeight) * size
                b = NodePath('barrier')
                barrierModel.instanceTo(b)
                b.setPos(ax, ay, 0)
                b.setH(90)
                b.reparentTo(self._model)

            offset -= 2.0

        barrierModel.removeNode()
        levelModel.getChildren().reparentTo(self._model)
        for np in self._model.findAllMatches('**/*lightCone*'):
            CogdoUtil.initializeLightCone(np, 'fixed', 3)

        if flatten:
            self._model.flattenStrong()

        return self._model
    def load(self, cogdoMazeFactory, numSuits, bossCode):
        self._initAudio()
        self.maze = cogdoMazeFactory.createCogdoMaze()
        suitSpawnSpot = self.maze.createRandomSpotsList(numSuits, self.distGame.randomNumGen)
        self.guiMgr = CogdoMazeGuiManager(self.maze, bossCode)
        self.suits = []
        self.suitsById = {}
        self.shakers = []
        self.toonsThatRevealedDoor = []
        self.quake = 0
        self.dropCounter = 0
        self.drops = {}
        self.gagCounter = 0
        self.gags = []
        self.hackTemp = False
        self.dropGen = RandomNumGen(self.distGame.doId)
        self.gagTimeoutTasks = []
        self.finished = False
        self.lastBalloonTimestamp = None
        difficulty = self.distGame.getDifficulty()
        serialNum = 0
        for i in xrange(numSuits[0]):
            suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
            suit = CogdoMazeBossSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[0][i])
            self.addSuit(suit)
            self.guiMgr.mazeMapGui.addSuit(suit.suit)
            serialNum += 1

        for i in xrange(numSuits[1]):
            suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
            suit = CogdoMazeFastMinionSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[1][i])
            self.addSuit(suit)
            serialNum += 1

        for i in xrange(numSuits[2]):
            suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
            suit = CogdoMazeSlowMinionSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[2][i])
            self.addSuit(suit)
            serialNum += 1

        self.toonId2Door = {}
        self.keyIdToKey = {}
        self.players = []
        self.toonId2Player = {}
        cellPos = (int(self.maze.width / 2), self.maze.height - 1)
        pos = self.maze.tile2world(*cellPos)
        self._exit = CogdoMazeExit()
        self._exit.reparentTo(render)
        self._exit.setPos(self.maze.exitPos)
        self._exit.stash()
        self.guiMgr.mazeMapGui.placeExit(*cellPos)
        self._collNode2waterCooler = {}
        for waterCooler in self.maze.getWaterCoolers():
            pos = waterCooler.getPos(render)
            tpos = self.maze.world2tile(pos[0], pos[1])
            self.guiMgr.mazeMapGui.addWaterCooler(*tpos)
            self._collNode2waterCooler[waterCooler.collNode] = waterCooler

        self.pickups = []
        self.gagModel = CogdoUtil.loadMazeModel('waterBalloon')
        self._movie = CogdoMazeGameIntro(self.maze, self._exit, self.distGame.randomNumGen)
        self._movie.load()