Beispiel #1
0
    def think(self):
        DistributedEntityAI.think(self)

        state = self.getEntityState()
        elapsed = self.getEntityStateElapsed()

        if state == self.StateAlive:
            if self.aliveTime != -1 and elapsed >= self.aliveTime:
                print("ok now stop")
                self.Stop()
Beispiel #2
0
    def think(self):
        DistributedEntityAI.think(self)

        state = self.getEntityState()
        elapsed = self.getEntityStateElapsed()
        if state == self.CodeResponse and elapsed >= 0.5:
            if self.codeWasCorrect:
                self.dispatchOutput("OnCodeCorrect")
                self.dispatch.codeUsed()
            else:
                self.dispatchOutput("OnCodeIncorrect")
            self.b_setNumbers([])
            self.setEntityState(self.CodeEntry)
            self.codeWasCorrect = False
Beispiel #3
0
    def think(self):
        DistributedEntityAI.think(self)

        now = globalClock.getFrameTime()
        state = self.getEntityState()
        elapsed = self.getEntityStateElapsed()
        if state == self.StateGiving:
            giveElapsed = now - self.lastGive
            if giveElapsed >= self.giveIval:
                if self.avId:
                    self.sendUpdate('giveLaffTo', [self.avId])
                    av = self.air.doId2do.get(self.avId, None)
                    if av:
                        av.heal(1)
                        self.hp -= 1
                        self.lastGive = now
                        if not self.hasHP():
                            self.setIdleState()
                            return
                    else:
                        self.setIdleState()
                        return