-- ##########################################################
-- #	lowFuelIndicator									#
-- #														#
-- #	author: Webby										#
-- #	Date: 28.06.2012									#
-- #	version: 1.0										#
-- #														#
-- #	BIG THX 2 bazillus, modelleicher and bassaddict		# 
-- #			for helping me with this script!			#
-- #														#
-- #		   DO NOT COPY OR CHANGE THIS SCRIPT!			#
-- ##########################################################

lowFuelIndicator = {};

function lowFuelIndicator.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
end;

function lowFuelIndicator:load(xmlFile)
	
	self.lowFuelIndicatorHud = Overlay:new("lowFuelIndicatorOverlay", Utils.getFilename("Textures/fuelIndicator.dds", self.baseDirectory), 0.925, 0.55, 0.080, 0.085);
	
	lowFuelSoundFile = Utils.getFilename("Sounds/fuelIndicator_bing.wav", self.baseDirectory);
    self.lowFuelSoundId = createSample("LFSound");
    loadSample(self.lowFuelSoundId, lowFuelSoundFile, false);
	self.lowFuelSoundPlaying = false;
	self.playedSound = false;
end;

function lowFuelIndicator:delete()
end;

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

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

function lowFuelIndicator:update(dt)
end;

function lowFuelIndicator:draw()
	if self.fuelFillLevel <= (self.fuelCapacity / 100) * 20 then -- Hier die 20 in eine beliebige andere Zahl ändern! Die 20 steht für 20% Resttankvolumen.
		self.lowFuelIndicatorHud:render();
		if self.playedSound == false then
			playSample(self.lowFuelSoundId,1,1,0);
			self.playedSound = true;
		end;
		else
			self.playedSound = false;
	end;
end;
