
dofile( "../../Assets/Scripts/util_math.lua" ) 


local Aster = Player:gAster()

local PLAYER_DIST = 200
local OK_GO = false


while( 1 )
do
  coroutine.yield()
  
  -- this is an EPIC hack
  local dist = vec3.magnitude( vec3.subtract( Aster:SHR_gPosition(), Entity:SHR_gPosition() ) )
  if( not OK_GO ) and
    ( dist < PLAYER_DIST ) 
  then
    OK_GO = true
    Global:MusicLayer( 9, 2, "9" )
  
  elseif( OK_GO ) and
    ( dist > PLAYER_DIST ) 
  then
    OK_GO = false
    Global:MusicLayer( 9, 3, "9" )
    
  end

end
