Browse Source

*** empty log message ***

Mike Goslin 25 years ago
parent
commit
2e37c13254

+ 4 - 2
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

+ 1 - 1
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)

+ 20 - 0
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)