using System;
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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("QuietMoonPatch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuietMoonPatch")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d9278a0a-5d15-4c69-80a1-18dae02430ea")]
[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 BranchInteract : MonoBehaviour
{
public GameObject branch;
public GameObject brokenBranch;
private GameObject branchInstance;
private GameObject brokenBranchInstance;
private bool spawned;
private float targetTime;
private readonly Quaternion RAND_ROTATION = Quaternion.Euler(0f, (float)BranchRandom.Instance.random.NextDouble() * 360f, 0f);
private static readonly Vector3 VEC_OFFSET = new Vector3(0f, 0.08f, 0f);
private void Start()
{
targetTime = GetRandomTime();
((Component)this).GetComponent<Collider>().enabled = false;
}
private void OnTriggerEnter(Collider other)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
AudioSource val = default(AudioSource);
if (((Component)other).CompareTag("Player") && ((Component)this).TryGetComponent<AudioSource>(ref val))
{
val.Play();
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 80f, 1f, 0, false, 0);
((Component)this).GetComponent<Collider>().enabled = false;
Object.Destroy((Object)(object)branchInstance);
brokenBranchInstance = Object.Instantiate<GameObject>(brokenBranch, ((Component)this).transform.position + VEC_OFFSET, RAND_ROTATION);
}
}
private void Update()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (spawned || !(TimeOfDay.Instance.normalizedTimeOfDay >= targetTime))
{
return;
}
Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 1f);
for (int i = 0; i < array.Length; i++)
{
if (((Component)array[i]).CompareTag("Player"))
{
Debug.Log((object)"Player detected within 1 meter radius!");
return;
}
}
branchInstance = Object.Instantiate<GameObject>(branch, ((Component)this).transform.position + VEC_OFFSET, RAND_ROTATION);
((Component)this).GetComponent<Collider>().enabled = true;
spawned = true;
}
private void OnDestroy()
{
Object.Destroy((Object)(object)branchInstance);
Object.Destroy((Object)(object)brokenBranchInstance);
}
private float GetRandomTime()
{
return (float)Math.Sqrt(BranchRandom.Instance.random.NextDouble());
}
}
public class BranchRandom
{
public static BranchRandom Instance = new BranchRandom();
public Random random;
private const int MAGIC_NUMBER = 117;
private BranchRandom()
{
random = new Random(StartOfRound.Instance.randomMapSeed + 117);
}
}
public class BushInteract : MonoBehaviour
{
public AudioClip[] audioClips;
private const float shakeDuration = 0.3f;
private const float shakeMagnitude = 0.05f;
private Vector3 originalPosition;
private float shakeEndTime;
private void OnTriggerEnter(Collider other)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
AudioSource val = default(AudioSource);
if (((Component)other).CompareTag("Player") && ((Component)this).TryGetComponent<AudioSource>(ref val))
{
val.clip = audioClips[BranchRandom.Instance.random.Next(audioClips.Length)];
val.Play();
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 35f, 0.7f, 0, false, 0);
shakeEndTime = Time.time + 0.3f;
}
}
private void Start()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
originalPosition = ((Component)this).transform.localPosition;
}
private void Update()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (Time.time < shakeEndTime)
{
ShakeBush();
}
else
{
((Component)this).transform.localPosition = originalPosition;
}
}
private void ShakeBush()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Random.insideUnitSphere * 0.05f;
val.y = 0f;
((Component)this).transform.localPosition = originalPosition + val;
}
}