Radio = {};


function Radio.prerequisitesPresent(specializations)
      return true;
end;

function Radio:load(savegame)

self.sampleradio1 = Utils.loadSample(xmlFile, {}, "vehicle.radio1", nil, self.baseDirectory);
self.sampleradio2 = Utils.loadSample(xmlFile, {}, "vehicle.radio2", nil, self.baseDirectory);
self.sampleradio3 = Utils.loadSample(xmlFile, {}, "vehicle.radio3", nil, self.baseDirectory);
self.sampleradio4 = Utils.loadSample(xmlFile, {}, "vehicle.radio4", nil, self.baseDirectory);
self.sampleradio5 = Utils.loadSample(xmlFile, {}, "vehicle.radio5", nil, self.baseDirectory);
self.sampleradio6 = Utils.loadSample(xmlFile, {}, "vehicle.radio6", nil, self.baseDirectory);
self.sampleradio7 = Utils.loadSample(xmlFile, {}, "vehicle.radio7", nil, self.baseDirectory);
self.sampleradio8 = Utils.loadSample(xmlFile, {}, "vehicle.radio8", nil, self.baseDirectory);
self.sampleradio9 = Utils.loadSample(xmlFile, {}, "vehicle.radio9", nil, self.baseDirectory);

 self.temp = 0

    
end;

function Radio:delete()
end;

function Radio:readStream(streamId, connection)
end;
  
function Radio:writeStream(streamId, connection)
end;

function Radio:mouseEvent(posX, posY, isDown, isUp, button)
end;

function Radio:keyEvent(unicode, sym, modifier, isDown)    
end;

function Radio:update(dt)



if self.sampleCylinderedHydraulic ~= nil then
    if self.camIndex ~= nil then
        if self.camIndex == 1 then
            Utils.setSampleVolume(self.sampleradio1, 1);
            Utils.setSampleVolume(self.sampleradio2, 1);
            Utils.setSampleVolume(self.sampleradio3, 1);
            Utils.setSampleVolume(self.sampleradio4, 1);
            Utils.setSampleVolume(self.sampleradio5, 1);
            Utils.setSampleVolume(self.sampleradio6, 1);
            Utils.setSampleVolume(self.sampleradio7, 1);
            Utils.setSampleVolume(self.sampleradio8, 1);
            Utils.setSampleVolume(self.sampleradio9, 1);
        else
            Utils.setSampleVolume(self.sampleradio1, 0);
            Utils.setSampleVolume(self.sampleradio2, 0);
            Utils.setSampleVolume(self.sampleradio3, 0);
            Utils.setSampleVolume(self.sampleradio4, 0);
            Utils.setSampleVolume(self.sampleradio5, 0);
            Utils.setSampleVolume(self.sampleradio6, 0);
            Utils.setSampleVolume(self.sampleradio7, 0);
            Utils.setSampleVolume(self.sampleradio8, 0);
            Utils.setSampleVolume(self.sampleradio9, 0);

        end;
    end;
end;
end;

function Radio:updateTick(dt)
    self.temp  =  self.temp + dt

if self:getIsActive() then
    if self:getIsActiveForSound() then
    
    if self.temp > 60000 then
    self.temp = 0
    end;
    
    if self.temp > 1000 and self.temp < 1050 then
    Utils.playSample(self.sampleradio1, 1, 0, nil);
    end;
    
    if self.temp > 15000 and self.temp < 15050 then
    Utils.playSample(self.sampleradio5, 1, 0, nil);
    end;
    
    if self.temp > 30000 and self.temp < 30050 then
    Utils.playSample(self.sampleradio2, 1, 0, nil);
    end;
    
    if self.temp > 45000 and self.temp < 45050 then
    Utils.playSample(self.sampleradio3, 1, 0, nil);
    end;
    
    if self.temp > 60000 and self.temp < 60050 then
    Utils.playSample(self.sampleradio4, 1, 0, nil);
    end;
    
    if self.temp > 75000 and self.temp < 75050 then
    Utils.playSample(self.sampleradio5, 1, 0, nil);
    end;
    
    if self.temp > 90000 and self.temp < 90050 then
    Utils.playSample(self.sampleradio6, 1, 0, nil);
    end;
    
    if self.temp > 105000 and self.temp < 105050 then
    Utils.playSample(self.sampleradio7, 1, 0, nil);
    end;
    
    if self.temp > 120000 and self.temp < 120050 then
    Utils.playSample(self.sampleradio8, 1, 0, nil);
    end;
    
    if self.temp > 135000 and self.temp < 135050 then
    Utils.playSample(self.sampleradio9, 1, 0, nil);
    end;
    
end;    
end;    
    

end;
    
function Radio:onLeave()
end;  
      
function Radio:draw()      
end;

function Radio:onDeactivateSounds()
end;

function Radio:onDeactivate()
end;




