--Autor Lechu & Aranea--

Ursus1614 = {};

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

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

function Ursus1614:draw()
end;

function Ursus1614:delete()
end;

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

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

function Ursus1614: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(4,self.animationParts[4].animDuration);
			self.two = false;
			self.three = false;
			self.one = false;
			self.sound = true;
		else
			self:setAnimationTime(4,self.animationParts[4].offSet);
			self.sound = false;
		end;
		if self.motor.speedLevel == 3 or Input.isKeyPressed(Input.KEY_w) then
			self:setAnimationTime(3,self.animationParts[3].animDuration);
			self.two = false;
			self.one = false;
			self.four = false;
			self.sound3 = true;
		else
			self:setAnimationTime(3,self.animationParts[3].offSet);
			self.sound3 = false;
		end;
		if self.motor.speedLevel == 2 then
			self:setAnimationTime(2,self.animationParts[2].animDuration);
			self.one = false;
			self.three = false;
			self.four = false;
			self.sound4 = true;
		else
			self:setAnimationTime(2,self.animationParts[2].offSet);
			self.sound4 = false;
		end;
		if self.motor.speedLevel == 1 or Input.isKeyPressed(Input.KEY_s) then
			self:setAnimationTime(1,self.animationParts[1].animDuration);
			self.two = false;
			self.three = false;
			self.four = false;
			self.sound6 = true;
		else
			self:setAnimationTime(1,self.animationParts[1].offSet);
			self.sound6 = false;
		end;
	end;
	 if self.isEntered then                                     
                if Input.isKeyPressed(Input.KEY_s) then
                   self:setAnimationTime(5, self.animationParts[5].currentPosition+(self.animationParts[5].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(5, self.animationParts[5].currentPosition-(self.animationParts[5].offSet+dt), false);
                   self.sound2 = false;
                   self.sound5 = true;
				   end;
				   
end;
end;			
function Ursus1614:updateTick(dt)
end;
end;