enabled, volume, random start t

This commit is contained in:
Darren Ranalli 2003-12-13 03:46:28 +00:00
parent 274c96300a
commit e098bdf85b
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,6 @@
from IntervalGlobal import *
import BasicEntities
import random
class AmbientSound(BasicEntities.NodePathEntity):
def __init__(self, level, entId):
@ -11,13 +12,17 @@ class AmbientSound(BasicEntities.NodePathEntity):
BasicEntities.NodePathEntity.destroy(self)
def initSound(self):
if not self.enabled:
return
if self.soundPath == '':
return
self.sound = base.loadSfx(self.soundPath)
if self.sound is None:
return
self.soundIval = SoundInterval(self.sound, node=self)
self.soundIval = SoundInterval(self.sound, node=self,
volume=self.volume)
self.soundIval.loop()
self.soundIval.setT(random.random() * self.sound.length())
def destroySound(self):
if hasattr(self, 'soundIval'):