#include "script/common.lua"

function init()
	trigger = FindTrigger()
end


function tick(dt)
	local maxDist = 40
	local dist = GetTriggerDistance(trigger, GetCameraTransform().pos)
	local vol = clamp(dist/maxDist, 0.3, 1.0)
	if vol < 1.0 then
		SetFloat("game.music.volume", vol)
	end
end

