Decompiled source of InazumaMoon v1.0.2

InazumaMoon.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using UnityEngine;
using UnityEngine.VFX;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("InazumaMoon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InazumaMoon")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d141fa19-da45-4c18-9716-8faa0902d1a8")]
[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 TeleportPlayers : MonoBehaviour
{
	private StartOfRound startOfRound;

	public Transform teleportPoint;

	public float triggerDistance = 3f;

	public float timeToTeleport = 3f;

	public AudioSource teleportSound;

	private float[] timeNearObject;

	private bool[] soundPlayed;

	private GameObject[] allPlayerObjects;

	private bool hasResetOccurred = false;

	public VisualEffect visualEffect;

	private void Start()
	{
		startOfRound = Object.FindObjectOfType<StartOfRound>();
		if ((Object)(object)startOfRound == (Object)null)
		{
			Debug.LogError((object)"StartOfRound class not found in the scene!");
			return;
		}
		allPlayerObjects = startOfRound.allPlayerObjects;
		timeNearObject = new float[allPlayerObjects.Length];
		soundPlayed = new bool[allPlayerObjects.Length];
		if ((Object)(object)visualEffect != (Object)null)
		{
			visualEffect.Play();
		}
	}

	private void Update()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		if (allPlayerObjects == null)
		{
			return;
		}
		bool flag = false;
		bool flag2 = false;
		for (int i = 0; i < allPlayerObjects.Length; i++)
		{
			GameObject val = allPlayerObjects[i];
			float num = Vector3.Distance(val.transform.position, ((Component)this).transform.position);
			if (num <= triggerDistance)
			{
				flag = true;
				if (!soundPlayed[i])
				{
					PlayTeleportSound();
					soundPlayed[i] = true;
					flag2 = true;
				}
				timeNearObject[i] += Time.deltaTime;
				if (timeNearObject[i] >= timeToTeleport)
				{
					TeleportPlayersInRange();
					break;
				}
			}
			else
			{
				timeNearObject[i] = 0f;
				soundPlayed[i] = false;
			}
		}
		if (flag2 && !hasResetOccurred)
		{
			ResetTimersForAllPlayers();
			hasResetOccurred = true;
		}
		if (!flag)
		{
			hasResetOccurred = false;
		}
	}

	private void TeleportPlayersInRange()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < allPlayerObjects.Length; i++)
		{
			GameObject val = allPlayerObjects[i];
			float num = Vector3.Distance(val.transform.position, ((Component)this).transform.position);
			if (num <= triggerDistance)
			{
				val.transform.position = teleportPoint.position;
				Debug.Log((object)(((Object)val).name + " teleported!"));
			}
		}
		for (int j = 0; j < soundPlayed.Length; j++)
		{
			soundPlayed[j] = false;
		}
		for (int k = 0; k < timeNearObject.Length; k++)
		{
			timeNearObject[k] = 0f;
		}
	}

	private void ResetTimersForAllPlayers()
	{
		for (int i = 0; i < timeNearObject.Length; i++)
		{
			timeNearObject[i] = 0f;
		}
	}

	private void PlayTeleportSound()
	{
		if ((Object)(object)teleportSound != (Object)null)
		{
			teleportSound.Play();
		}
	}
}