From 2e37c13254d2b40727cd87494e1ef48509d6d420 Mon Sep 17 00:00:00 2001 From: Mike Goslin Date: Tue, 6 Mar 2001 01:47:13 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/interval/Interval.py | 6 ++++-- direct/src/interval/SoundInterval.py | 2 +- direct/src/interval/WaitInterval.py | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 direct/src/interval/WaitInterval.py diff --git a/direct/src/interval/Interval.py b/direct/src/interval/Interval.py index 1698afe420..661fb53732 100644 --- a/direct/src/interval/Interval.py +++ b/direct/src/interval/Interval.py @@ -42,10 +42,12 @@ class Interval(DirectObject): """ self.setT(self.getDuration(), entry=1) - def play(self, t0=0.0, duration=0.0): + def play(self, t0=0.0, duration=0.0, scale=1.0): """ play(t0, duration) """ self.startT = self.clock.getFrameTime() - t0 + assert(scale > 0.0) + self.scale = scale if (duration == 0.0): self.playDuration = self.duration else: @@ -61,7 +63,7 @@ class Interval(DirectObject): """ __playTask(task) """ t = self.clock.getFrameTime() - te = t - self.startT + te = (t - self.startT) * self.scale if (te <= self.playDuration): self.setT(te) return Task.cont diff --git a/direct/src/interval/SoundInterval.py b/direct/src/interval/SoundInterval.py index 83786c77b6..7606ecf83f 100644 --- a/direct/src/interval/SoundInterval.py +++ b/direct/src/interval/SoundInterval.py @@ -39,6 +39,6 @@ class SoundInterval(Interval): assert(t >= 0) if (entry == 1): self.isPlaying = 1 - AudioManager.play(self.sound) + AudioManager.play(self.sound, t) if (self.loop): AudioManager.setLoop(self.sound, 1) diff --git a/direct/src/interval/WaitInterval.py b/direct/src/interval/WaitInterval.py new file mode 100644 index 0000000000..8caf0d1eaa --- /dev/null +++ b/direct/src/interval/WaitInterval.py @@ -0,0 +1,20 @@ +"""WaitInterval module: contains the WaitInterval class""" + +from PandaModules import * +from Interval import * + +class WaitInterval(Interval): + + waitNum = 1 + + # special methods + + def __init__(self, duration, name=None): + """__init__(duration, name) + """ + if (name == None): + n = 'Wait-%d' % self.waitNum + self.waitNum = self.waitNum + 1 + else: + n = name + Interval.__init__(self, n, duration)