def enterFinish(self):
     DistCogdoLevelGame.enterFinish(self)
     timeLeft = Consts.FinishDuration.get() - (globalClock.getRealTime() -
                                               self.getFinishTime())
     self.timer.setTime(timeLeft)
     self.timer.countdown(timeLeft, self.timerExpired)
     self.timer.unstash()
Beispiel #2
0
 def enterGame(self):
     DistCogdoLevelGame.enterGame(self)
     timeLeft = Consts.GameDuration.get() - globalClock.getRealTime(
     ) - self.getStartTime()
     self.timer.setTime(timeLeft)
     self.timer.countdown(timeLeft, self.timerExpired)
     self.timer.unstash()
 def exitLoaded(self):
     self.fnp.removeNode()
     self.physicsMgr.clearLinearForces()
     self.geomRoot.removeNode()
     self._gravityForce = None
     self._gravityForceNode = None
     DistCogdoLevelGame.exitLoaded(self)
 def enterGame(self):
     DistCogdoLevelGame.enterGame(self)
     self._physicsTask = taskMgr.add(self._doPhysics, self.uniqueName('physics'), priority=25)
     self.evWalls.stash()
     self._startTimer()
     if __dev__:
         self.accept(self._durationChangedEvent, self._startTimer)
 def enterGame(self):
     DistCogdoLevelGame.enterGame(self)
     self._physicsTask = taskMgr.add(self._doPhysics,
                                     self.uniqueName('physics'),
                                     priority=25)
     self.evWalls.stash()
     self._startTimer()
 def announceGenerate(self):
     DistCogdoLevelGame.announceGenerate(self)
     self.timer = ToontownTimer.ToontownTimer(
     )  # Like in the Bossbot Field Offices, you would've been timed
     self.timer.stash()
     if __dev__:  # What is this?
         self._durationChangedEvent = self.uniqueName('durationChanged')
 def privGotSpec(self, levelSpec):
     DistCogdoLevelGame.privGotSpec(self, levelSpec)
     levelMgr = self.getEntity(LevelConstants.LevelMgrEntId)
     self.endVault = levelMgr.geom
     self.endVault.reparentTo(self.geomRoot)
     self.endVault.findAllMatches('**/MagnetArms').detach()
     self.endVault.findAllMatches('**/Safes').detach()
     self.endVault.findAllMatches('**/MagnetControlsAll').detach()
     cn = self.endVault.find('**/wallsCollision').node()
     cn.setIntoCollideMask(OTPGlobals.WallBitmask | ToontownGlobals.PieBitmask | PM.BitMask32.lowerOn(3) << 21)
     walls = self.endVault.find('**/RollUpFrameCillison')
     walls.detachNode()
     self.evWalls = self.replaceCollisionPolysWithPlanes(walls)
     self.evWalls.reparentTo(self.endVault)
     self.evWalls.stash()
     floor = self.endVault.find('**/EndVaultFloorCollision')
     floor.detachNode()
     self.evFloor = self.replaceCollisionPolysWithPlanes(floor)
     self.evFloor.reparentTo(self.endVault)
     self.evFloor.setName('floor')
     plane = PM.CollisionPlane(PM.Plane(PM.Vec3(0, 0, 1), PM.Point3(0, 0, -50)))
     planeNode = PM.CollisionNode('dropPlane')
     planeNode.addSolid(plane)
     planeNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.geomRoot.attachNewNode(planeNode)
Beispiel #8
0
 def enterGame(self):
     DistCogdoLevelGame.enterGame(self)
     self._physicsTask = taskMgr.add(self._doPhysics, self.uniqueName('physics'), priority=25)
     self.evWalls.stash()
     self._startTimer()
     if __dev__:
         self.accept(self._durationChangedEvent, self._startTimer)
 def enterLoaded(self):
     DistCogdoLevelGame.enterLoaded(self)
     self.lightning = loader.loadModel(
         'phase_10/models/cogHQ/CBLightning.bam')
     self.magnet = loader.loadModel('phase_10/models/cogHQ/CBMagnet.bam')
     self.craneArm = loader.loadModel(
         'phase_10/models/cogHQ/CBCraneArm.bam')
     self.controls = loader.loadModel(
         'phase_10/models/cogHQ/CBCraneControls.bam')
     self.stick = loader.loadModel('phase_10/models/cogHQ/CBCraneStick.bam')
     self.cableTex = self.craneArm.findTexture('MagnetControl')
     self.moneyBag = loader.loadModel('phase_10/models/cashbotHQ/MoneyBag')
     self.geomRoot = PM.NodePath('geom')
     self.sceneRoot = self.geomRoot.attachNewNode('sceneRoot')
     self.sceneRoot.setPos(35.84, -115.46, 6.46)
     self.physicsMgr = PM.PhysicsManager()
     integrator = PM.LinearEulerIntegrator()
     self.physicsMgr.attachLinearIntegrator(integrator)
     fn = PM.ForceNode('gravity')
     self.fnp = self.geomRoot.attachNewNode(fn)
     gravity = PM.LinearVectorForce(0, 0, GameConsts.Settings.Gravity.get())
     fn.addForce(gravity)
     self.physicsMgr.addLinearForce(gravity)
     self._gravityForce = gravity
     self._gravityForceNode = fn
 def privGotSpec(self, levelSpec):
     DistCogdoLevelGame.privGotSpec(self, levelSpec)
     levelMgr = self.getEntity(LevelConstants.LevelMgrEntId)
     self.endVault = levelMgr.geom
     self.endVault.reparentTo(self.geomRoot)
     self.endVault.findAllMatches('**/MagnetArms').detach()
     self.endVault.findAllMatches('**/Safes').detach()
     self.endVault.findAllMatches('**/MagnetControlsAll').detach()
     cn = self.endVault.find('**/wallsCollision').node()
     cn.setIntoCollideMask(OTPGlobals.WallBitmask
                           | ToontownGlobals.PieBitmask
                           | PM.BitMask32.lowerOn(3) << 21)
     walls = self.endVault.find('**/RollUpFrameCillison')
     walls.detachNode()
     self.evWalls = self.replaceCollisionPolysWithPlanes(walls)
     self.evWalls.reparentTo(self.endVault)
     self.evWalls.stash()
     floor = self.endVault.find('**/EndVaultFloorCollision')
     floor.detachNode()
     self.evFloor = self.replaceCollisionPolysWithPlanes(floor)
     self.evFloor.reparentTo(self.endVault)
     self.evFloor.setName('floor')
     plane = PM.CollisionPlane(
         PM.Plane(PM.Vec3(0, 0, 1), PM.Point3(0, 0, -50)))
     planeNode = PM.CollisionNode('dropPlane')
     planeNode.addSolid(plane)
     planeNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.geomRoot.attachNewNode(planeNode)
 def exitLoaded(self):
     self.fnp.removeNode()
     self.physicsMgr.clearLinearForces()
     self.geomRoot.removeNode()
     self._gravityForce = None
     self._gravityForceNode = None
     DistCogdoLevelGame.exitLoaded(self)
Beispiel #12
0
    def enterLoaded(self):
        DistCogdoLevelGame.enterLoaded(self)

        self.lightning = loader.loadModel(
            'phase_10/models/cogHQ/CBLightning.bam')
        self.magnet = loader.loadModel('phase_10/models/cogHQ/CBMagnet.bam')
        self.craneArm = loader.loadModel(
            'phase_10/models/cogHQ/CBCraneArm.bam')
        self.controls = loader.loadModel(
            'phase_10/models/cogHQ/CBCraneControls.bam')
        self.stick = loader.loadModel('phase_10/models/cogHQ/CBCraneStick.bam')
        self.cableTex = self.craneArm.findTexture('MagnetControl')

        self.geomRoot = PM.NodePath('geom')

        # Set up a physics manager for the cables and the objects
        # falling around in the room.

        self.physicsMgr = PM.PhysicsManager()
        integrator = PM.LinearEulerIntegrator()
        self.physicsMgr.attachLinearIntegrator(integrator)

        fn = PM.ForceNode('gravity')
        self.fnp = self.geomRoot.attachNewNode(fn)
        gravity = PM.LinearVectorForce(0, 0, -32)
        fn.addForce(gravity)
        self.physicsMgr.addLinearForce(gravity)
 def enterGame(self):  # Entering the game
     DistCogdoLevelGame.enterGame(self)
     timeLeft = Consts.GameDuration.get() - globalClock.getRealTime(
     ) - self.getStartTime()
     self.timer.setTime(timeLeft)  # Loads the time left until it runs out
     self.timer.countdown(timeLeft,
                          self.timerExpired)  # Countdown the time left
     self.timer.unstash()
Beispiel #14
0
    def privGotSpec(self, levelSpec):
        DistCogdoLevelGame.privGotSpec(self, levelSpec)

        levelMgr = self.getEntity(LevelConstants.LevelMgrEntId)
        self.endVault = levelMgr.geom
        self.endVault.reparentTo(self.geomRoot)

        # Clear out unneeded backstage models from the EndVault, if
        # they're in the file.
        self.endVault.findAllMatches('**/MagnetArms').detach()
        self.endVault.findAllMatches('**/Safes').detach()
        self.endVault.findAllMatches('**/MagnetControlsAll').detach()

        # Flag the collisions in the end vault so safes and magnets
        # don't try to go through the wall.
        cn = self.endVault.find('**/wallsCollision').node()
        cn.setIntoCollideMask(OTPGlobals.WallBitmask
                              | ToontownGlobals.PieBitmask
                              | (PM.BitMask32.lowerOn(3) << 21))

        # Find all the wall polygons and replace them with planes,
        # which are solid, so there will be zero chance of safes or
        # toons slipping through a wall.
        walls = self.endVault.find('**/RollUpFrameCillison')
        walls.detachNode()
        self.evWalls = self.replaceCollisionPolysWithPlanes(walls)
        self.evWalls.reparentTo(self.endVault)

        # Initially, these new planar walls are stashed, so they don't
        # cause us trouble in the intro movie or in battle one.  We
        # will unstash them when we move to battle three.
        self.evWalls.stash()

        # Also replace the floor polygon with a plane, and rename it
        # so we can detect a collision with it.
        floor = self.endVault.find('**/EndVaultFloorCollision')
        floor.detachNode()
        self.evFloor = self.replaceCollisionPolysWithPlanes(floor)
        self.evFloor.reparentTo(self.endVault)
        self.evFloor.setName('floor')

        # Also, put a big plane across the universe a few feet below
        # the floor, to catch things that fall out of the world.
        plane = PM.CollisionPlane(
            PM.Plane(PM.Vec3(0, 0, 1), PM.Point3(0, 0, -50)))
        planeNode = PM.CollisionNode('dropPlane')
        planeNode.addSolid(plane)
        planeNode.setCollideMask(ToontownGlobals.PieBitmask)
        self.geomRoot.attachNewNode(planeNode)
 def enterLoaded(self):
     DistCogdoLevelGame.enterLoaded(self)
     self.lightning = loader.loadModel('phase_10/models/cogHQ/CBLightning.bam')
     self.magnet = loader.loadModel('phase_10/models/cogHQ/CBMagnet.bam')
     self.craneArm = loader.loadModel('phase_10/models/cogHQ/CBCraneArm.bam')
     self.controls = loader.loadModel('phase_10/models/cogHQ/CBCraneControls.bam')
     self.stick = loader.loadModel('phase_10/models/cogHQ/CBCraneStick.bam')
     self.cableTex = self.craneArm.findTexture('MagnetControl')
     self.moneyBag = loader.loadModel('phase_10/models/cashbotHQ/MoneyBag')
     self.geomRoot = PM.NodePath('geom')
     self.sceneRoot = self.geomRoot.attachNewNode('sceneRoot')
     self.sceneRoot.setPos(35.84, -115.46, 6.46)
     self.physicsMgr = PM.PhysicsManager()
     integrator = PM.LinearEulerIntegrator()
     self.physicsMgr.attachLinearIntegrator(integrator)
     fn = PM.ForceNode('gravity')
     self.fnp = self.geomRoot.attachNewNode(fn)
     gravity = PM.LinearVectorForce(0, 0, GameConsts.Settings.Gravity.get())
     fn.addForce(gravity)
     self.physicsMgr.addLinearForce(gravity)
     self._gravityForce = gravity
     self._gravityForceNode = fn
 def enterVisible(self):
     DistCogdoLevelGame.enterVisible(self)
     self.geomRoot.reparentTo(render)
Beispiel #17
0
 def announceGenerate(self):
     DistCogdoLevelGame.announceGenerate(self)
     self.timer = ToontownTimer.ToontownTimer()
     self.timer.stash()
     if __dev__:
         self._durationChangedEvent = self.uniqueName('durationChanged')
    def exitGame(self):
        if __dev__:  # Seems like the devs had some developer checks, but for what?
            self.ignore(self._durationChangedEvent)

        DistCogdoLevelGame.exitGame(self)
        self._physicsTask.remove()
 def announceGenerate(self):
     DistCogdoLevelGame.announceGenerate(self)
     self.timer = ToontownTimer.ToontownTimer()
     self.timer.stash()
 def __init__(self, cr):
     DistCogdoLevelGame.__init__(self, cr)
 def exitGame(self):
     if __dev__:
         self.ignore(self._durationChangedEvent)
     DistCogdoLevelGame.exitGame(self)
     self._physicsTask.remove()
 def exitGame(self):
     DistCogdoLevelGame.exitGame(self)
     self._physicsTask.remove()
 def disable(self):
     self.timer.destroy()
     self.timer = None
     DistCogdoLevelGame.disable(self)
     return
 def enterGame(self):
     DistCogdoLevelGame.enterGame(self)
     self._physicsTask = taskMgr.add(self._doPhysics, self.uniqueName('physics'), priority=25)
     self.evWalls.stash()
     self._startTimer()
 def __init__(self, cr):
     DistCogdoLevelGame.__init__(self, cr)
 def announceGenerate(self):
     DistCogdoLevelGame.announceGenerate(self)
     self.timer = ToontownTimer.ToontownTimer(
     )  # You would've been timed for the minigame?
     self.timer.setScale(Consts.Settings.TimerScale.get())
     self.timer.stash()
 def announceGenerate(self):
     DistCogdoLevelGame.announceGenerate(self)
     self.timer = ToontownTimer.ToontownTimer()
     self.timer.setScale(Consts.Settings.TimerScale.get())
     self.timer.stash()
Beispiel #28
0
 def exitGame(self):
     if __dev__:
         self.ignore(self._durationChangedEvent)
     
     DistCogdoLevelGame.exitGame(self)
     self._physicsTask.remove()
 def enterFinish(self):
     DistCogdoLevelGame.enterFinish(self)
     timeLeft = 10 - (globalClock.getRealTime() - self.getFinishTime())
     self.timer.setTime(timeLeft)
     self.timer.countdown(timeLeft, self.timerExpired)
     self.timer.unstash()
 def __init__(self, cr):
     DistCogdoLevelGame.__init__(self, cr)
     self.cranes = {}
     self.moneyBags = {}
 def __init__(self, cr):
     DistCogdoLevelGame.__init__(self, cr)
     self.cranes = {}
     self.moneyBags = {}
 def announceGenerate(self):
     DistCogdoLevelGame.announceGenerate(self)
     self.timer = ToontownTimer.ToontownTimer()
     self.timer.stash()
 def announceGenerate(self):
     DistCogdoLevelGame.announceGenerate(self)
     self.timer = ToontownTimer.ToontownTimer()
     self.timer.stash()
     if __dev__:
         self._durationChangedEvent = self.uniqueName('durationChanged')
 def exitGame(self):
     DistCogdoLevelGame.exitGame(self)
     self._physicsTask.remove()
 def disable(self):
     self.timer.destroy()
     self.timer = None
     DistCogdoLevelGame.disable(self)
     return
 def announceGenerate(self):
     DistCogdoLevelGame.announceGenerate(self)
     self.timer = ToontownTimer.ToontownTimer()
     self.timer.setScale(Consts.Settings.TimerScale.get())
     self.timer.stash()
 def enterGame(self):
     DistCogdoLevelGame.enterGame(self)
     timeLeft = Consts.GameDuration.get() - (globalClock.getRealTime() - self.getStartTime())
     self.timer.setTime(timeLeft)
     self.timer.countdown(timeLeft, self.timerExpired)
     self.timer.unstash()
 def enterVisible(self):
     DistCogdoLevelGame.enterVisible(self)
     self.geomRoot.reparentTo(render)
Beispiel #39
0
 def enterIntro(self):
     DistCogdoLevelGame.enterIntro(self)
     self.geomRoot.reparentTo(render)