Decompiled source of MoreInteriors v2.5.0

MoreInteriors/MoreInteriorsDunGen.dll

Decompiled 10 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen.Graph;
using HarmonyLib;
using LethalLevelLoader;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AI;

[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: AssemblyCompany("MoreInteriorsDunGen")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("MoreInteriorsDunGen")]
[assembly: AssemblyTitle("MoreInteriorsDunGen")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreInteriorsDunGen
{
	[BepInPlugin("MoreInteriors", "MoreInteriors", "2.5.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MoreInteriorsDunGen : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Object))]
		private class ItemGroupPatch
		{
			[HarmonyPatch("Equals")]
			[HarmonyPrefix]
			public static bool FixItemGroupEquals(ref bool __result, object __instance, object other)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				ItemGroup val = (ItemGroup)((__instance is ItemGroup) ? __instance : null);
				if ((Object)(object)val != (Object)null)
				{
					ItemGroup val2 = (ItemGroup)((other is ItemGroup) ? other : null);
					if ((Object)(object)val2 != (Object)null)
					{
						__result = val.itemSpawnTypeName == val2.itemSpawnTypeName;
						return false;
					}
				}
				return true;
			}
		}

		private readonly Harmony harmony = new Harmony("MoreInteriors");

		public static MoreInteriorsDunGen Instance;

		public GameObject netManagerPrefab;

		internal ManualLogSource mls;

		public static AssetBundle BunkerAssets;

		private ConfigEntry<int> configBunkerRarity;

		private ConfigEntry<string> configBunkerMoons;

		private ConfigEntry<string> configBunkerMoonsList;

		private ConfigEntry<bool> configGuaranteedBunker;

		private ConfigEntry<int> configLengthOverride;

		private ConfigEntry<int> configOutpost31Rarity;

		private string[] configBunkerMoonsValues = new string[1] { "list" };

		public GameObject energyCorePrefab;

		public GameObject energyCorePrefabTurnedOff;

		public GameObject EnergyCores;

		public GameObject Rat;

		public GameObject RatSpawn;

		private void Awake()
		{
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Expected O, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Expected O, but got Unknown
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Expected O, but got Unknown
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Expected O, but got Unknown
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Expected O, but got Unknown
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Expected O, but got Unknown
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Expected O, but got Unknown
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Expected O, but got Unknown
			//IL_0691: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Expected O, but got Unknown
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
						mls.LogInfo((object)"Invoked method with RuntimeInitializeOnLoadMethodAttribute");
					}
				}
			}
			mls = Logger.CreateLogSource("MoreInteriorsDunGen");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			BunkerAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "moreinterior_dungen"));
			if ((Object)(object)BunkerAssets == (Object)null)
			{
				mls.LogError((object)"Failed to load Bunker Dungeon assets.");
			}
			else
			{
				mls.LogInfo((object)"Bunker Assets loaded successfully");
			}
			DungeonFlow val = BunkerAssets.LoadAsset<DungeonFlow>("assets/lethalbunker/bunker data/bunkerflow.asset");
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load Bunker Dungeon Flow.");
			}
			AudioClip val2 = BunkerAssets.LoadAsset<AudioClip>("Assets/LethalBunker/ScrapPrefabs/AnimateClips/Bunker Entrance.ogg");
			if ((Object)(object)val2 == (Object)null)
			{
				mls.LogError((object)"Failed to load Bunker Dungeon Flow.");
			}
			else
			{
				mls.LogInfo((object)"Was loaded was called");
			}
			configBunkerRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Bunker Interior", "BunkerRarity", 150, new ConfigDescription("The chance that the bunker tileset will be chosen. The higher the value, the higher the chance. By default, the bunker will appear on valid moons with a roughly one in two chance.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 99999), Array.Empty<object>()));
			configBunkerMoons = ((BaseUnityPlugin)this).Config.Bind<string>("Bunker Interior", "BunkerMoons", "list", new ConfigDescription("Use 'list' to specify a custom list of moons for the bunker to appear on. Individual moons can be added to the list by editing the BunkerDungeonMoonsList config entry.", (AcceptableValueBase)(object)new AcceptableValueList<string>(configBunkerMoonsValues), Array.Empty<object>()));
			configBunkerMoonsList = ((BaseUnityPlugin)this).Config.Bind<string>("Bunker Interior", "BunkerDungeonMoonsList", "March,Offense", new ConfigDescription("Note: Requires 'BunkerMoons' to be set to 'list'. \nCan be used to specify a list of moons with individual rarities for moons to spawn on. \nRarity values will override the default rarity value provided in Bunker Rarity and will override BunkerGuaranteed. To guarantee dungeon spawning on a moon, assign arbitrarily high rarity value (e.g.  99999). \nMoons and rarities should be provided as a comma-separated list in the following format: 'Name:Rarity' Example: March:150,Offense:150 \nNote: Moon names are checked by string matching, i.e. the moon name 'dine' would enable spawning on 'dine', 'diner' and 'undine'. Be careful with modded moon names.", (AcceptableValueBase)null, Array.Empty<object>()));
			configGuaranteedBunker = ((BaseUnityPlugin)this).Config.Bind<bool>("Bunker Interior", "BunkerGuaranteed", false, new ConfigDescription("If enabled, the bunker will be effectively guaranteed to spawn. Only recommended for debugging/sightseeing purposes.", (AcceptableValueBase)null, Array.Empty<object>()));
			configLengthOverride = ((BaseUnityPlugin)this).Config.Bind<int>("Bunker Length", "BunkerLengthOverride", -1, new ConfigDescription(string.Format("if not -1, Overrides the Bunker length to what you set. 1 = 1 times big. 2 = twice as big. and so and so forth ", "2.5.0", val.Length.Min), (AcceptableValueBase)null, Array.Empty<object>()));
			configOutpost31Rarity = ((BaseUnityPlugin)this).Config.Bind<int>("Outpost 31", "Outpost31Rarity", 99999, new ConfigDescription("Rarity at which the bunker appears on Outpost31. Lower this value to decrease the frequency of bunkers spawning on this moon. To ensure that the bunker spawns on Outpost31, do not set a value lower than  99999.", (AcceptableValueBase)null, Array.Empty<object>()));
			if (configLengthOverride.Value != -1)
			{
				mls.LogInfo((object)$"Bunker Length Override has been set to {configLengthOverride.Value}. Be careful with this value");
				val.Length.Min = configLengthOverride.Value;
				val.Length.Max = configLengthOverride.Value;
			}
			ExtendedDungeonFlow val3 = ScriptableObject.CreateInstance<ExtendedDungeonFlow>();
			val3.contentSourceName = "MoreInteriors";
			val3.dungeonFlow = val;
			val3.dungeonFirstTimeAudio = val2;
			val3.dungeonDefaultRarity = 0;
			int num = (configGuaranteedBunker.Value ? 99999 : configBunkerRarity.Value);
			int num2 = (configGuaranteedBunker.Value ? 99999 : configOutpost31Rarity.Value);
			if (configBunkerMoons.Value.ToLowerInvariant() == "all")
			{
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num));
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", num));
				mls.LogInfo((object)"Registered Bunker Interior on all Moons, Includes Modded Moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "vanilla")
			{
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num));
				mls.LogInfo((object)"Registered Bunker Interior on all vanilla moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "modded")
			{
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", num));
				mls.LogInfo((object)"Registered Bunker Interior on all modded moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "paid")
			{
				val3.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(1f, 9999f), num));
				mls.LogInfo((object)"Registered Bunker Interior on all paid moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "free")
			{
				val3.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(0f, 0f), num));
				mls.LogInfo((object)"Registered Bunker Interior on all free moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "list" && configBunkerMoonsList.Value != null)
			{
				string[] array3 = configBunkerMoonsList.Value.Split(',');
				string[] array4 = array3;
				foreach (string text in array4)
				{
					StringWithRarity val4 = ParseMoonString(text, num);
					if (val4 != null)
					{
						val3.manualPlanetNameReferenceList.Add(val4);
						mls.LogInfo((object)$"Registered Bunker Interior on moon name {val4.Name} with rarity {val4.Rarity}");
						continue;
					}
					if (val4 == null)
					{
						mls.LogWarning((object)"No moon Added to list value!");
					}
					val3.manualPlanetNameReferenceList.Add(new StringWithRarity(text, num));
				}
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Outpost 31", num2));
				mls.LogInfo((object)$"Registered Bunker Interior on moon name Outpost 31 with rarity {num2}");
			}
			else
			{
				mls.LogError((object)"Invalid 'BunkerDungeonMoons' config value! ");
			}
			PatchedContent.RegisterExtendedDungeonFlow(val3);
			mls.LogInfo((object)"Loaded Extended DungeonFlow");
			val3.dungeonSizeMin = 1f;
			val3.dungeonSizeMax = 1f;
			val3.dungeonSizeLerpPercentage = 0f;
			harmony.PatchAll(typeof(MoreInteriorsDunGen));
			harmony.PatchAll(typeof(Object));
			harmony.PatchAll(typeof(StartOfRound));
			Item val5 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/Bunker Data/EnergyCore.asset");
			Items.RegisterItem(val5);
			NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
			Object.Instantiate<Item>(val5);
			if ((Object)(object)val5 == (Object)null)
			{
				mls.LogError((object)"EnergyCore is null");
			}
			energyCorePrefab = BunkerAssets.LoadAsset<GameObject>("Assets/LethalBunker/Prefab Pieces/EnergyCore.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(energyCorePrefab);
			if ((Object)(object)energyCorePrefab == (Object)null)
			{
				mls.LogError((object)"energyCorePrefab is null");
			}
			energyCorePrefabTurnedOff = BunkerAssets.LoadAsset<GameObject>("Assets/LethalBunker/Prefab Pieces/EnergyCoreTurnedoff.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(energyCorePrefab);
			if ((Object)(object)energyCorePrefabTurnedOff == (Object)null)
			{
				mls.LogError((object)"energyCorePrefabTurnedOff is null");
			}
			Rat = BunkerAssets.LoadAsset<GameObject>("Assets/LethalBunker/Ai Scripting/Rats/RatEntityAI.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(Rat);
			if ((Object)(object)Rat == (Object)null)
			{
				mls.LogError((object)"Rat is null");
			}
			int num3 = 1;
			Item val6 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/ArmyHelmet.asset");
			mls.LogInfo((object)val6);
			if ((Object)(object)val6 == (Object)null)
			{
				mls.LogError((object)"Failed to load ArmyHelmet asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
			if ((Object)(object)val6.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register ArmyHelmet spawn prefab.");
				return;
			}
			Items.RegisterScrap(val6, num3, (LevelTypes)(-1));
			if ((Object)(object)val6 == (Object)null)
			{
				mls.LogError((object)"Failed to register ArmyHelmet item.");
				return;
			}
			int num4 = 1;
			Item val7 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/ArmyCanteen.asset");
			mls.LogInfo((object)val7);
			if ((Object)(object)val7 == (Object)null)
			{
				mls.LogError((object)"Failed to load Canteen asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab);
			if ((Object)(object)val7.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register Canteen spawn prefab.");
				return;
			}
			Items.RegisterScrap(val7, num4, (LevelTypes)(-1));
			if ((Object)(object)val7 == (Object)null)
			{
				mls.LogError((object)"Failed to register Canteen item.");
				return;
			}
			int num5 = 1;
			Item val8 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/Gramophone.asset");
			mls.LogInfo((object)val8);
			if ((Object)(object)val8 == (Object)null)
			{
				mls.LogError((object)"Failed to load Gramophone asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			if ((Object)(object)val8.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register Gramophone spawn prefab.");
				return;
			}
			Items.RegisterScrap(val8, num5, (LevelTypes)(-1));
			if ((Object)(object)val8 == (Object)null)
			{
				mls.LogError((object)"Failed to register Gramophone item.");
				return;
			}
			int num6 = 1;
			Item val9 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/OldRadio.asset");
			mls.LogInfo((object)val9);
			if ((Object)(object)val9 == (Object)null)
			{
				mls.LogError((object)"Failed to load OldRadio asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			if ((Object)(object)val9.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register OldRadio spawn prefab.");
				return;
			}
			Items.RegisterScrap(val9, num6, (LevelTypes)(-1));
			if ((Object)(object)val9 == (Object)null)
			{
				mls.LogError((object)"Failed to register OldRadio item.");
				return;
			}
			int num7 = 1;
			Item val10 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/RockingHorse.asset");
			mls.LogInfo((object)val10);
			if ((Object)(object)val10 == (Object)null)
			{
				mls.LogError((object)"Failed to load RockingHorse asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab);
			if ((Object)(object)val10.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register RockingHorse spawn prefab.");
				return;
			}
			Items.RegisterScrap(val10, num7, (LevelTypes)(-1));
			if ((Object)(object)val10 == (Object)null)
			{
				mls.LogError((object)"Failed to register RockingHorse item.");
				return;
			}
			int num8 = 1;
			Item val11 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/TypeWriter.asset");
			mls.LogInfo((object)val11);
			if ((Object)(object)val11 == (Object)null)
			{
				mls.LogError((object)"Failed to load TypeWriter asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab);
			if ((Object)(object)val11.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register TypeWriter spawn prefab.");
				return;
			}
			Items.RegisterScrap(val11, num8, (LevelTypes)(-1));
			if ((Object)(object)val11 == (Object)null)
			{
				mls.LogError((object)"Failed to register TypeWriter item.");
				return;
			}
			int num9 = 1;
			Item val12 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/WheelRim.asset");
			mls.LogInfo((object)val12);
			if ((Object)(object)val12 == (Object)null)
			{
				mls.LogError((object)"Failed to load WheelRim asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab);
			if ((Object)(object)val12.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register WheelRim spawn prefab.");
				return;
			}
			Items.RegisterScrap(val12, num9, (LevelTypes)(-1));
			if ((Object)(object)val12 == (Object)null)
			{
				mls.LogError((object)"Failed to register WheelRim item.");
				return;
			}
			int num10 = 1;
			Item val13 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/WireSpool.asset");
			mls.LogInfo((object)val13);
			if ((Object)(object)val13 == (Object)null)
			{
				mls.LogError((object)"Failed to load WireSpool asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
			if ((Object)(object)val13.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register WireSpool spawn prefab.");
				return;
			}
			Items.RegisterScrap(val13, num10, (LevelTypes)(-1));
			if ((Object)(object)val13 == (Object)null)
			{
				mls.LogError((object)"Failed to register WireSpool item.");
				return;
			}
			mls.LogInfo((object)"Successfully Registed all Items and Energycores");
			mls.LogInfo((object)"More interiors for Lethal Company [Version 2.5.0] successfully loaded.");
		}

		public static StringWithRarity ParseMoonString(string moonString, int newRarity)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			if (string.IsNullOrEmpty(moonString))
			{
				return null;
			}
			string[] array = moonString.Split(':');
			if (array.Length != 2)
			{
				return new StringWithRarity(array[0], newRarity);
			}
			try
			{
				int num = int.Parse(array[1]);
				return new StringWithRarity(array[0], num);
			}
			catch (FormatException)
			{
				return new StringWithRarity(array[0], newRarity);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoreInteriorsDunGen";

		public const string PLUGIN_NAME = "MoreInteriorsDunGen";

		public const string PLUGIN_VERSION = "2.0.0";
	}
}
namespace MoreInteriorsDunGen.RatAI
{
	public class RatAI : MonoBehaviour
	{
		private enum HidingStatus
		{
			None,
			Hidding,
			InHole
		}

		public static RatAI Instance;

		private int currentWaypointIndex = 0;

		private NavMeshAgent agent;

		private Vector3 _currentDestination;

		[SerializeField]
		private Vector3 _waypointEndPosition;

		[SerializeField]
		private GameObject _waypointsParentGo;

		[SerializeField]
		private Transform[] _waypoints;

		[SerializeField]
		private int _numOfWaypoints;

		[SerializeField]
		private bool _reachedEnd;

		[SerializeField]
		private HidingStatus _currentState;

		[SerializeField]
		private float detectionRange = 5f;

		[SerializeField]
		private List<Transform> hidingSpots;

		private void Start()
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			agent = ((Component)this).GetComponent<NavMeshAgent>();
			agent.speed = 7f;
			agent.acceleration = 10f;
			GameObject[] array = GameObject.FindGameObjectsWithTag("AINode");
			_waypoints = (Transform[])(object)new Transform[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				_waypoints[i] = array[i].transform;
			}
			agent.destination = _waypoints[0].position;
			agent.destination = _currentDestination;
		}

		private void Update()
		{
			if (!agent.isStopped)
			{
				Move();
			}
		}

		public void Move()
		{
			//IL_0040: 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)
			if (_currentState == HidingStatus.None && agent.remainingDistance < 1f)
			{
				int num = Random.Range(0, _waypoints.Length);
				agent.destination = _waypoints[num].position;
			}
			else if (_currentState == HidingStatus.Hidding)
			{
				int index = Random.Range(0, hidingSpots.Count);
				Transform val = hidingSpots[index];
				agent.destination = val.position;
			}
		}

		private IEnumerator WaitToRun()
		{
			yield return (object)new WaitForSeconds(3f);
			_currentState = HidingStatus.None;
			agent.destination = _waypoints[currentWaypointIndex].position;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}