コード例 #1
0
ファイル: CogStomper.py プロジェクト: tsp-team/ttsp-src
    def setEntityState(self, state):
        DistributedEntity.setEntityState(self, state)

        if state == self.StateDown:
            self.clearSequence()
            self.setPos(self.cEntity.getOrigin())
            self.playSound("stomp")
            base.emitShake(self, 0.5)

        elif state == self.StateUp:
            self.stopSound("raise")
            self.clearSequence()
            self.setPos(self.cEntity.getOrigin() + self.getUpPosition())

        elif state == self.StateStomp:
            self.setSequence(
                LerpPosInterval(
                    self, self.height / self.stompSpeed,
                    self.cEntity.getOrigin(),
                    self.cEntity.getOrigin() + self.getUpPosition()))

        elif state == self.StateRaise:
            self.loopSound("raise")
            self.setSequence(
                LerpPosInterval(
                    self, self.height / self.raiseSpeed,
                    self.cEntity.getOrigin() + self.getUpPosition(),
                    self.cEntity.getOrigin()))
コード例 #2
0
ファイル: LaffBarrel.py プロジェクト: tsp-team/ttsp-src
 def setEntityState(self, state):
     DistributedEntity.setEntityState(self, state)
     self.clearSequence()
     if state == self.StateEmpty:
         self.setColorScale(0.5, 0.5, 0.5, 1.0)
         self.playSound('empty')
         self.stopSound('start')
         self.stopSound('giveLaff')
     elif state == self.StateAvailable:
         self.setColorScale(1, 1, 1, 1)
     elif state == self.StateGiving:
         self.setSequence(
             Sequence(
                 SoundInterval(self.getSound('start'),
                               duration=self.getSound('start').length() /
                               2.0),
                 Func(
                     self.setSequence,
                     SoundInterval(
                         self.getSound('giveLaff'),
                         duration=self.getSound('giveLaff').length() / 4.0),
                     True)))