mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
*** empty log message ***
This commit is contained in:
parent
1511097112
commit
2e37c13254
@ -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
|
||||
|
@ -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
direct/src/interval/WaitInterval.py
Normal file
20
direct/src/interval/WaitInterval.py
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user