def onSetAction_firstPerson(self, action): track = Sequence() vm = self.getViewModel() fpsCam = self.getFPSCam() if action in [self.StateFire, self.StateDblFire]: CIGlobals.makeMuzzleFlash(self.fpMuzzleAttach, (-0.03, 0.51, 32.45), (0, -90, 0), 7.5) if action == self.StateIdle: track.append(Func(vm.loop, "idle")) elif action == self.StateDraw: track.append(ActorInterval(vm, "draw", playRate=self.Speed)) elif action == self.StatePump: track.append(Func(self.pumpSound.play)) track.append(Func(self.__emitShell)) track.append(ActorInterval(vm, "pump", playRate=self.Speed)) elif action == self.StateFire: fpsCam.addViewPunch(Vec3(random.uniform(-2, 2), random.uniform(2, 1), 0)) track.append(Func(self.fireSound.play)) track.append(ActorInterval(vm, "fire", playRate=self.Speed)) elif action == self.StateDblFire: fpsCam.addViewPunch(Vec3(0, random.uniform(-5, 5), 0)) track.append(Func(self.dblFireSound.play)) track.append(ActorInterval(vm, "altfire", playRate=self.Speed)) elif action == self.StateReload: sound = random.choice(self.reloadSounds) track.append(Func(sound.play)) track.append(ActorInterval(vm, "reload2", playRate=self.Speed)) elif action == self.StateBeginReload: track.append(ActorInterval(vm, "reload1", playRate=self.Speed)) elif action == self.StateEndReload: track.append(ActorInterval(vm, "reload3", playRate=self.Speed)) fpsCam.setVMAnimTrack(track)
def onSetAction_firstPerson(self, action): track = Sequence() vm = self.getViewModel() fpsCam = self.getFPSCam() if action == self.StateIdle: track.append(Func(vm.loop, "idle")) elif action == self.StateDraw: track.append(ActorInterval(vm, "draw", playRate=self.Speed)) elif action == self.StateReload: track.append(Func(self.reloadSound.play)) track.append(ActorInterval(vm, "reload", playRate=self.Speed)) elif action == self.StateFire: CIGlobals.makeMuzzleFlash(self.fpMuzzleAttach, (0, 0, 0), (-90, 0, 0), 7) fpsCam.resetViewPunch() fpsCam.addViewPunch( Vec3(random.uniform(-0.6, 0.6), random.uniform(-0.25, -0.5), 0.0)) track.append(Func(self.fireSound.play)) track.append(ActorInterval(vm, "fire", playRate=self.Speed)) fpsCam.setVMAnimTrack(track)