def setHealth(self, health):
        if health > self.health:
            # We got an hp boost. Flash green.
            flashColor = VBase4(0, 1, 0, 1)
        elif health < self.health:
            # We got an hp loss. Flash red.
            flashColor = VBase4(1, 0, 0, 1)
        DistributedAvatar.setHealth(self, health)

        def doBossFlash():
            if not self.isEmpty():
                LerpColorScaleInterval(self, 0.2, flashColor).start()

        def clearBossFlash():
            if not self.isEmpty():
                self.clearColorScale()

        if self.isDead():
            self.setChaseTarget(0)
            base.taskMgr.remove(self.uniqueName('monitorLocalAvDistance'))
            #if self.isInRange:
            #    self.isInRange = False
            #self.gruntSound.play()

        if self.getLevel() > 12:
            if self.hpFlash:
                self.hpFlash.finish()
                self.hpFlash = None
            self.hpFlash = Sequence(Func(doBossFlash), Wait(0.2),
                                    Func(clearBossFlash))
            self.hpFlash.start()
        self.updateHealthBar(health)
Ejemplo n.º 2
0
 def setHealth(self, health):
     oldHp = self.getHealth()
     self.handleHealthChange(health, self.getHealth())
     DistributedAvatar.setHealth(self, health)
     if self.doId != base.localAvatar.doId:
         if not self.firstTimeChangingHP:
             if health < self.getMaxHealth():
                 if not self.headMeter:
                     self.__makeHeadMeter()
                 else:
                     self.__updateHeadMeter(oldHp)
             else:
                 self.__removeHeadMeter()
     self.firstTimeChangingHP = False
Ejemplo n.º 3
0
 def setHealth(self, hp):
     DistributedAvatar.setHealth(self, hp)
     if self.isLocal():
         base.localAvatar.getBattleZone().getTurretManager(
         ).updateTurretGui()