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); } }
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(); } }