--Autor Lechu & Aranea--

Ursus1014 = {};

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

function Ursus1014:load(xmlFile)
powerSoundFile = Utils.getFilename("Dzwieki/Gwizd.wav", self.baseDirectory);
    self.powerSoundId = createSample("LizardHor12nSound");
    loadSample(self.powerSoundId, powerSoundFile, false);
    self.powerPlaying = true;
end;

function Ursus1014:draw()
end;

function Ursus1014:delete()
end;

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

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

function Ursus1014:update(dt)
	if Input.isKeyPressed(Input.KEY_w) then
self.wlacz = true;
else
self.wlacz = false;
end;
if self.isEntered then                   
     if self.wlacz == false then
    if not self.powerPlaying and self.motor.lastMotorRpm >= 1800 then
      playSample(self.powerSoundId, 1, 1, 0);
      self.powerPlaying = true;
    end;
    
  else
    if self.powerPlaying then
      stopSample(self.powerSoundId);
      self.powerPlaying = false;
    end;
     
  end;
	
	if self.isMotorStarted and self.isEntered then
		if self.motor.speedLevel == 4 then
			self:setAnimationTime(8,self.animationParts[8].animDuration);
			self.two = false;
			self.three = false;
			self.one = false;
			self.sound = true;
		else
			self:setAnimationTime(8,self.animationParts[8].offSet);
			self.sound = false;
		end;
		if self.motor.speedLevel == 3 or Input.isKeyPressed(Input.KEY_w) then
			self:setAnimationTime(7,self.animationParts[7].animDuration);
			self.two = false;
			self.one = false;
			self.four = false;
			self.sound3 = true;
		else
			self:setAnimationTime(7,self.animationParts[7].offSet);
			self.sound3 = false;
		end;
		if self.motor.speedLevel == 2 then
			self:setAnimationTime(6,self.animationParts[6].animDuration);
			self.one = false;
			self.three = false;
			self.four = false;
			self.sound4 = true;
		else
			self:setAnimationTime(6,self.animationParts[6].offSet);
			self.sound4 = false;
		end;
		if self.motor.speedLevel == 1 or Input.isKeyPressed(Input.KEY_s) then
			self:setAnimationTime(5,self.animationParts[5].animDuration);
			self.two = false;
			self.three = false;
			self.four = false;
			self.sound6 = true;
		else
			self:setAnimationTime(5,self.animationParts[5].offSet);
			self.sound6 = false;
		end;
	end;
	 if self.isEntered then                                     
                if Input.isKeyPressed(Input.KEY_s) then
                   self:setAnimationTime(9, self.animationParts[9].currentPosition+(self.animationParts[9].offSet+dt), false);
                   self.sound2 = true;
                   self.sound5 = false;
        elseif 
                   Input.isKeyPressed(Input.KEY_w) or self.motor.speedLevel == 1 or self.motor.speedLevel == 2 or self.motor.speedLevel == 3 or self.motor.speedLevel == 4 then
           self:setAnimationTime(9, self.animationParts[9].currentPosition-(self.animationParts[9].offSet+dt), false);
                   self.sound2 = false;
                   self.sound5 = true;
				   end;
				   
end;
function Ursus1014:updateTick(dt)
end;
end;
end;