using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SoundDestroy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SoundDestroy")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f707df40-0c2b-4ba0-bfba-73eeef2369d1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
public class PlaySoundBeforeDestroy : MonoBehaviour
{
private AudioSource audioSource;
private bool isDestroying = false;
private void Start()
{
audioSource = ((Component)this).GetComponent<AudioSource>();
if ((Object)(object)audioSource == (Object)null)
{
Debug.LogError((object)("No AudioSource found on " + ((Object)((Component)this).gameObject).name));
}
}
private void OnDestroy()
{
if (!isDestroying && (Object)(object)audioSource != (Object)null)
{
isDestroying = true;
PlaySoundAndDestroy();
}
}
private void PlaySoundAndDestroy()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)audioSource.clip != (Object)null)
{
AudioSource.PlayClipAtPoint(audioSource.clip, ((Component)this).transform.position, audioSource.volume);
}
}
}