Music Tempo now changes in the races like in TTO

This commit is contained in:
John 2015-06-30 12:30:03 +03:00
parent 26bee34ec1
commit 2463b5cff8

View file

@ -550,14 +550,14 @@ class DistributedRace(DistributedObject.DistributedObject):
newLapT = (newT - self.startT) / self.curve.getMaxT() % 1.0
if newLapT - self.currLapT < -0.5:
self.laps += 1
self.changeMusicTempo(1 + self.laps * 0.5)
self.changeMusicTempo(1 + self.laps * 0.33)
self.notify.debug('crossed the start line: %s, %s, %s, %s' % (self.laps,
self.startT,
self.currT,
newT))
elif newLapT - self.currLapT > 0.5:
self.laps -= 1
self.changeMusicTempo(1 + self.laps * 0.5)
self.changeMusicTempo(1 + self.laps * 0.33)
self.notify.debug('crossed the start line - wrong way: %s, %s, %s, %s' % (self.laps,
self.startT,
self.currT,
@ -1211,12 +1211,9 @@ class DistributedRace(DistributedObject.DistributedObject):
self.musicTrack.start()
def changeMusicTempo(self, newPR):
return # TODO: Reenable when we have music change support.
if self.musicTrack:
self.musicTrack.finish()
curPR = self.raceMusic.getPlayRate()
interval = LerpFunctionInterval(self.raceMusic.setPlayRate, fromData=curPR, toData=newPR, duration=3)
self.musicTrack = Sequence(interval)
self.musicTrack = Sequence(LerpFunctionInterval(self.raceMusic.setPlayRate, fromData=self.raceMusic.getPlayRate(), toData=newPR, duration=3))
self.musicTrack.start()
def setRaceZone(self, zoneId, trackId):