Decompiled source of CLARA v1.0.1

plugins/Reiko888.CLARA.dll

Decompiled 2 hours ago
#define DEBUG
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 Dawn.Utils;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reiko888.CLARA.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Video;

[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("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: AssemblyCompany("Reiko888.CLARA")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c76f19e7a62e5405e879dca1625d673779764d58")]
[assembly: AssemblyProduct("Blood Witch")]
[assembly: AssemblyTitle("Reiko888.CLARA")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 CLARA
{
	public class ClaraAI : EnemyAI
	{
		private enum State
		{
			Searching,
			Stalking,
			Chasing,
			Diving
		}

		public AudioSource diggingSFX;

		public AudioClip[] diggingClips;

		public AudioSource StepsSFX;

		public GameObject exitMound;

		public GameObject cosmeticMoundPrefab;

		private List<GameObject> activeMounds = new List<GameObject>();

		private List<GameObject> cosmeticMounds = new List<GameObject>();

		private Vector3 emergenceMoundPosition;

		private Quaternion emergenceMoundRotation;

		private bool shouldSpawnMoundAfterTransition = false;

		public AISearchRoutine searchForPlayers;

		private int numberOfMounds;

		private int numberOfCosmeticMounds;

		private int claraHP;

		private float checkLineOfSightInterval = 0f;

		private float noticePlayerTimer = 0f;

		private Vector3 ambushNodePosition;

		private float ambushTimer = 0f;

		private float diggingSpeed;

		private float chaseSpeed;

		private const float LINE_OF_SIGHT_DISTANCE = 120f;

		private bool hasLOS;

		private Vector3 lastPosition;

		public float chaseTimer = 0f;

		private float timeSinceHittingPlayer = 0f;

		public int damagePerHit;

		public AudioClip attackSFX;

		private string lastLogState = "";

		private int lastTargetPlayerId = -1;

		private bool isAmbushing = false;

		public AudioClip[] undergroundTauntLines;

		public AudioClip[] aboveTauntLines;

		public AudioClip[] emergeSFX;

		private float voiceTimer = 0f;

		private float emergenceTransitionTimer = 0f;

		private bool isEmergingAnimationPlaying = false;

		private Vector3 lastPlayerPos;

		public GameObject fakeClara;

		private GameObject fakeClaraInstance;

		private Transform fakeClaraHeadBone;

		public GameObject dirtTrailParticles;

		public GameObject emergenceParticles;

		public AudioClip[] drillClips;

		private bool isPeeking = false;

		private float peekTimer = 0f;

		private float chaseLockOnTimer = 0f;

		private float lostPlayerTimer = 0f;

		private GameObject diveTargetMound;

		private float diveTimer = 0f;

		private float attackSFXTimer = 0f;

		private float stalkSequenceTimer;

		private float fakeClaraDeactivateTimer = 0f;

		private bool localMeshesDisabled = false;

		private float stalkShakeTimer = 0f;

		private Vector3 peekingMoundPosition;

		private bool emergeFromExistingMound = false;

		private Vector3 lastFrameStalkPosition;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			if (Plugin.Logger != null)
			{
				Plugin.Logger.LogInfo((object)text);
			}
			else
			{
				Debug.Log((object)("CLARA: " + text));
			}
		}

		public override void Start()
		{
			((EnemyAI)this).Start();
			numberOfMounds = ((AssetBundleLoader<ClaraContentHandler.CLARAAssets>)(object)ContentHandler<ClaraContentHandler>.Instance.claraAssets).GetConfig<int>("Number of usable mounds").Value;
			numberOfCosmeticMounds = ((AssetBundleLoader<ClaraContentHandler.CLARAAssets>)(object)ContentHandler<ClaraContentHandler>.Instance.claraAssets).GetConfig<int>("Number of jumpscare mounds").Value;
			claraHP = ((AssetBundleLoader<ClaraContentHandler.CLARAAssets>)(object)ContentHandler<ClaraContentHandler>.Instance.claraAssets).GetConfig<int>("CLARA Hp").Value;
			diggingSpeed = ((AssetBundleLoader<ClaraContentHandler.CLARAAssets>)(object)ContentHandler<ClaraContentHandler>.Instance.claraAssets).GetConfig<float>("Digging speed").Value;
			chaseSpeed = ((AssetBundleLoader<ClaraContentHandler.CLARAAssets>)(object)ContentHandler<ClaraContentHandler>.Instance.claraAssets).GetConfig<float>("Chase speed").Value;
			damagePerHit = ((AssetBundleLoader<ClaraContentHandler.CLARAAssets>)(object)ContentHandler<ClaraContentHandler>.Instance.claraAssets).GetConfig<int>("Damage per hit").Value;
			stalkSequenceTimer = ((AssetBundleLoader<ClaraContentHandler.CLARAAssets>)(object)ContentHandler<ClaraContentHandler>.Instance.claraAssets).GetConfig<float>("Stalk timer").Value;
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).EnableEnemyMesh(false, false, true);
			if (((NetworkBehaviour)this).IsServer)
			{
				SpawnAllMounds();
			}
			if (!RoundManager.Instance.hasInitializedLevelRandomSeed)
			{
				RoundManager.Instance.InitializeRandomNumberGenerators();
			}
			base.enemyHP = claraHP;
			if ((Object)(object)diggingSFX != (Object)null && diggingClips != null && diggingClips.Length != 0)
			{
				diggingSFX.clip = diggingClips[0];
				diggingSFX.loop = true;
				diggingSFX.Play();
			}
			if ((Object)(object)fakeClara != (Object)null)
			{
				fakeClaraInstance = Object.Instantiate<GameObject>(fakeClara);
				fakeClaraInstance.SetActive(false);
				AudioSource componentInChildren = fakeClaraInstance.GetComponentInChildren<AudioSource>();
				if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.clip != (Object)null)
				{
					componentInChildren.clip.LoadAudioData();
				}
			}
			if ((Object)(object)dirtTrailParticles != (Object)null)
			{
				dirtTrailParticles.SetActive(false);
			}
			if ((Object)(object)emergenceParticles != (Object)null)
			{
				emergenceParticles.SetActive(false);
			}
			LogIfDebugBuild("Clara spawned. Starting in searching.");
		}

		public void SyncStateSafely(int newStateIndex)
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				SyncStateSafelyClientRpc(newStateIndex);
			}
			else
			{
				SyncStateSafelyServerRpc(newStateIndex);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SyncStateSafelyServerRpc(int newStateIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3603477563u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, newStateIndex);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 3603477563u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					SyncStateSafelyClientRpc(newStateIndex);
				}
			}
		}

		[ClientRpc]
		private void SyncStateSafelyClientRpc(int newStateIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_010d: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3966759624u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, newStateIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3966759624u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			base.currentBehaviourStateIndex = newStateIndex;
			if (newStateIndex == 0)
			{
				base.inSpecialAnimation = false;
				Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)this).transform.position, default(NavMeshHit), 3f, base.agent.areaMask);
				if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled)
				{
					base.agent.Warp(navMeshPosition);
				}
				((Component)this).transform.position = navMeshPosition;
				if (((NetworkBehaviour)this).IsServer)
				{
					if (searchForPlayers != null)
					{
						searchForPlayers.inProgress = false;
					}
					((EnemyAI)this).SyncPositionToClients();
				}
			}
			if (newStateIndex == 1)
			{
				if (currentBehaviourStateIndex != 1)
				{
					stalkSequenceTimer = 10f;
					isAmbushing = false;
					base.inSpecialAnimation = false;
					emergeFromExistingMound = false;
					if ((Object)(object)dirtTrailParticles != (Object)null)
					{
						dirtTrailParticles.SetActive(true);
						ParticleSystem[] componentsInChildren = dirtTrailParticles.GetComponentsInChildren<ParticleSystem>(true);
						ParticleSystem[] array = componentsInChildren;
						foreach (ParticleSystem val3 in array)
						{
							val3.Play();
						}
					}
				}
			}
			else if ((Object)(object)dirtTrailParticles != (Object)null)
			{
				dirtTrailParticles.SetActive(false);
			}
			if ((Object)(object)diggingSFX != (Object)null)
			{
				if (newStateIndex == 2 || newStateIndex == 3)
				{
					diggingSFX.Stop();
				}
				else if (!diggingSFX.isPlaying && diggingClips != null && diggingClips.Length != 0)
				{
					diggingSFX.clip = diggingClips[0];
					diggingSFX.loop = true;
					diggingSFX.Play();
				}
			}
			if (newStateIndex != 2 && newStateIndex != 3 && (Object)(object)base.creatureSFX != (Object)null && base.creatureSFX.isPlaying)
			{
				base.creatureSFX.Stop();
			}
		}

		public override void DoAIInterval()
		{
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (StartOfRound.Instance.livingPlayers == 0 || base.isEnemyDead || base.stunNormalizedTimer > 0f)
			{
				return;
			}
			switch ((State)base.currentBehaviourStateIndex)
			{
			case State.Searching:
				isAmbushing = false;
				isEmergingAnimationPlaying = false;
				base.agent.speed = diggingSpeed;
				if ((Object)(object)base.targetPlayer != (Object)null)
				{
					base.targetPlayer = null;
					base.movingTowardsTargetPlayer = false;
				}
				if ((Object)(object)base.targetPlayer == (Object)null)
				{
					if (searchForPlayers != null && !searchForPlayers.inProgress && ((NetworkBehaviour)this).IsServer)
					{
						((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers);
					}
				}
				else if (searchForPlayers != null && searchForPlayers.inProgress && ((NetworkBehaviour)this).IsServer)
				{
					((EnemyAI)this).StopSearch(searchForPlayers, true);
				}
				break;
			case State.Stalking:
				if (searchForPlayers != null && searchForPlayers.inProgress && ((NetworkBehaviour)this).IsServer)
				{
					((EnemyAI)this).StopSearch(searchForPlayers, true);
				}
				if ((Object)(object)base.targetPlayer != (Object)null && !isAmbushing)
				{
					base.agent.speed = diggingSpeed;
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				}
				break;
			case State.Chasing:
				isAmbushing = false;
				if (searchForPlayers != null && searchForPlayers.inProgress && ((NetworkBehaviour)this).IsServer)
				{
					((EnemyAI)this).StopSearch(searchForPlayers, true);
				}
				if (isEmergingAnimationPlaying)
				{
					break;
				}
				base.agent.speed = chaseSpeed;
				if (((NetworkBehaviour)this).IsOwner || ((NetworkBehaviour)this).IsServer)
				{
					base.agent.stoppingDistance = 0f;
					PlayerControllerB targetPlayer = base.targetPlayer;
					bool flag = (Object)(object)base.targetPlayer == (Object)null || base.targetPlayer.isPlayerDead || !base.targetPlayer.isInsideFactory;
					base.addPlayerVelocityToDestination = 1f;
					bool flag2 = chaseLockOnTimer <= 0f;
					bool flag3 = ((EnemyAI)this).TargetClosestPlayer(1.5f, flag2, 70f, false, false, true);
					if (!flag3 && (Object)(object)targetPlayer != (Object)null && !flag)
					{
						base.targetPlayer = targetPlayer;
					}
					if ((Object)(object)base.targetPlayer != (Object)null)
					{
						((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
						if ((Object)(object)base.targetPlayer != (Object)(object)targetPlayer)
						{
							((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
						}
					}
					bool flag4 = false;
					if ((Object)(object)base.targetPlayer == (Object)null || base.targetPlayer.isPlayerDead || !base.targetPlayer.isInsideFactory)
					{
						flag4 = true;
					}
					else if (chaseLockOnTimer <= 0f)
					{
						if (flag3)
						{
							lostPlayerTimer = 0f;
						}
						else
						{
							lostPlayerTimer += base.AIIntervalTime;
							if (lostPlayerTimer > 2.5f)
							{
								flag4 = true;
							}
						}
					}
					else
					{
						lostPlayerTimer = 0f;
					}
					if (flag4)
					{
						LogIfDebugBuild("[C.L.A.R.A] Target escaped factory or broke line of sight. Diving back to floor.");
						if (((NetworkBehaviour)this).IsServer)
						{
							EndChaseAndStartDiving();
						}
						else if (((NetworkBehaviour)this).IsOwner)
						{
							RequestEndChaseServerRpc();
						}
					}
				}
				else if ((Object)(object)base.targetPlayer != (Object)null)
				{
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				}
				break;
			case State.Diving:
				isAmbushing = false;
				base.agent.speed = chaseSpeed;
				base.agent.SetDestination(ambushNodePosition);
				if (((NetworkBehaviour)this).IsServer)
				{
					PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(60f, 60, -1);
					if ((Object)(object)val != (Object)null)
					{
						LogIfDebugBuild("[C.L.A.R.A] Saw player " + val.playerUsername + ", restarting chase");
						base.targetPlayer = val;
						((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
						chaseLockOnTimer = 10f;
						lostPlayerTimer = 0f;
						SyncStateSafely(2);
					}
				}
				break;
			}
			if ((Object)(object)base.targetPlayer != (Object)null && base.currentBehaviourStateIndex != 2 && base.currentBehaviourStateIndex != 3)
			{
				Vector3 val2 = (((Object)(object)base.targetPlayer.gameplayCamera != (Object)null) ? ((Component)base.targetPlayer.gameplayCamera).transform.position : (((Component)base.targetPlayer).transform.position + Vector3.up * 1.5f));
				if (((EnemyAI)this).CheckLineOfSightForPosition(val2, 120f, 60, -1f, (Transform)null))
				{
					hasLOS = true;
					lastPosition = ((Component)base.targetPlayer).transform.position;
					if (base.currentBehaviourStateIndex == 0)
					{
						LogIfDebugBuild("[C.L.A.R.A] Line of sight gained on player: " + base.targetPlayer.playerUsername + ". Stalking target.");
						SyncStateSafely(1);
					}
				}
				else
				{
					if (hasLOS)
					{
						LogIfDebugBuild("[C.L.A.R.A] Lost target.");
					}
					hasLOS = false;
				}
			}
			SyncTargetPlayer();
		}

		public override void Update()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0707: Unknown result type (might be due to invalid IL or missing references)
			//IL_070c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_096e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cae: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b64: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b67: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				return;
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				UpdateClaraOwnership();
				if (base.currentBehaviourStateIndex == 2 && (Object)(object)base.targetPlayer != (Object)null && (base.targetPlayer.isPlayerDead || !base.targetPlayer.isInsideFactory || Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 100f))
				{
					LogIfDebugBuild("[C.L.A.R.A] Ending chase.");
					EndChaseAndStartDiving();
				}
			}
			bool flag = base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3;
			if (flag && localMeshesDisabled)
			{
				((EnemyAI)this).EnableEnemyMesh(true, false, false);
				localMeshesDisabled = false;
			}
			else if (!flag && !localMeshesDisabled)
			{
				((EnemyAI)this).EnableEnemyMesh(false, false, true);
				localMeshesDisabled = true;
			}
			ScanNodeProperties componentInChildren = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((Component)componentInChildren).gameObject.SetActive(base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3);
			}
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
				if ((Object)(object)base.creatureAnimator != (Object)null)
				{
					base.creatureAnimator.SetBool("isStunned", true);
				}
			}
			else if ((Object)(object)base.creatureAnimator != (Object)null)
			{
				base.creatureAnimator.SetBool("isStunned", false);
			}
			if (isAmbushing || (base.inSpecialAnimation && base.currentBehaviourStateIndex != 3) || (base.currentBehaviourStateIndex == 3 && base.inSpecialAnimation))
			{
				if (((Component)this).transform.position != ambushNodePosition)
				{
					((Component)this).transform.position = ambushNodePosition;
				}
				if (isEmergingAnimationPlaying)
				{
					emergenceTransitionTimer -= Time.deltaTime;
					if (shouldSpawnMoundAfterTransition && emergenceTransitionTimer <= 0.5f && (Object)(object)exitMound != (Object)null)
					{
						GameObject item = Object.Instantiate<GameObject>(exitMound, emergenceMoundPosition, emergenceMoundRotation);
						activeMounds.Add(item);
						shouldSpawnMoundAfterTransition = false;
					}
					if (emergenceTransitionTimer <= 0f)
					{
						isEmergingAnimationPlaying = false;
						base.inSpecialAnimation = false;
						base.agent.speed = chaseSpeed;
						ambushNodePosition = Vector3.zero;
						if ((Object)(object)emergenceParticles != (Object)null)
						{
							emergenceParticles.SetActive(true);
							ParticleSystem[] componentsInChildren = emergenceParticles.GetComponentsInChildren<ParticleSystem>();
							ParticleSystem[] array = componentsInChildren;
							foreach (ParticleSystem val in array)
							{
								val.Play();
							}
						}
						if ((Object)(object)GameNetworkManager.Instance != (Object)null)
						{
							PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
							if ((Object)(object)localPlayerController != (Object)null && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled)
							{
								float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position);
								if (num <= 20f && (Object)(object)HUDManager.Instance != (Object)null)
								{
									HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
								}
							}
						}
						LogIfDebugBuild("[C.L.A.R.A] Emerged successfully.");
					}
				}
			}
			if (isPeeking)
			{
				peekTimer -= Time.deltaTime;
				if (peekTimer <= 0f)
				{
					isPeeking = false;
					if ((Object)(object)fakeClaraInstance != (Object)null)
					{
						Animator component = fakeClaraInstance.GetComponent<Animator>();
						if ((Object)(object)component != (Object)null)
						{
							component.SetBool("isPeeking", false);
						}
					}
					fakeClaraDeactivateTimer = 1f;
					if (((NetworkBehaviour)this).IsServer && base.currentBehaviourStateIndex == 0)
					{
						Transform closestNode = GetClosestNode(peekingMoundPosition);
						if ((Object)(object)closestNode != (Object)null)
						{
							LogIfDebugBuild("[Clara Event] Jumpscare completed. CLARA teleporting.");
							StopPeekingAndWarpClientRpc(closestNode.position);
						}
					}
				}
			}
			if (fakeClaraDeactivateTimer > 0f)
			{
				fakeClaraDeactivateTimer -= Time.deltaTime;
				if (fakeClaraDeactivateTimer <= 0f && (Object)(object)fakeClaraInstance != (Object)null)
				{
					fakeClaraInstance.SetActive(false);
				}
			}
			if (base.currentBehaviourStateIndex == 2 && chaseLockOnTimer > 0f)
			{
				chaseLockOnTimer -= Time.deltaTime;
			}
			if (base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3)
			{
				if (attackSFXTimer > 0f)
				{
					attackSFXTimer -= Time.deltaTime;
					if ((Object)(object)base.creatureSFX != (Object)null && base.creatureSFX.isPlaying)
					{
						base.creatureSFX.Stop();
					}
				}
				else if ((Object)(object)base.creatureSFX != (Object)null && drillClips != null && drillClips.Length != 0 && !base.creatureSFX.isPlaying && !isEmergingAnimationPlaying)
				{
					base.creatureSFX.clip = drillClips[0];
					base.creatureSFX.loop = true;
					base.creatureSFX.Play();
				}
			}
			else if ((Object)(object)base.creatureSFX != (Object)null && base.creatureSFX.isPlaying)
			{
				base.creatureSFX.Stop();
			}
			if ((Object)(object)StepsSFX != (Object)null)
			{
				StepsSFX.mute = base.currentBehaviourStateIndex != 2 && base.currentBehaviourStateIndex != 3;
			}
			if ((Object)(object)base.targetPlayer != (Object)null && base.currentBehaviourStateIndex != 2 && base.currentBehaviourStateIndex != 3)
			{
				bool flag2 = Vector3.Distance(((Component)base.targetPlayer).transform.position, lastPlayerPos) > 0.01f;
				lastPlayerPos = ((Component)base.targetPlayer).transform.position;
				if ((Object)(object)diggingSFX != (Object)null)
				{
					if (flag2)
					{
						if (!diggingSFX.isPlaying)
						{
							diggingSFX.Play();
						}
					}
					else if (diggingSFX.isPlaying)
					{
						diggingSFX.Pause();
					}
				}
			}
			timeSinceHittingPlayer += Time.deltaTime;
			switch ((State)base.currentBehaviourStateIndex)
			{
			case State.Searching:
				if (checkLineOfSightInterval > 0.05f)
				{
					checkLineOfSightInterval = 0f;
					PlayerControllerB val2 = ((EnemyAI)this).CheckLineOfSightForPlayer(60f, 15, -1);
					if ((Object)(object)val2 != (Object)null)
					{
						noticePlayerTimer += 0.05f;
						if (noticePlayerTimer > 0.2f && ((NetworkBehaviour)this).IsServer)
						{
							base.targetPlayer = val2;
							SyncStateSafely(1);
						}
					}
					else
					{
						noticePlayerTimer = Mathf.Max(0f, noticePlayerTimer - Time.deltaTime);
					}
				}
				else
				{
					checkLineOfSightInterval += Time.deltaTime;
				}
				break;
			case State.Stalking:
				if ((Object)(object)GameNetworkManager.Instance != (Object)null)
				{
					PlayerControllerB localPlayerController2 = GameNetworkManager.Instance.localPlayerController;
					if ((Object)(object)localPlayerController2 != (Object)null && !localPlayerController2.isPlayerDead && localPlayerController2.isPlayerControlled)
					{
						float num3 = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController2).transform.position);
						if (num3 <= 15f)
						{
							float num4 = Vector3.Distance(((Component)this).transform.position, lastFrameStalkPosition);
							if (num4 > 0.01f)
							{
								stalkShakeTimer -= Time.deltaTime;
								if (stalkShakeTimer <= 0f)
								{
									if ((Object)(object)HUDManager.Instance != (Object)null)
									{
										HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
									}
									stalkShakeTimer = 0.35f;
								}
							}
						}
					}
				}
				lastFrameStalkPosition = ((Component)this).transform.position;
				if (!((NetworkBehaviour)this).IsServer)
				{
					break;
				}
				if ((Object)(object)base.targetPlayer == (Object)null || !base.targetPlayer.isPlayerControlled || base.targetPlayer.isPlayerDead || Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 50f)
				{
					isAmbushing = false;
					base.inSpecialAnimation = false;
					base.targetPlayer = null;
					SyncStateSafely(0);
				}
				else if (!isAmbushing)
				{
					GameObject closestFloorMound = GetClosestFloorMound(((Component)this).transform.position);
					if ((Object)(object)closestFloorMound != (Object)null && Vector3.Distance(((Component)this).transform.position, closestFloorMound.transform.position) < 10f)
					{
						emergeFromExistingMound = true;
						BeginAmbushSequence(closestFloorMound.transform.position, base.targetPlayer.actualClientId);
						break;
					}
					stalkSequenceTimer -= Time.deltaTime;
					voiceTimer -= Time.deltaTime;
					if (voiceTimer <= 0f && undergroundTauntLines != null && undergroundTauntLines.Length != 0)
					{
						int clipIndex2 = RoundManager.Instance.AnomalyRandom.Next(0, undergroundTauntLines.Length);
						PlayUndergroundTauntClientRpc(clipIndex2);
						voiceTimer = (float)RoundManager.Instance.AnomalyRandom.NextDouble() * 8f + 12f;
					}
					if (stalkSequenceTimer <= 0f)
					{
						Transform closestNode2 = GetClosestNode(((Component)this).transform.position);
						Vector3 targetNodePos = (((Object)(object)closestNode2 != (Object)null) ? closestNode2.position : ((Component)this).transform.position);
						BeginAmbushSequence(targetNodePos, base.targetPlayer.actualClientId);
					}
				}
				else
				{
					ambushTimer += Time.deltaTime;
					if (ambushTimer >= 3f)
					{
						TriggerEmergenceServerRpc();
					}
				}
				break;
			case State.Chasing:
				if (((NetworkBehaviour)this).IsServer)
				{
					voiceTimer -= Time.deltaTime;
					if (voiceTimer <= 0f && aboveTauntLines != null && aboveTauntLines.Length != 0)
					{
						int clipIndex = RoundManager.Instance.AnomalyRandom.Next(0, aboveTauntLines.Length);
						PlayAboveTauntClientRpc(clipIndex);
						voiceTimer = (float)RoundManager.Instance.AnomalyRandom.NextDouble() * 8f + 12f;
					}
				}
				break;
			case State.Diving:
				if (base.inSpecialAnimation)
				{
					diveTimer -= Time.deltaTime;
					if (diveTimer <= 0f)
					{
						base.inSpecialAnimation = false;
						((EnemyAI)this).EnableEnemyMesh(false, false, true);
						base.targetPlayer = null;
						base.movingTowardsTargetPlayer = false;
						ambushNodePosition = Vector3.zero;
						isAmbushing = false;
						if ((Object)(object)base.creatureSFX != (Object)null && base.creatureSFX.isPlaying)
						{
							base.creatureSFX.Stop();
						}
						if (((NetworkBehaviour)this).IsServer)
						{
							SyncStateSafely(0);
						}
					}
				}
				else if (((NetworkBehaviour)this).IsServer)
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ambushNodePosition);
					if (num2 <= 1.5f)
					{
						TriggerDiveSequenceClientRpc();
					}
				}
				break;
			}
			SyncTargetPlayer();
		}

		private void UpdateClaraOwnership()
		{
			if (!base.isEnemyDead)
			{
				ulong num = 0uL;
				if ((Object)(object)base.targetPlayer != (Object)null)
				{
					num = base.targetPlayer.actualClientId;
				}
				if (((NetworkBehaviour)this).NetworkObject.OwnerClientId != num)
				{
					((EnemyAI)this).ChangeOwnershipOfEnemy(num);
				}
			}
		}

		private void SyncTargetPlayer()
		{
			int num = (((Object)(object)base.targetPlayer != (Object)null) ? ((int)base.targetPlayer.actualClientId) : (-1));
			if (num != lastTargetPlayerId)
			{
				lastTargetPlayerId = num;
				if (((NetworkBehaviour)this).IsServer)
				{
					SyncTargetClientRpc(num);
				}
				else if (((NetworkBehaviour)this).IsOwner)
				{
					SyncTargetServerRpc(num);
				}
			}
		}

		private void SpawnMounds(List<GameObject> availableNodes, out List<Vector3> positions, out List<Quaternion> rotations)
		{
			//IL_0069: 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_018a: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: 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)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			positions = new List<Vector3>();
			rotations = new List<Quaternion>();
			List<GameObject> list = new List<GameObject>();
			List<GameObject> list2 = new List<GameObject>(availableNodes);
			while (list.Count < numberOfMounds && list2.Count > 0)
			{
				int index = RoundManager.Instance.AnomalyRandom.Next(0, list2.Count);
				GameObject val = list2[index];
				list2.RemoveAt(index);
				bool flag = false;
				foreach (GameObject item3 in list)
				{
					if (Vector3.Distance(val.transform.position, item3.transform.position) < 15f)
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					list.Add(val);
					availableNodes.Remove(val);
				}
			}
			while (list.Count < numberOfMounds && availableNodes.Count > 0)
			{
				int index2 = RoundManager.Instance.AnomalyRandom.Next(0, availableNodes.Count);
				GameObject item = availableNodes[index2];
				list.Add(item);
				availableNodes.RemoveAt(index2);
			}
			int mask = LayerMask.GetMask(new string[4] { "Room", "Default", "Railings", "MiscLevelGeometry" });
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < list.Count; i++)
			{
				Vector3 val2 = list[i].transform.position;
				Quaternion item2 = list[i].transform.rotation;
				if (Physics.Raycast(val2 + Vector3.up * 1.5f, Vector3.down, ref val3, 5f, mask, (QueryTriggerInteraction)1))
				{
					val2 = ((RaycastHit)(ref val3)).point;
					item2 = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val3)).normal);
					float num = (float)RoundManager.Instance.AnomalyRandom.NextDouble() * 360f;
					item2 *= Quaternion.AngleAxis(num, Vector3.up);
				}
				positions.Add(val2);
				rotations.Add(item2);
			}
		}

		private void SpawnCosmeticMounds(List<GameObject> remainingNodes, out List<Vector3> positions, out List<Quaternion> rotations)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_01c6: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0633: Unknown result type (might be due to invalid IL or missing references)
			//IL_063d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			positions = new List<Vector3>();
			rotations = new List<Quaternion>();
			if (remainingNodes == null || remainingNodes.Count == 0)
			{
				return;
			}
			int num = Mathf.Min(numberOfCosmeticMounds, remainingNodes.Count);
			GameObject val = (((Object)(object)cosmeticMoundPrefab != (Object)null) ? cosmeticMoundPrefab : exitMound);
			int mask = LayerMask.GetMask(new string[4] { "Room", "Railings", "MiscLevelGeometry", "Default" });
			Vector3[] obj = new Vector3[9]
			{
				Vector3.up,
				Vector3.forward,
				Vector3.back,
				Vector3.left,
				Vector3.right,
				default(Vector3),
				default(Vector3),
				default(Vector3),
				default(Vector3)
			};
			Vector3 val2 = Vector3.up + Vector3.forward;
			obj[5] = ((Vector3)(ref val2)).normalized;
			val2 = Vector3.up + Vector3.back;
			obj[6] = ((Vector3)(ref val2)).normalized;
			val2 = Vector3.up + Vector3.left;
			obj[7] = ((Vector3)(ref val2)).normalized;
			val2 = Vector3.up + Vector3.right;
			obj[8] = ((Vector3)(ref val2)).normalized;
			Vector3[] collection = (Vector3[])(object)obj;
			RaycastHit val5 = default(RaycastHit);
			RaycastHit val11 = default(RaycastHit);
			for (int i = 0; i < num; i++)
			{
				int index = RoundManager.Instance.AnomalyRandom.Next(0, remainingNodes.Count);
				GameObject val3 = remainingNodes[index];
				remainingNodes.RemoveAt(index);
				Vector3 position = val3.transform.position;
				bool flag = false;
				for (float num2 = 2f; num2 <= 15f; num2 += 3f)
				{
					List<Vector3> list = new List<Vector3>(collection);
					while (list.Count > 0)
					{
						int index2 = RoundManager.Instance.AnomalyRandom.Next(0, list.Count);
						Vector3 val4 = list[index2];
						list.RemoveAt(index2);
						if (!Physics.Raycast(position, val4, ref val5, num2, mask, (QueryTriggerInteraction)1))
						{
							continue;
						}
						bool flag2 = Mathf.Abs(((RaycastHit)(ref val5)).normal.y) < 0.1f;
						bool flag3 = ((RaycastHit)(ref val5)).normal.y < -0.9f;
						if (!flag2 && !flag3)
						{
							continue;
						}
						Quaternion val6 = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val5)).normal);
						float num3 = (float)RoundManager.Instance.AnomalyRandom.NextDouble() * 360f;
						val6 *= Quaternion.AngleAxis(num3, Vector3.up);
						Vector3 item = ((RaycastHit)(ref val5)).point;
						Quaternion item2 = val6;
						bool flag4 = false;
						BoxCollider componentInChildren = val.GetComponentInChildren<BoxCollider>();
						if ((Object)(object)componentInChildren != (Object)null)
						{
							Vector3 size = componentInChildren.size;
							Vector3 val7 = val6 * Vector3.right;
							Vector3 val8 = val6 * Vector3.forward;
							Vector3[] array = (Vector3[])(object)new Vector3[13]
							{
								Vector3.zero,
								val7 * 0.2f,
								-val7 * 0.2f,
								val8 * 0.2f,
								-val8 * 0.2f,
								val7 * 0.4f,
								-val7 * 0.4f,
								val8 * 0.4f,
								-val8 * 0.4f,
								(val7 + val8) * 0.3f,
								(val7 - val8) * 0.3f,
								(-val7 + val8) * 0.3f,
								(-val7 - val8) * 0.3f
							};
							Vector3[] array2 = array;
							foreach (Vector3 val9 in array2)
							{
								Vector3 val10 = ((RaycastHit)(ref val5)).point + val9 + ((RaycastHit)(ref val5)).normal * 0.5f;
								if (!Physics.Raycast(val10, -((RaycastHit)(ref val5)).normal, ref val11, 1f, mask, (QueryTriggerInteraction)1))
								{
									continue;
								}
								Vector3 point = ((RaycastHit)(ref val11)).point;
								Quaternion val12 = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val11)).normal);
								val12 *= Quaternion.AngleAxis(num3, Vector3.up);
								Vector3 val13 = point + ((RaycastHit)(ref val11)).normal * (size.y / 2f + 0.05f);
								Vector3 val14 = size / 2f;
								if (Physics.CheckBox(val13, val14, val12, mask, (QueryTriggerInteraction)1))
								{
									continue;
								}
								float num4 = size.x / 2f;
								float num5 = size.z / 2f;
								Vector3[] array3 = (Vector3[])(object)new Vector3[4]
								{
									val12 * new Vector3(num4, 0f, num5),
									val12 * new Vector3(0f - num4, 0f, num5),
									val12 * new Vector3(num4, 0f, 0f - num5),
									val12 * new Vector3(0f - num4, 0f, 0f - num5)
								};
								bool flag5 = true;
								Vector3[] array4 = array3;
								foreach (Vector3 val15 in array4)
								{
									Vector3 val16 = point + val15;
									Vector3 val17 = val16 + ((RaycastHit)(ref val11)).normal * 0.1f;
									if (!Physics.Raycast(val17, -((RaycastHit)(ref val11)).normal, 0.2f, mask, (QueryTriggerInteraction)1))
									{
										flag5 = false;
										break;
									}
								}
								if (flag5)
								{
									item = point;
									item2 = val12;
									flag4 = true;
									break;
								}
							}
						}
						else
						{
							flag4 = true;
						}
						if (!flag4)
						{
							continue;
						}
						positions.Add(item);
						rotations.Add(item2);
						flag = true;
						break;
					}
					if (flag)
					{
						break;
					}
				}
			}
		}

		private void BeginAmbushSequence(Vector3 targetNodePos, ulong targetClientId)
		{
			//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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			ambushNodePosition = targetNodePos;
			ambushTimer = 0f;
			isAmbushing = true;
			base.inSpecialAnimation = true;
			StopPeeking();
			if (targetClientId < (ulong)StartOfRound.Instance.allPlayerScripts.Length)
			{
				base.targetPlayer = StartOfRound.Instance.allPlayerScripts[targetClientId];
			}
			base.agent.Warp(RoundManager.Instance.GetNavMeshPosition(ambushNodePosition, default(NavMeshHit), 3f, base.agent.areaMask));
			SyncAmbushStateClientRpc(isAmbushing, ambushNodePosition);
			SyncStateSafely(1);
		}

		[ClientRpc]
		private void SyncAmbushStateClientRpc(bool ambushing, Vector3 nodePos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00f8: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(996859016u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref ambushing, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe(ref nodePos);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 996859016u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				isAmbushing = ambushing;
				ambushNodePosition = nodePos;
				if (!((NetworkBehaviour)this).IsServer && (Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled)
				{
					base.agent.Warp(RoundManager.Instance.GetNavMeshPosition(nodePos, default(NavMeshHit), 3f, base.agent.areaMask));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SyncTargetServerRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(398899260u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerClientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 398899260u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					SyncTargetClientRpc(playerClientId);
				}
			}
		}

		[ClientRpc]
		public void SyncTargetClientRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3928459202u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerClientId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3928459202u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (playerClientId < 0)
				{
					base.targetPlayer = null;
				}
				else if (playerClientId < StartOfRound.Instance.allPlayerScripts.Length)
				{
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerClientId];
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestEndChaseServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(675243889u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 675243889u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					EndChaseAndStartDiving();
				}
			}
		}

		[ClientRpc]
		private void PlayAboveTauntClientRpc(int clipIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3278017721u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, clipIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3278017721u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (aboveTauntLines != null && clipIndex >= 0 && clipIndex < aboveTauntLines.Length)
				{
					base.creatureVoice.PlayOneShot(aboveTauntLines[clipIndex]);
				}
			}
		}

		[ClientRpc]
		private void PlayUndergroundTauntClientRpc(int clipIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1898981370u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, clipIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1898981370u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (undergroundTauntLines != null && clipIndex >= 0 && clipIndex < undergroundTauntLines.Length)
				{
					base.creatureVoice.PlayOneShot(undergroundTauntLines[clipIndex]);
				}
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_005c: 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)
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (base.currentBehaviourStateIndex == 2 && timeSinceHittingPlayer > 0.75f)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					timeSinceHittingPlayer = 0f;
					val.DamagePlayer(damagePerHit, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					HitPlayerServerRpc((int)val.playerClientId);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void HitPlayerServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1970364661u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 1970364661u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					HitPlayerClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		private void HitPlayerClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1405740449u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1405740449u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)base.creatureAnimator != (Object)null)
				{
					base.creatureAnimator.SetTrigger("HitPlayer");
				}
				if ((Object)(object)base.creatureVoice != (Object)null && (Object)(object)attackSFX != (Object)null)
				{
					base.creatureVoice.PlayOneShot(attackSFX);
				}
				attackSFXTimer = 1f;
				if ((Object)(object)base.creatureSFX != (Object)null)
				{
					base.creatureSFX.Stop();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void TriggerEmergenceServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1054798166u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 1054798166u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					TriggerEmergenceClientRpc(ambushNodePosition, emergeFromExistingMound);
				}
			}
		}

		[ClientRpc]
		private void TriggerEmergenceClientRpc(Vector3 spawnPos, bool fromExistingMound)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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_01ad: 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_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1342887811u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref spawnPos);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref fromExistingMound, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1342887811u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Vector3 val3 = spawnPos;
				Quaternion val4 = Quaternion.identity;
				int num = LayerMask.GetMask(new string[3] { "Room", "Colliders", "Map" });
				if (num == 0 && (Object)(object)StartOfRound.Instance != (Object)null)
				{
					num = StartOfRound.Instance.collidersAndRoomMask;
				}
				RaycastHit val5 = default(RaycastHit);
				if (Physics.Raycast(spawnPos + Vector3.up * 1.5f, Vector3.down, ref val5, 5f, num, (QueryTriggerInteraction)1))
				{
					val3 = ((RaycastHit)(ref val5)).point;
					val4 = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val5)).normal);
					float num2 = (float)RoundManager.Instance.AnomalyRandom.NextDouble() * 360f;
					val4 *= Quaternion.AngleAxis(num2, Vector3.up);
				}
				shouldSpawnMoundAfterTransition = !fromExistingMound;
				emergenceMoundPosition = val3;
				emergenceMoundRotation = val4;
				if ((Object)(object)emergenceParticles != (Object)null)
				{
					emergenceParticles.transform.position = val3;
				}
				if ((Object)(object)dirtTrailParticles != (Object)null)
				{
					dirtTrailParticles.SetActive(false);
				}
				((EnemyAI)this).EnableEnemyMesh(true, false, false);
				if ((Object)(object)base.creatureAnimator != (Object)null)
				{
					base.creatureAnimator.SetTrigger("isEmerging");
				}
				isAmbushing = false;
				isEmergingAnimationPlaying = true;
				base.inSpecialAnimation = true;
				emergenceTransitionTimer = 1f;
				chaseLockOnTimer = 10f;
				lostPlayerTimer = 0f;
				StopPeeking();
				if (!((NetworkBehaviour)this).IsServer && (Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled)
				{
					base.agent.Warp(RoundManager.Instance.GetNavMeshPosition(val3, default(NavMeshHit), 3f, base.agent.areaMask));
				}
				SyncAmbushStateClientRpc(ambushing: false, spawnPos);
				if (base.currentBehaviourStateIndex != 2)
				{
					SyncStateSafely(2);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestPeekingServerRpc(Vector3 position, Quaternion rotation)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3573204189u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref rotation);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3573204189u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!base.isEnemyDead && base.currentBehaviourStateIndex == 0)
				{
					TriggerPeekingClientRpc(position, rotation);
				}
			}
		}

		[ClientRpc]
		private void TriggerPeekingClientRpc(Vector3 position, Quaternion rotation)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(73537988u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref rotation);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 73537988u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if ((Object)(object)fakeClaraInstance != (Object)null && !isAmbushing && base.currentBehaviourStateIndex != 2 && base.currentBehaviourStateIndex != 3)
			{
				peekingMoundPosition = position;
				fakeClaraInstance.transform.position = position;
				fakeClaraInstance.transform.rotation = rotation;
				fakeClaraInstance.SetActive(true);
				isPeeking = true;
				peekTimer = 5f;
				fakeClaraHeadBone = FindChildRecursive(fakeClaraInstance.transform, "CC_Base_NeckTwist01");
				Animator component = fakeClaraInstance.GetComponent<Animator>();
				if ((Object)(object)component != (Object)null)
				{
					component.SetBool("isPeeking", true);
				}
				LogIfDebugBuild($"[C.L.A.R.A] Jumpscare peeking triggered at: {position}");
			}
		}

		private void StopPeeking()
		{
			isPeeking = false;
			if ((Object)(object)fakeClaraInstance != (Object)null)
			{
				Animator component = fakeClaraInstance.GetComponent<Animator>();
				if ((Object)(object)component != (Object)null)
				{
					component.SetBool("isPeeking", false);
				}
				fakeClaraDeactivateTimer = 1f;
			}
		}

		[ClientRpc]
		private void StopPeekingAndWarpClientRpc(Vector3 warpPosition)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3560281727u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref warpPosition);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3560281727u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				StopPeeking();
				Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(warpPosition, default(NavMeshHit), 3f, base.agent.areaMask);
				if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled)
				{
					base.agent.Warp(navMeshPosition);
				}
				((Component)this).transform.position = navMeshPosition;
				if (((NetworkBehaviour)this).IsServer)
				{
					base.serverPosition = navMeshPosition;
					((EnemyAI)this).SyncPositionToClients();
				}
			}
		}

		private Transform FindChildRecursive(Transform parent, string name)
		{
			if (((Object)parent).name == name)
			{
				return parent;
			}
			for (int i = 0; i < parent.childCount; i++)
			{
				Transform val = FindChildRecursive(parent.GetChild(i), name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}

		private PlayerControllerB GetClosestActivePlayer(Vector3 position)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB result = null;
			float num = float.MaxValue;
			if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.allPlayerScripts != null)
			{
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val in allPlayerScripts)
				{
					if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead)
					{
						float num2 = Vector3.Distance(position, ((Component)val).transform.position);
						if (num2 < num)
						{
							num = num2;
							result = val;
						}
					}
				}
			}
			return result;
		}

		public virtual void LateUpdate()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or m