def walkBackToSpawnPointWithBarrel(self):
     pos = DGG.SpawnPoints[self.spawnPoint]
     startPos = self.getPos(render)
     self.b_setSuitState(1, -1, self.spawnPoint)
     durationFactor = 0.2
     pathName = self.uniqueName('WalkBackToSpawn')
     self.walkTrack = NPCWalkInterval(self, pos, startPos=startPos, name=pathName, durationFactor=durationFactor, fluid=1)
     self.walkTrack.setDoneEvent(self.walkTrack.getName())
     self.acceptOnce(self.walkTrack.getDoneEvent(), self.__walkedBack2Spawn)
     self.walkTrack.start()
     self.b_setAnimState(SuitGlobals.getAnimId(SuitGlobals.getAnimByName('tray-walk')))
 def walkToTruck(self):
     index = DGG.WalkToTruckIndex
     pos = DGG.TruckSuitPointsByIndex[self.truckIndex]
     startPos = self.getPos(render)
     self.b_setSuitState(1, -1, index)
     durationFactor = 0.2
     pathName = self.uniqueName('WalkToTruck')
     self.walkTrack = NPCWalkInterval(self, pos, startPos=startPos, name=pathName, durationFactor=durationFactor, fluid=1)
     self.walkTrack.setDoneEvent(self.walkTrack.getName())
     self.acceptOnce(self.walkTrack.getDoneEvent(), self.__walkedToTruck)
     self.walkTrack.start()
     self.b_setAnimState(SuitGlobals.getAnimId(SuitGlobals.getAnimByName('walk')))
示例#3
0
 def b_setAnimState(self, anim):
     if type(anim) == types.StringType:
         animId = SuitGlobals.getAnimId(SuitGlobals.getAnimByName(anim))
         if animId == None and anim != 'flyNeutral':
             animId = 44
         elif anim == 'flyNeutral':
             animId = 45
     else:
         animId = anim
     self.d_setAnimState(animId)
     self.setAnimState(animId)
     return
示例#4
0
 def monitorHealth(self, task):
     if self.health <= 0:
         if hasattr(self, 'brain'):
             self.brain.stopThinking()
             self.brain.unloadBehaviors()
             self.brain = None
         self.b_setSuitState(0, -1, -1)
         currentAnim = SuitGlobals.getAnimByName(self.anim)
         self.clearTrack()
         if currentAnim:
             if not self.deathAnim:
                 self.deathAnim = currentAnim
                 self.deathTimeLeft = currentAnim.getDeathHoldTime()
                 self.deathTaskName = self.uniqueName('__handleDeath')
                 taskMgr.doMethodLater(1, self.__handleDeath, name=self.deathTaskName)
             else:
                 taskMgr.remove(self.deathTaskName)
                 delayTime = currentAnim.getDeathHoldTime()
                 self.deathTimeLeft = delayTime / 2
                 taskMgr.doMethodLater(1, self.__handleDeath, name=self.deathTaskName)
         else:
             self.killSuit()
         return Task.done
     else:
         return Task.cont
 def walkBackToSpawnPointWithBarrel(self):
     pos = DGG.SpawnPoints[self.spawnPoint]
     startPos = self.getPos(render)
     self.b_setSuitState(1, -1, self.spawnPoint)
     durationFactor = 0.2
     pathName = self.uniqueName('WalkBackToSpawn')
     self.walkTrack = NPCWalkInterval(self,
                                      pos,
                                      startPos=startPos,
                                      name=pathName,
                                      durationFactor=durationFactor,
                                      fluid=1)
     self.walkTrack.setDoneEvent(self.walkTrack.getName())
     self.acceptOnce(self.walkTrack.getDoneEvent(), self.__walkedBack2Spawn)
     self.walkTrack.start()
     self.b_setAnimState(
         SuitGlobals.getAnimId(SuitGlobals.getAnimByName('tray-walk')))
 def walkToTruck(self):
     index = DGG.WalkToTruckIndex
     pos = DGG.TruckSuitPointsByIndex[self.truckIndex]
     startPos = self.getPos(render)
     self.b_setSuitState(1, -1, index)
     durationFactor = 0.2
     pathName = self.uniqueName('WalkToTruck')
     self.walkTrack = NPCWalkInterval(self,
                                      pos,
                                      startPos=startPos,
                                      name=pathName,
                                      durationFactor=durationFactor,
                                      fluid=1)
     self.walkTrack.setDoneEvent(self.walkTrack.getName())
     self.acceptOnce(self.walkTrack.getDoneEvent(), self.__walkedToTruck)
     self.walkTrack.start()
     self.b_setAnimState(
         SuitGlobals.getAnimId(SuitGlobals.getAnimByName('walk')))
示例#7
0
 def setAnimState(self, anim):
     if hasattr(self, 'animStateChangeEvent'):
         messenger.send(self.animStateChangeEvent, [anim, self.anim])
         self.anim = anim
         if type(self.anim) == types.IntType:
             if anim != 44 and anim != 45:
                 self.anim = SuitGlobals.getAnimById(anim).getName()
             elif anim == 44:
                 self.anim = 'die'
             elif anim == 45:
                 self.anim = 'flyNeutral'
 def monitorHealth(self, task):
     if self.health <= 0:
         self.tutorial.sendUpdateToAvatarId(self.avatarId, 'suitNoHealth', [self.tutPartIndex])
         if self.walkTrack:
             self.ignore(self.walkTrack.getDoneEvent())
             self.walkTrack.pause()
             self.walkTrack = None
         self.b_setSuitState(0, -1, -1)
         currentAnim = SuitGlobals.getAnimByName(self.anim)
         self.clearTrack()
         base.taskMgr.remove(self.uniqueName('scwaa'))
         self.stopAttacks()
         if currentAnim:
             self.track = Sequence(Wait(currentAnim.getDeathHoldTime()), Func(self.killSuit))
             self.track.start()
         else:
             self.killSuit()
         return Task.done
     else:
         return Task.cont
 def monitorHealth(self, task):
     if self.health <= 0:
         self.tutorial.sendUpdateToAvatarId(self.avatarId, 'suitNoHealth',
                                            [self.tutPartIndex])
         if self.walkTrack:
             self.ignore(self.walkTrack.getDoneEvent())
             self.walkTrack.pause()
             self.walkTrack = None
         self.b_setSuitState(0, -1, -1)
         currentAnim = SuitGlobals.getAnimByName(self.anim)
         self.clearTrack()
         base.taskMgr.remove(self.uniqueName('scwaa'))
         self.stopAttacks()
         if currentAnim:
             self.track = Sequence(Wait(currentAnim.getDeathHoldTime()),
                                   Func(self.killSuit))
             self.track.start()
         else:
             self.killSuit()
         return Task.done
     return Task.cont