def enterMoveAvatars(self, choiceList, positionList, rewardList):
     self.notify.debug('in enterMoveAvatars:')
     tasks = []
     self.avatarPositionsCopy = self.avatarPositions.copy()
     for i in range(0, len(choiceList) / self.numPlayers):
         startIndex = i * self.numPlayers
         endIndex = startIndex + self.numPlayers
         self.choiceList = choiceList[startIndex:endIndex]
         self.positionList = positionList[startIndex:endIndex]
         self.rewardList = rewardList[startIndex:endIndex]
         self.notify.debug('           turn: ' + str(i + 1))
         self.notify.debug('     choiceList: ' + str(self.choiceList))
         self.notify.debug('   positionList: ' + str(self.positionList))
         self.notify.debug('     rewardList: ' + str(self.rewardList))
         longestLerpTime = self.getLongestLerpTime(i > 0)
         self.notify.debug('longestLerpTime: ' + str(longestLerpTime))
         if i == 0:
             snt = Task(self.showNumbers)
             snt.choiceList = self.choiceList
             smt = Task(self.showMatches)
             smt.choiceList = self.choiceList
             tasks += [
                 snt,
                 Task.pause(0.5),
                 smt]
         
         if longestLerpTime > 0.0:
             self.notify.debug('someone moved...')
             mat = Task(self.moveAvatars)
             mat.choiceList = self.choiceList
             mat.positionList = self.positionList
             mat.rewardList = self.rewardList
             mat.name = 'moveAvatars'
             if i == 0:
                 tasks += [
                     Task.pause(0.75),
                     mat,
                     Task.pause(0.75),
                     Task(self.hideNumbers),
                     Task.pause(longestLerpTime - 0.5)]
             else:
                 mat.chance = 1
                 tasks += [
                     mat,
                     Task.pause(longestLerpTime)]
             tasks += self.showChanceRewards()
             continue
         self.notify.debug('no one moved...')
         tasks += [
             Task.pause(1.0),
             Task(self.hideNumbers)]
     
     self.notify.debug('task list : ' + str(tasks))
     wdt = Task(self.walkDone)
     wdt.name = 'walk done'
     tasks.append(wdt)
     moveTask = Task.sequence(*tasks)
     taskMgr.add(moveTask, 'moveAvatars')
 def enterMoveAvatars(self, choiceList, positionList, rewardList):
     self.notify.debug('in enterMoveAvatars:')
     tasks = []
     self.avatarPositionsCopy = self.avatarPositions.copy()
     for i in range(0, len(choiceList) / self.numPlayers):
         startIndex = i * self.numPlayers
         endIndex = startIndex + self.numPlayers
         self.choiceList = choiceList[startIndex:endIndex]
         self.positionList = positionList[startIndex:endIndex]
         self.rewardList = rewardList[startIndex:endIndex]
         self.notify.debug('           turn: ' + str(i + 1))
         self.notify.debug('     choiceList: ' + str(self.choiceList))
         self.notify.debug('   positionList: ' + str(self.positionList))
         self.notify.debug('     rewardList: ' + str(self.rewardList))
         longestLerpTime = self.getLongestLerpTime(i > 0)
         self.notify.debug('longestLerpTime: ' + str(longestLerpTime))
         if i == 0:
             snt = Task(self.showNumbers)
             snt.choiceList = self.choiceList
             smt = Task(self.showMatches)
             smt.choiceList = self.choiceList
             tasks += [
                 snt,
                 Task.pause(0.5),
                 smt]
         
         if longestLerpTime > 0.0:
             self.notify.debug('someone moved...')
             mat = Task(self.moveAvatars)
             mat.choiceList = self.choiceList
             mat.positionList = self.positionList
             mat.rewardList = self.rewardList
             mat.name = 'moveAvatars'
             if i == 0:
                 tasks += [
                     Task.pause(0.75),
                     mat,
                     Task.pause(0.75),
                     Task(self.hideNumbers),
                     Task.pause(longestLerpTime - 0.5)]
             else:
                 mat.chance = 1
                 tasks += [
                     mat,
                     Task.pause(longestLerpTime)]
             tasks += self.showChanceRewards()
             continue
         self.notify.debug('no one moved...')
         tasks += [
             Task.pause(1.0),
             Task(self.hideNumbers)]
     
     self.notify.debug('task list : ' + str(tasks))
     wdt = Task(self.walkDone)
     wdt.name = 'walk done'
     tasks.append(wdt)
     moveTask = Task.sequence(*tasks)
     taskMgr.add(moveTask, 'moveAvatars')
Пример #3
0
    def enterMoveAvatars(self, choiceList, positionList, rewardList):
        self.notify.debug("in enterMoveAvatars:")
        # These arrays could contain multiple turn information,
        # so unroll them one turn at a time
        tasks = []

        # Make a copy for getLongestLerpTime to stomp on
        self.avatarPositionsCopy = self.avatarPositions.copy()

        for i in range(0, len(choiceList) / self.numPlayers):
            startIndex = i * self.numPlayers
            endIndex = startIndex + self.numPlayers
            self.choiceList = choiceList[startIndex:endIndex]
            self.positionList = positionList[startIndex:endIndex]
            self.rewardList = rewardList[startIndex:endIndex]

            self.notify.debug("           turn: " + str(i + 1))
            self.notify.debug("     choiceList: " + str(self.choiceList))
            self.notify.debug("   positionList: " + str(self.positionList))
            self.notify.debug("     rewardList: " + str(self.rewardList))

            longestLerpTime = self.getLongestLerpTime(i > 0)

            self.notify.debug("longestLerpTime: " + str(longestLerpTime))

            # only need to do this once
            if i == 0:
                snt = Task(self.showNumbers)
                snt.choiceList = self.choiceList
                smt = Task(self.showMatches)
                smt.choiceList = self.choiceList
                tasks += [
                    snt,
                    Task.pause(0.5),
                    smt,
                ]

            # there may be multiple moves per turn thanks to the
            # chance cards. Concatenate all tasks into a list,
            # then make one big sequence out of the lists
            if longestLerpTime > 0.0:
                self.notify.debug("someone moved...")
                # If anybody moves, add all these task
                mat = Task(self.moveAvatars)
                mat.choiceList = self.choiceList
                mat.positionList = self.positionList
                mat.rewardList = self.rewardList
                mat.name = "moveAvatars"
                if i == 0:
                    tasks += [
                        Task.pause(0.75),
                        # Start moving the avatars with the numbers up
                        # for just a brief time
                        mat,
                        Task.pause(0.75),
                        Task(self.hideNumbers),
                        # Wait for the walk to finish
                        Task.pause(longestLerpTime - 0.5),
                    ]
                else:
                    mat.chance = 1
                    tasks += [
                        mat,
                        # Wait for the walk to finish
                        Task.pause(longestLerpTime),
                    ]

                # check for chance card hit in this lane
                tasks += self.showChanceRewards()
            else:
                self.notify.debug("no one moved...")
                # If nobody moves, use this sequence
                tasks += [Task.pause(1.0), Task(self.hideNumbers)]

        self.notify.debug("task list : " + str(tasks))

        # now make and spawn a sequence out of our compiled task list
        wdt = Task(self.walkDone)
        wdt.name = "walk done"
        tasks.append(wdt)
        moveTask = Task.sequence(*tasks)
        taskMgr.add(moveTask, "moveAvatars")