mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -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)
|
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)
|
""" play(t0, duration)
|
||||||
"""
|
"""
|
||||||
self.startT = self.clock.getFrameTime() - t0
|
self.startT = self.clock.getFrameTime() - t0
|
||||||
|
assert(scale > 0.0)
|
||||||
|
self.scale = scale
|
||||||
if (duration == 0.0):
|
if (duration == 0.0):
|
||||||
self.playDuration = self.duration
|
self.playDuration = self.duration
|
||||||
else:
|
else:
|
||||||
@ -61,7 +63,7 @@ class Interval(DirectObject):
|
|||||||
""" __playTask(task)
|
""" __playTask(task)
|
||||||
"""
|
"""
|
||||||
t = self.clock.getFrameTime()
|
t = self.clock.getFrameTime()
|
||||||
te = t - self.startT
|
te = (t - self.startT) * self.scale
|
||||||
if (te <= self.playDuration):
|
if (te <= self.playDuration):
|
||||||
self.setT(te)
|
self.setT(te)
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
@ -39,6 +39,6 @@ class SoundInterval(Interval):
|
|||||||
assert(t >= 0)
|
assert(t >= 0)
|
||||||
if (entry == 1):
|
if (entry == 1):
|
||||||
self.isPlaying = 1
|
self.isPlaying = 1
|
||||||
AudioManager.play(self.sound)
|
AudioManager.play(self.sound, t)
|
||||||
if (self.loop):
|
if (self.loop):
|
||||||
AudioManager.setLoop(self.sound, 1)
|
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