#define DEBUG
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Frostfall;
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("Frostfall")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Atlas Playbook v0.4.1")]
[assembly: AssemblyProduct("Frostfall")]
[assembly: AssemblyCopyright("Copyright © Atlas Playbook v0.4.1 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e8e8ab6d-7d8e-421e-b18e-13d2c0ec3e5a")]
[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")]
public class BlinkingLightSphere : MonoBehaviour
{
public Material sphereMaterial;
public Light sphereLight;
public MeshRenderer sphereRenderer;
public float blinkInterval = 1f;
public Color glowColor = Color.white;
private bool isOn = false;
private float timer = 0f;
private AudioSource audioSource;
public AudioClip lightOnClip;
public AudioClip lightOffClip;
private void Start()
{
if ((Object)(object)sphereRenderer == (Object)null)
{
sphereRenderer = ((Component)this).GetComponent<MeshRenderer>();
}
if ((Object)(object)sphereLight == (Object)null)
{
sphereLight = ((Component)this).GetComponentInChildren<Light>();
}
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)this).GetComponent<AudioSource>();
}
audioSource.spatialBlend = 1f;
}
private void Update()
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
timer += Time.deltaTime;
if (timer >= blinkInterval)
{
isOn = !isOn;
timer = 0f;
if (isOn)
{
sphereMaterial.EnableKeyword("_EMISSION");
sphereMaterial.SetColor("_EmissionColor", glowColor);
sphereLight.intensity = 5f;
((Renderer)sphereRenderer).enabled = true;
PlaySound(lightOnClip);
LogDebug("[BlinkingLightSphere] Light turned ON");
}
else
{
sphereMaterial.DisableKeyword("_EMISSION");
sphereMaterial.SetColor("_EmissionColor", Color.black);
sphereLight.intensity = 0f;
((Renderer)sphereRenderer).enabled = false;
PlaySound(lightOffClip);
LogDebug("[BlinkingLightSphere] Light turned OFF");
}
}
}
private void PlaySound(AudioClip clip)
{
if ((Object)(object)clip != (Object)null && (Object)(object)audioSource != (Object)null)
{
audioSource.PlayOneShot(clip);
}
}
private void LogDebug(string message)
{
if ((Object)(object)ConfigManager.Instance != (Object)null && ConfigManager.Instance.EnableBlinkingDebug.Value)
{
Debug.LogWarning((object)message);
}
}
}
public class BrokenLight : MonoBehaviour
{
private Light flashlight;
private AudioSource audioSource;
private Renderer lightCylinderRenderer;
public float cycleDuration = 3f;
public int flickersPerCycle = 2;
public float minOffDuration = 0.5f;
public float maxOffDuration = 2f;
public bool randomIntensity = true;
public float minIntensity = 0.5f;
public float maxIntensity = 1.5f;
public AudioClip flickerSound;
private void Start()
{
lightCylinderRenderer = ((Component)this).GetComponent<Renderer>();
flashlight = ((Component)this).GetComponentInChildren<Light>();
audioSource = ((Component)flashlight).GetComponent<AudioSource>();
((MonoBehaviour)this).StartCoroutine(FlickerRoutine());
}
private IEnumerator FlickerRoutine()
{
while (true)
{
float timeBetweenFlickers = cycleDuration / (float)flickersPerCycle;
for (int i = 0; i < flickersPerCycle; i++)
{
bool lightEnabled = i % 2 == 0;
((Behaviour)flashlight).enabled = lightEnabled;
if ((Object)(object)lightCylinderRenderer != (Object)null)
{
lightCylinderRenderer.enabled = lightEnabled;
}
if (lightEnabled && (Object)(object)audioSource != (Object)null && (Object)(object)flickerSound != (Object)null)
{
audioSource.pitch = Random.Range(0.9f, 1.1f);
audioSource.PlayOneShot(flickerSound);
}
if (randomIntensity && lightEnabled)
{
flashlight.intensity = Random.Range(minIntensity, maxIntensity);
}
yield return (object)new WaitForSeconds(timeBetweenFlickers);
}
((Behaviour)flashlight).enabled = false;
if ((Object)(object)lightCylinderRenderer != (Object)null)
{
lightCylinderRenderer.enabled = false;
}
yield return (object)new WaitForSeconds(Random.Range(minOffDuration, maxOffDuration));
}
}
}
namespace Frostfall;
[BepInPlugin("com.seeya.frostfall", "Frostfall", "1.0.0")]
public class ConfigManager : BaseUnityPlugin
{
public static ConfigManager Instance { get; private set; }
public ConfigEntry<bool> EnableBlinkingDebug { get; private set; }
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
Object.DontDestroyOnLoad((Object)(object)this);
EnableBlinkingDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "EnableDebug", false, "Toggle debug logs for Frostfall");
Debug.WriteLine("Frostfall loaded.");
}
else
{
Object.Destroy((Object)(object)this);
}
}
}