Decompiled source of TheFuneralOfTheDeadButterflies v0.8.1

ButterflyScripts.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("NobodyButAlex")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ButterflyScripts")]
[assembly: AssemblyTitle("ButterflyScripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class AttackEffect : MonoBehaviour
{
	private Image im;

	private float timer;

	public float maxTime;

	private void Start()
	{
	}

	public void StartTimer()
	{
		timer = maxTime;
		im = ((Component)this).GetComponent<Image>();
	}

	private void Update()
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: 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)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		timer -= Time.deltaTime;
		if (timer < 0f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		else
		{
			((Graphic)im).color = new Color(((Graphic)im).color.r, ((Graphic)im).color.g, ((Graphic)im).color.b, timer / maxTime);
		}
	}
}
public struct BezierCurve
{
	public Vector3 A;

	public Vector3 B;

	public Vector3 C;

	public Vector3 D;

	public float timeLength;

	public BezierCurve(Vector3 A, Vector3 B, Vector3 C, Vector3 D, float timeLength)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		this.A = A;
		this.B = B;
		this.C = C;
		this.D = D;
		this.timeLength = timeLength;
	}

	public Vector3 PosAtTime(float time)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		float num = time / timeLength;
		Vector3 val = A + (B - A) * num;
		Vector3 val2 = B + (C - B) * num;
		Vector3 val3 = C + (D - C) * num;
		Vector3 val4 = val + (val2 - val) * num;
		Vector3 val5 = val2 + (val3 - val2) * num;
		return val4 + (val5 - val4) * num;
	}
}
public class EnemyDeadButterfly : MonoBehaviour
{
	public enum State
	{
		Spawn,
		Idle,
		CreatingPath,
		MovingByCurve,
		MovingStraight,
		Grabbed
	}

	public State currentState;

	public Transform EnemyParent;

	public NavMeshSurface surf;

	public PlayerAvatar targetPlayer;

	private Vector3 direction;

	private Grid3D mainGrid;

	private Queue<BezierCurve> curves = new Queue<BezierCurve>();

	private BezierCurve currentCurve = new BezierCurve(Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero, 0f);

	private int currentWay;

	public GameObject attackEffect;

	private List<Vector3> _path;

	private float timerPath;

	public ParticleSystem noticeParticle;

	public float timeForOneMove;

	private float timerUnseen;

	public float timerUnseenMax;

	private bool grabbed;

	public GameObject pointLook;

	private bool stateImpulse;

	private float stateTimer;

	private State attackMoveState;

	[Space]
	public Enemy enemy;

	public Transform followOffsetTransform;

	public Animator flyingAnim;

	private PhotonView photonView;

	internal int directorIndex;

	[Space]
	public SpringQuaternion rotationSpring;

	private Quaternion rotationTarget;

	[Space]
	public float speed = 1f;

	private float moveOffsetTimer;

	private float moveOffsetSetTimer;

	private Vector3 moveOffsetPosition;

	private float attackAngle;

	private Vector3 moveBackPosition;

	private float moveBackTimer;

	private bool visionPrevious;

	private float visionTimer;

	internal float attackCooldown;

	private float idleBreakerTimer;

	internal float overlapCheckTimer;

	internal float overlapCheckCooldown;

	internal bool overlapCheckPrevious;

	[Space]
	public ParticleSystem[] deathEffects;

	[Space]
	public Sound soundHurt;

	public Sound soundDeath;

	[Space]
	public Sound soundImpactLight;

	public Sound soundImpactMedium;

	public Sound soundImpactHeavy;

	private void Awake()
	{
		enemy = ((Component)this).GetComponent<Enemy>();
	}

	private Vector3 GetPlayerHitboxCenter(GameObject player)
	{
		//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)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		Bounds bounds = player.GetComponent<Collider>().bounds;
		return ((Bounds)(ref bounds)).center;
	}

	private void Update()
	{
		if ((GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) || !LevelGenerator.Instance.Generated)
		{
			return;
		}
		if (grabbed && currentState != State.Grabbed)
		{
			flyingAnim.StartPlayback();
		}
		if (!IsPlayerVisible(out direction))
		{
			timerUnseen += Time.deltaTime;
			if (timerUnseen > 8f)
			{
				targetPlayer = null;
				if (currentState == State.CreatingPath)
				{
					UpdateState(State.Idle);
				}
			}
		}
		else
		{
			timerUnseen = 0f;
		}
		switch (currentState)
		{
		case State.Idle:
			break;
		case State.Spawn:
			StateSpawn();
			break;
		case State.CreatingPath:
			CreatingPath();
			break;
		case State.MovingByCurve:
			MovingByCurve();
			break;
		case State.MovingStraight:
			MovingStraight();
			break;
		case State.Grabbed:
			StateGrabbed();
			break;
		}
	}

	private void StateGrabbed()
	{
		if (!grabbed)
		{
			grabbed = true;
			flyingAnim.StopPlayback();
		}
	}

	private void StateSpawn()
	{
		if (!SemiFunc.IsMasterClientOrSingleplayer() || SemiFunc.EnemySpawn(enemy))
		{
		}
		mainGrid = GameObject.Find("Grid3D").GetComponent<Grid3D>();
		mainGrid.StartUp();
		flyingAnim.Play("BUTTERFLY", 0);
		UpdateState(State.Idle);
	}

	public void OnVision()
	{
		if (currentState != State.MovingStraight && currentState != State.CreatingPath)
		{
			targetPlayer = enemy.Vision.onVisionTriggeredPlayer;
			noticeParticle.Play();
			timerUnseen = 0f;
			UpdateState(State.MovingStraight);
		}
	}

	private void UpdateState(State state)
	{
		if (currentState != state)
		{
			currentState = state;
			stateImpulse = true;
			stateTimer = 0f;
			if (GameManager.Multiplayer())
			{
				photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState });
			}
			else
			{
				UpdateStateRPC(currentState);
			}
		}
	}

	[PunRPC]
	private void UpdateStateRPC(State _state)
	{
		currentState = _state;
		if (currentState == State.Spawn)
		{
			flyingAnim.Play("BUTTERFLY", 0);
		}
	}

	private void CreatingPath()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		enemy.Rigidbody.followTarget.position = enemy.CenterTransform.position;
		Vector3 cellSize = mainGrid.cellSize;
		Vector3 gridOffset = mainGrid.gridOffset;
		Vector3 position = targetPlayer.PlayerVisionTarget.VisionTransform.position;
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor((float)Mathf.RoundToInt((((Component)enemy.Rigidbody.followTarget).transform.position.x - gridOffset.x) / cellSize.x), (float)Mathf.RoundToInt((((Component)enemy.Rigidbody.followTarget).transform.position.y - gridOffset.y) / cellSize.y), (float)Mathf.RoundToInt((((Component)enemy.Rigidbody.followTarget).transform.position.z - gridOffset.z) / cellSize.z));
		Vector3 val2 = default(Vector3);
		((Vector3)(ref val2))..ctor((float)Mathf.RoundToInt((position.x - gridOffset.x) / cellSize.x), (float)Mathf.RoundToInt((position.y - gridOffset.y) / cellSize.y), (float)Mathf.RoundToInt((position.z - gridOffset.z) / cellSize.z));
		_path = null;
		_path = mainGrid.Path(val, val2);
		if (_path != null)
		{
			for (int i = 0; i < _path.Count; i++)
			{
				_path[i] = gridOffset + new Vector3(_path[i].x * cellSize.x, _path[i].y * cellSize.y, _path[i].z * cellSize.z);
			}
			UpdateState(State.MovingByCurve);
			currentWay = 0;
		}
		else
		{
			UpdateState(State.Idle);
		}
	}

	private void MovingByCurve()
	{
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		timerPath += Time.deltaTime;
		while (timerPath > timeForOneMove)
		{
			timerPath -= timeForOneMove;
			currentWay++;
			if (currentWay > _path.Count - 2)
			{
				UpdateState(State.Idle);
				return;
			}
		}
		enemy.Rigidbody.followTarget.position = _path[currentWay] + (_path[currentWay + 1] - _path[currentWay]) * (timerPath / timeForOneMove);
		enemy.Rigidbody.followTarget.rotation = Quaternion.LookRotation(_path[currentWay + 1] - _path[currentWay]);
	}

	private void MovingStraight()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		if (timerUnseen == 0f)
		{
			pointLook.transform.position = targetPlayer.PlayerVisionTarget.VisionTransform.position;
			Transform followTarget = enemy.Rigidbody.followTarget;
			Vector3 position = followTarget.position;
			Vector3 val = targetPlayer.PlayerVisionTarget.VisionTransform.position - enemy.Rigidbody.followTarget.position;
			followTarget.position = position + ((Vector3)(ref val)).normalized * speed;
			enemy.Rigidbody.followTarget.rotation = Quaternion.LookRotation(direction);
		}
		else if (timerUnseen > timerUnseenMax)
		{
			UpdateState(State.CreatingPath);
		}
	}

	public void OnTouchPlayer()
	{
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		PlayerAvatar onTouchPlayerAvatar = enemy.Rigidbody.onTouchPlayerAvatar;
		if ((Object)(object)onTouchPlayerAvatar == (Object)(object)targetPlayer)
		{
			onTouchPlayerAvatar.playerHealth.Hurt(onTouchPlayerAvatar.playerHealth.health / 2, false, SemiFunc.EnemyGetIndex(enemy));
			if (onTouchPlayerAvatar.isLocal)
			{
				GameObject val = Object.Instantiate<GameObject>(attackEffect);
				GameObject val2 = GameObject.Find("HUD Canvas");
				val.transform.SetParent(val2.transform);
				val.GetComponent<RectTransform>().sizeDelta = val2.GetComponent<RectTransform>().sizeDelta;
				val.GetComponent<AttackEffect>().StartTimer();
				val.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
				enemy.EnemyParent.Despawn();
			}
		}
	}

	private bool IsPlayerVisible(out Vector3 direction)
	{
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: 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)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)targetPlayer != (Object)null)
		{
			direction = targetPlayer.PlayerVisionTarget.VisionTransform.position - enemy.CenterTransform.position;
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(enemy.CenterTransform.position, direction, ref val, ((Vector3)(ref direction)).magnitude, LayerMask.GetMask(new string[2] { "Default", "Player" })) && ((Component)((RaycastHit)(ref val)).transform).tag == "Player")
			{
				return true;
			}
			return false;
		}
		Quaternion rotation = enemy.Rigidbody.followTarget.rotation;
		direction = ((Quaternion)(ref rotation)).eulerAngles;
		return false;
	}
}
namespace ButterflyScripts
{
	[BepInPlugin("NobodyButAlex.ButterflyScripts", "ButterflyScripts", "1.0")]
	public class ButterflyScripts : BaseUnityPlugin
	{
		internal static ButterflyScripts Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}