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.IgnoreSymbolStoreSequencePoints)]
[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;
private float timer;
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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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 flag = i % 2 == 0;
((Behaviour)flashlight).enabled = flag;
if ((Object)(object)lightCylinderRenderer != (Object)null)
{
lightCylinderRenderer.enabled = flag;
}
if (flag && (Object)(object)audioSource != (Object)null && (Object)(object)flickerSound != (Object)null && ((Behaviour)audioSource).isActiveAndEnabled)
{
audioSource.pitch = Random.Range(0.9f, 1.1f);
audioSource.PlayOneShot(flickerSound);
}
if (randomIntensity && flag)
{
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));
}
}
}
public class IceBreak : MonoBehaviour
{
public float timeToBreak = 10f;
public float timeToStartCracking = 5f;
public AudioSource breakingSound;
public GameObject fracturedIcePrefab;
private float playerTimeOnIce;
private bool isPlayerOnIce;
private bool isCrackingSoundPlaying;
private bool isBroken;
private void OnTriggerEnter(Collider other)
{
if (((Component)other).CompareTag("Player"))
{
isPlayerOnIce = true;
}
}
private void OnTriggerExit(Collider other)
{
if (((Component)other).CompareTag("Player"))
{
isPlayerOnIce = false;
playerTimeOnIce = 0f;
StopCrackingSound();
}
}
private void Update()
{
if (isPlayerOnIce && !isBroken)
{
playerTimeOnIce += Time.deltaTime;
if (playerTimeOnIce >= timeToStartCracking && !isCrackingSoundPlaying)
{
PlayCrackingSound();
}
if (playerTimeOnIce >= timeToBreak)
{
BreakIce();
}
}
}
private void PlayCrackingSound()
{
if ((Object)(object)breakingSound != (Object)null)
{
breakingSound.Play();
isCrackingSoundPlaying = true;
}
}
private void StopCrackingSound()
{
if ((Object)(object)breakingSound != (Object)null)
{
breakingSound.Stop();
isCrackingSoundPlaying = false;
}
}
private void BreakIce()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
isBroken = true;
StopCrackingSound();
if ((Object)(object)fracturedIcePrefab != (Object)null)
{
Object.Instantiate<GameObject>(fracturedIcePrefab, ((Component)this).transform.position, ((Component)this).transform.rotation);
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
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");
}
else
{
Object.Destroy((Object)(object)this);
}
}
}