class 'p03_l02_z01_box'

function p03_l02_z01_box:__init()
 self.objectArr={}
 self.direction=1
 self.state=nil
end

function p03_l02_z01_box:setObjectArr(param)
  self.objectArr=param
end
function p03_l02_z01_box:getObjectArr()
 return  self.objectArr
end

function p03_l02_z01_box:setState(param)
 self.state=param
end
function p03_l02_z01_box:getState()
 return self.state
end

function p03_l02_z01_box:setDirection(param)
 self.direction=param
end
function p03_l02_z01_box:getDirection()
 return self.direction
end



function p03_l02_z01_box:changeState(obj)
 for i=1,#self.objectArr do
  if obj:name()==self.objectArr[i]:name() then
   self.objectArr[i]:hide()
   if self.state==1 then
    self.state=2
    self.direction=1
    self.objectArr[self.state]:show()
    return
   end

   if self.state==2 then
    if self.direction ==1 then
     self.state=3
     self.objectArr[self.state]:show()
    end
    if self.direction ==-1 then
     self.state=1
     self.objectArr[self.state]:show()
    end
    return
   end

   if self.state==3 then
    self.state=2
    self.direction=-1
    self.objectArr[self.state]:show()
    return
   end

  end
 end
end