using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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("AmbianceLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AmbianceLib")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4306780b-0b0d-46e6-9551-509cf65b4793")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AmbianceLib;
[BepInPlugin("com.zepsun.AmbianceLib", "AmbianceLib", "1.0.0")]
public class AmbianceLibPlugin : BaseUnityPlugin
{
private const string MyGUID = "com.zepsun.AmbianceLib";
private const string PluginName = "AmbianceLib";
private const string VersionString = "1.0.0";
public static ManualLogSource Log = new ManualLogSource("AmbianceLib");
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: AmbianceLib, VersionString: 1.0.0 is loading...");
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: AmbianceLib, VersionString: 1.0.0 is loaded!! zepsun on Discord for help!");
Log = ((BaseUnityPlugin)this).Logger;
}
}
public class IntermittentAudio : MonoBehaviour
{
public AudioSource objAudioSource;
public float minWaitBetweenPlays = 75f;
public float maxWaitBetweenPlays = 140f;
public float waitTimeCountdown = 30f;
public bool playDuringWeather = false;
private void Start()
{
Debug.Log((object)"Ambiance Script Initialized. zepsun on Discord for help.");
Debug.Log((object)("Settings: minWaitBetweenPlays: " + minWaitBetweenPlays + ", maxWaitBetweenPlays: " + maxWaitBetweenPlays + ", waitTimeCountdown: " + waitTimeCountdown + ", playDuringWeather: " + playDuringWeather));
}
private void Update()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
if (playDuringWeather && (int)TimeOfDay.Instance.currentLevelWeather == -1)
{
RandomizeSound();
}
else if (!playDuringWeather)
{
RandomizeSound();
}
}
private void RandomizeSound()
{
if (waitTimeCountdown < 0f)
{
Debug.Log((object)"Playing Ambiance");
objAudioSource.Play();
waitTimeCountdown = Random.Range(minWaitBetweenPlays, maxWaitBetweenPlays);
}
else
{
waitTimeCountdown -= Time.deltaTime;
}
}
}