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.Logging;
using HarmonyLib;
using Unity.Netcode;
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("MarioBrosLevilOne")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MarioBrosLevilOne")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3593610-4531-4f7f-ad3d-ea1d42ba1b04")]
[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 MarioBrosLevelOne;
[BepInPlugin("MadBear422.MarioBrosLevelOne", "Super Mario Bros. World 1 Level 1", "1.0.0")]
public class MarioBrosLevelOne : BaseUnityPlugin
{
private const string modGUID = "MadBear422.MarioBrosLevelOne";
private const string modName = "Super Mario Bros. World 1 Level 1";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("MadBear422.MarioBrosLevelOne");
private static MarioBrosLevelOne Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = null;
}
mls = Logger.CreateLogSource("MadBear422.MarioBrosLevelOne");
mls.LogInfo((object)"Super Mario Bros. World 1-1 Dependency Is Active");
harmony.PatchAll(typeof(MarioBrosLevelOne));
}
}
public class CollapsePanel : NetworkBehaviour
{
public float scaleDuration = 4.5f;
public AudioSource panelAudio;
public AudioClip shrinkSFX;
public AudioClip vanishSFX;
private bool isActivated = false;
private void OnTriggerEnter(Collider other)
{
if (((Component)other).gameObject.CompareTag("Player") && !isActivated)
{
((MonoBehaviour)this).StartCoroutine(ScaleDownAndDestroy());
}
}
private IEnumerator ScaleDownAndDestroy()
{
Vector3 initialScale = ((Component)this).transform.localScale;
float elapsedTime = 0f;
isActivated = true;
panelAudio.PlayOneShot(shrinkSFX);
while (elapsedTime < scaleDuration)
{
((Component)this).transform.localScale = Vector3.Lerp(initialScale, Vector3.zero, elapsedTime / scaleDuration);
elapsedTime += Time.deltaTime;
yield return null;
}
((Component)this).transform.localScale = Vector3.zero;
panelAudio.PlayOneShot(vanishSFX);
yield return (object)new WaitForSeconds(2f);
((Component)this).GetComponent<NetworkObject>().Despawn(true);
}
}
public class RotatePanel : NetworkBehaviour
{
public GameObject parent;
public float rotationSpeed = 30f;
private bool shouldRotate = false;
private void OnTriggerEnter(Collider other)
{
if (((Component)other).gameObject.CompareTag("Player"))
{
shouldRotate = true;
}
}
private void Update()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
if (shouldRotate)
{
parent.transform.Rotate(Vector3.right, rotationSpeed * Time.deltaTime);
}
}
}
internal class MarioCoin : NetworkBehaviour
{
public AudioSource audioSource;
public AudioClip collectCoinSFX;
public int scrapValue = 10;
public float rotationSpeed = 30f;
private bool isCollected = false;
private void OnTriggerEnter(Collider other)
{
if (((Component)other).gameObject.CompareTag("Player") && !isCollected)
{
((MonoBehaviour)this).StartCoroutine(CollectCoin());
}
}
private void Update()
{
((Component)this).transform.Rotate(0f, rotationSpeed * Time.deltaTime, 0f);
}
private IEnumerator CollectCoin()
{
isCollected = true;
audioSource.PlayOneShot(collectCoinSFX);
((Renderer)((Component)this).GetComponent<MeshRenderer>()).enabled = false;
Terminal obj = Object.FindObjectOfType<Terminal>();
obj.groupCredits += scrapValue;
TimeOfDay instance = TimeOfDay.Instance;
instance.quotaFulfilled += scrapValue;
TimeOfDay.Instance.UpdateProfitQuotaCurrentTime();
yield return (object)new WaitForSeconds(2f);
((Component)this).GetComponent<NetworkObject>().Despawn(true);
}
}