-- Main enemy loop

function Enemy:start()
	coroutine.wrap(function()
		self._active = true
		while(self._active) do
			self:_update()
			wait(UPDATE_TIME_INTERVAL)
		end
	end)()
end

function Enemy:stop()
	self._active = false
	self._model.Humanoid.WalkSpeed = 0
end

function Enemy:_destroy()
	self._model:Destroy()
end

function Enemy:_onTouch(otherPart)
	if self._active and CollectionService:HasTag(otherPart, "Platform") then
		hitPlatformEvent:Fire()
		self:stop()
		self:_destroy()
	end
end

return Enemy
