
function AISMN_GoNearObject::OnEnter(%this,%obj)
{
   if (!SetPathForNearObject(%obj,GetParameterTarget(%obj)))
   {
      SetStateVariable(%obj, 0, 1);
      return;
   }
   
   GetThisObject(%obj).playThread( 0, "run");
}

function AISMN_GoNearObject::OnExit(%this,%obj)
{
   GetThisObject(%obj).playThread( 0, "root");
}

//EXIT 0: CANNOT PATH TO OBJECT
//EXIT 1: NEAR OBJECT
function AISMN_GoNearObject::Update(%this,%obj)
{
   if (GetStateVariable(%obj, 0) > 0)
   {
      ReturnValue(%obj, 0);
      return;
   }
   
   if (!IsFollowingPath(%obj))
   {
      ReturnValue(%obj, 1);
      return;
   }
   
   ReturnValue(%obj, -1);
}
