public void Update()
 {
     if (manager == null)
     {
         return;
     }
     if (Entry == null)
     {
         Entry = manager.GetEntry(Sound);
     }
     if (Active)
     {
         if (Entry.Range.Y > 0 && (VectorMath.Distance(manager.ListenerPosition, Position) > Entry.Range.Y))
         {
             EnsureStopped();
         }
         else
         {
             TryMakeActive();
         }
     }
     else
     {
         EnsureStopped();
     }
     //Update properties
     if (Instance != null)
     {
         Instance.SetPosition(Position);
         Instance.SetPitch(Pitch);
     }
 }
 void TryMakeActive()
 {
     if (Instance == null)
     {
         Instance = manager.PlaySound(Sound, true, Entry.Attenuation, -1, -1, Position);
         Instance.SetPitch(Pitch);
     }
 }
 void TryMakeActive()
 {
     if (Instance == null)
     {
         Instance = manager.GetInstance(Sound, Entry.Attenuation, -1, 1, Position);
         if (Instance != null)
         {
             Instance.SetPitch(Pitch);
             Instance.Play(true);
         }
     }
 }
 void TryMakeActive()
 {
     if (PlayOnce && Played)
     {
         return;
     }
     if (Instance == null)
     {
         Instance = manager.GetInstance(Sound, Entry.Attenuation, -1, 1, Position);
         if (Instance != null)
         {
             Instance.SetPitch(Pitch);
             Instance.Play(!PlayOnce);
             Played = true;
         }
     }
 }
 public void Update()
 {
     if (manager == null)
     {
         return;
     }
     if (Entry == null)
     {
         Entry = manager.GetEntry(Sound);
     }
     if (Active)
     {
         if (Entry.Range.Y > 0 && (Vector3.Distance(manager.ListenerPosition, Position) > Entry.Range.Y))
         {
             EnsureStopped();
         }
         else
         {
             TryMakeActive();
         }
         if (PlayOnce && Played && !(Instance?.Playing ?? false))
         {
             EnsureStopped();
             Active = false;
         }
     }
     else
     {
         EnsureStopped();
     }
     //Update properties
     if (Instance != null)
     {
         Instance.SetPosition(Position);
         Instance.SetVelocity(Velocity);
         Instance.SetAttenuation(Attenuation);
         Instance.SetPitch(Pitch);
         Instance.UpdateProperties();
     }
 }