コード例 #1
0
 def setupEndSection(self, index):
     aspectSF = 0.7227
     self.endSectionNP = NodePath('EndSection')
     self.endSectionNP.reparentTo(self.game.assetMgr.world)
     self.endSectionNP.setX(self.incrementX)
     self.endWall = self.game.assetMgr.startingWall.copyTo(self.endSectionNP)
     self.endWall.setPos(100, 0, 4)
     self.endWall.setScale(0.8)
     self.endArrow = self.game.assetMgr.arrow.copyTo(self.endSectionNP)
     self.endArrow.setPos(6, 1.5, 12.76)
     self.exitElevator = self.game.assetMgr.exitElevator.copyTo(self.endSectionNP)
     self.exitElevator.setPos(52, -2, 12.7)
     cogSignModel = loader.loadModel('phase_4/models/props/sign_sellBotHeadHQ')
     cogSign = cogSignModel.find('**/sign_sellBotHeadHQ')
     cogSignSF = 23
     elevatorSignSF = 15
     sideDoor = self.exitElevator.find('**/doorway2')
     sdSign = cogSign.copyTo(sideDoor)
     sdSign.setPosHprScale(0, 1.9, 15, 0, 0, 0, elevatorSignSF, elevatorSignSF, elevatorSignSF * aspectSF)
     sdSign.node().setEffect(DecalEffect.make())
     sdText = DirectGui.OnscreenText(text=TTLocalizer.TwoDGameElevatorExit, font=ToontownGlobals.getSuitFont(), pos=(0,
                                                                                                                     -0.34), scale=0.15, mayChange=False, parent=sdSign)
     sdText.setDepthWrite(0)
     self.sectionNPList.append(self.endSectionNP)
     endSectionInfo = ('end', [], [],
      [
       0], [])
     endSection = TwoDSection.TwoDSection(index, endSectionInfo, self.endSectionNP, self)
     self.sections.append(endSection)
     self.incrementX += endSection.length
コード例 #2
0
 def setupSections(self, sectionsSelected):
     self.incrementX = -24
     for index in range(0, len(sectionsSelected)):
         sectionNP = NodePath('Section' + str(index))
         sectionNP.reparentTo(self.game.assetMgr.world)
         sectionNP.setX(self.incrementX)
         self.sectionNPList.append(sectionNP)
         section = TwoDSection.TwoDSection(index, sectionsSelected[index], sectionNP, self)
         self.sections.append(section)
         self.incrementX += section.length
コード例 #3
0
    def setupEndSection(self, index):
        # Used to compensate for scaling of Cog tunnel sign's
        # original aspect ratio of 1125x813 to a uniform ratio,
        # scale z by factor of 0.7227
        aspectSF = 0.7227
        self.endSectionNP = NodePath('EndSection')
        self.endSectionNP.reparentTo(self.game.assetMgr.world)
        self.endSectionNP.setX(self.incrementX)

        # Creating the wall
        self.endWall = self.game.assetMgr.startingWall.copyTo(
            self.endSectionNP)
        self.endWall.setPos(100, 0, 4)
        self.endWall.setScale(0.8)
        # Creating the arrow
        self.endArrow = self.game.assetMgr.arrow.copyTo(self.endSectionNP)
        self.endArrow.setPos(6, 1.5, 12.76)
        # Creating the exitElevator
        self.exitElevator = self.game.assetMgr.exitElevator.copyTo(
            self.endSectionNP)
        self.exitElevator.setPos(52, -2, 12.7)
        # Elevator EXIT sign
        cogSignModel = loader.loadModel(
            'phase_4/models/props/sign_sellBotHeadHQ')
        cogSign = cogSignModel.find('**/sign_sellBotHeadHQ')
        cogSignSF = 23
        elevatorSignSF = 15
        sideDoor = self.exitElevator.find('**/doorway2')
        sdSign = cogSign.copyTo(sideDoor)
        sdSign.setPosHprScale(0, 1.9, 15, 0, 0, 0, elevatorSignSF,
                              elevatorSignSF, elevatorSignSF * aspectSF)
        sdSign.node().setEffect(DecalEffect.make())
        sdText = DirectGui.OnscreenText(
            text=TTLocalizer.TwoDGameElevatorExit,
            font=ToontownGlobals.getSuitFont(),
            pos=(0, -0.34),
            scale=0.15,
            # required for DecalEffect (must be a GeomNode, not a TextNode)
            mayChange=False,
            parent=sdSign)
        sdText.setDepthWrite(0)

        # We create a section for the end section because it has a spawnPoint.
        # Creating a section makes it easier to handle that without repeating code.
        self.sectionNPList.append(self.endSectionNP)
        # Emulating the info what setupSections() in DistributedTwoDGameAI would have sent.
        endSectionInfo = ('end', [], [], [0], [])
        endSection = TwoDSection.TwoDSection(index, endSectionInfo,
                                             self.endSectionNP, self)
        self.sections.append(endSection)
        self.incrementX += endSection.length
コード例 #4
0
ファイル: TwoDSectionMgr.py プロジェクト: satire6/Anesidora
    def setupSections(self, sectionsSelected):
        # sectionsSelected is a list of tuples sent from the AI. [(), ()]
        # Each tuple represents one section.
        # Tuple Format: (sectionIndex, [list of enemyIndices], [list of treasureIndices], [list of spawnPointIndices])
        # The tuples are in the order we want made and we make self.sections from sectionsSelected on a one-to-one basis
##        self.incrementX = 0
        # Start the 1st section from -24
        self.incrementX = -24
        for index in range(0, len(sectionsSelected)):            
            sectionNP = NodePath('Section' + str(index))
            sectionNP.reparentTo(self.game.assetMgr.world)
            sectionNP.setX(self.incrementX)
            self.sectionNPList.append(sectionNP)
        
            section = TwoDSection.TwoDSection(index, sectionsSelected[index], sectionNP, self)
            self.sections.append(section)
            self.incrementX += section.length