Decompiled source of SpectreLib v1.0.0

BepInEx/plugins/UhhSomething.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using UhhSomething.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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("UhhSomething")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UhhSomething")]
[assembly: AssemblyTitle("UhhSomething")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class AmbushWolfAI : EnemyAI, IVisibleThreat
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass144_0
	{
		public float time;

		public PlayerControllerB player;

		internal bool <KillAnimationOnPlayer>b__0()
		{
			if (!(Time.realtimeSinceStartup - time > 1f))
			{
				return (Object)(object)player.deadBody != (Object)null;
			}
			return true;
		}
	}

	[CompilerGenerated]
	private sealed class <KillAnimationOnPlayer>d__144 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PlayerControllerB player;

		private <>c__DisplayClass144_0 <>8__1;

		public AmbushWolfAI <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <KillAnimationOnPlayer>d__144(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>8__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			int num = <>1__state;
			AmbushWolfAI ambushWolfAI = <>4__this;
			switch (num)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>8__1 = new <>c__DisplayClass144_0();
				<>8__1.player = player;
				<>8__1.time = Time.realtimeSinceStartup;
				<>2__current = (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - <>8__1.time > 1f || (Object)(object)<>8__1.player.deadBody != (Object)null));
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if ((Object)(object)<>8__1.player.deadBody != (Object)null)
				{
					ambushWolfAI.body = <>8__1.player.deadBody;
					ambushWolfAI.body.matchPositionExactly = true;
					ambushWolfAI.body.attachedTo = ambushWolfAI.playerBodyHeadPoint;
					ambushWolfAI.body.attachedLimb = <>8__1.player.deadBody.bodyParts[0];
				}
				<>2__current = (object)new WaitForSeconds(0.25f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				ambushWolfAI.DropBody();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[Header("Bush Wolf Variables")]
	public float changeNestRangeSpeed = 0.75f;

	public float dragForce = 7f;

	public float nestRange = 15f;

	private float baseNestRange;

	public float attackDistance = 5f;

	private float baseAttackDistance;

	public float speedMultiplier;

	[Space(5f)]
	public Transform[] proceduralBodyTargets;

	public Transform[] IKTargetContainers;

	private float resetIKOffsetsInterval;

	private RaycastHit hit;

	public bool hideBodyOnTerrain;

	private int previousState = -1;

	private int[] nearbyMoldPositions;

	private Vector3 aggressivePosition;

	private Vector3 mostHiddenPosition;

	private bool foundSpawningPoint;

	private bool inKillAnimation;

	private float velX;

	private float velZ;

	private Vector3 previousPosition;

	private Vector3 agentLocalVelocity;

	public Transform animationContainer;

	private float timeSpentHiding;

	private float timeSinceAdjustingPosition;

	private Vector3 currentHidingSpot;

	public bool isHiding;

	public PlayerControllerB staringAtPlayer;

	public PlayerControllerB lastPlayerStaredAt;

	private bool backedUpFromWatchingPlayer;

	private float staringAtPlayerTimer;

	public float spottedMeter;

	private int checkForPlayerDistanceInterval;

	private int checkPlayer;

	public Vector3 rotAxis;

	public Transform turnCompass;

	private float maxAnimSpeed = 1.25f;

	private bool looking;

	private bool dragging;

	private bool startedShootingTongue;

	private float shootTongueTimer;

	public Transform tongue;

	public Transform tongueStartPoint;

	private float tongueLengthNormalized;

	private bool failedTongueShoot;

	private float randomForceInterval;

	private PlayerControllerB lastHitByPlayer;

	private float timeSinceTakingDamage;

	private float timeSinceKillingPlayer;

	private Coroutine killPlayerCoroutine;

	private DeadBodyInfo body;

	public Transform playerBodyHeadPoint;

	private float timeSinceChangingState;

	private Transform tongueTarget;

	private float tongueScale;

	public AudioClip snarlSFX;

	public AudioClip[] growlSFX;

	public AudioSource growlAudio;

	public AudioClip shootTongueSFX;

	private float timeAtLastGrowl;

	private bool playedTongueAudio;

	public AudioSource tongueAudio;

	public AudioClip tongueShootSFX;

	private bool changedHidingSpot;

	public ParticleSystem spitParticle;

	public Transform playerAnimationHeadPoint;

	public PlayerControllerB draggingPlayer;

	private float timeSinceCheckHomeBase;

	private int timesFailingTongueShoot;

	public Rig bendHeadBack;

	private float timeSinceLOSBlocked;

	public AudioClip killSFX;

	private float timeSinceCall;

	public AudioSource callClose;

	public AudioSource callFar;

	private float matingCallTimer;

	public AudioClip[] callsClose;

	public AudioClip[] callsFar;

	public AudioClip hitBushWolfSFX;

	private float timeSinceHitting;

	private float noTargetTimer;

	private float waitOutsideShipTimer;

	private MoldSpreadManager moldManager;

	private Vector3 hiddenPos;

	private bool runningAwayToNest;

	ThreatType IVisibleThreat.type => (ThreatType)8;

	bool IVisibleThreat.IsThreatDead()
	{
		return base.isEnemyDead;
	}

	GrabbableObject IVisibleThreat.GetHeldObject()
	{
		return null;
	}

	int IVisibleThreat.SendSpecialBehaviour(int id)
	{
		return 0;
	}

	int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition)
	{
		int num = 0;
		if (dragging && !startedShootingTongue)
		{
			return 1;
		}
		num = ((base.enemyHP >= 2) ? 3 : 2);
		if (Time.realtimeSinceStartup - timeSinceCall < 5f)
		{
			num += 3;
		}
		return num;
	}

	int IVisibleThreat.GetInterestLevel()
	{
		return 0;
	}

	Transform IVisibleThreat.GetThreatLookTransform()
	{
		return base.eye;
	}

	Transform IVisibleThreat.GetThreatTransform()
	{
		return ((Component)this).transform;
	}

	Vector3 IVisibleThreat.GetThreatVelocity()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		if (((NetworkBehaviour)this).IsOwner)
		{
			return base.agent.velocity;
		}
		return agentLocalVelocity;
	}

	float IVisibleThreat.GetVisibility()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		if (base.isEnemyDead)
		{
			return 0f;
		}
		if ((dragging && !startedShootingTongue) || Time.realtimeSinceStartup - timeSinceCall < 5f)
		{
			return 0.8f;
		}
		if (Vector3.Distance(((Component)this).transform.position, currentHidingSpot) < baseNestRange - 3f)
		{
			return 0.18f;
		}
		return 0.5f;
	}

	public override void AnimationEventA()
	{
		((EnemyAI)this).AnimationEventA();
		spitParticle.Play(true);
	}

	public override void Start()
	{
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).Start();
		moldManager = Object.FindObjectOfType<MoldSpreadManager>();
		resetIKOffsetsInterval = 15f;
		nearbyMoldPositions = new int[20];
		((EnemyAI)this).EnableEnemyMesh(false, false, true);
		base.inSpecialAnimation = true;
		((Behaviour)base.agent).enabled = false;
		baseAttackDistance = attackDistance;
		if (((NetworkBehaviour)this).IsServer)
		{
			if (!moldManager.GetWeeds())
			{
				((EnemyAI)this).KillEnemyOnOwnerClient(true);
				return;
			}
			mostHiddenPosition = moldManager.mostHiddenPosition;
			aggressivePosition = moldManager.aggressivePosition;
			CalculateNestRange(useCurrentHidingSpot: false);
			SyncWeedPositionsServerRpc(moldManager.mostHiddenPosition, moldManager.aggressivePosition, nestRange);
		}
	}

	private void CalculateNestRange(bool useCurrentHidingSpot)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: 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_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: 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_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: 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_0178: 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_0189: 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)
		Debug.Log((object)$"Calculating nest range! use current hiding spot: {useCurrentHidingSpot}");
		Vector3 val = mostHiddenPosition;
		if (useCurrentHidingSpot)
		{
			val = currentHidingSpot;
		}
		int allMoldPositionsInRadius = moldManager.GetAllMoldPositionsInRadius(val, 50f, true);
		if (allMoldPositionsInRadius == 0)
		{
			Debug.Log((object)"Got no weeds for nest range");
			return;
		}
		Debug.Log((object)$"Nearby weeds: {allMoldPositionsInRadius}");
		float num = 0f;
		List<float> list = new List<float>(40);
		for (int i = 0; i < allMoldPositionsInRadius; i++)
		{
			list.Add(Vector3.Distance(val, moldManager.grassInstancer.batchedPositions[moldManager.moldPositions[i]]));
		}
		list = list.OrderByDescending((float x) => x).ToList();
		num = list[list.Count / 2];
		RoundManager.Instance.tempTransform.position = mostHiddenPosition;
		RoundManager.Instance.tempTransform.localEulerAngles = new Vector3(0f, 0f, 0f);
		float num2 = 0f;
		for (int j = 0; j < 360; j += 45)
		{
			RoundManager.Instance.tempTransform.Rotate(new Vector3(0f, 45f, 0f));
			Vector3 val2 = RoundManager.Instance.tempTransform.position + RoundManager.Instance.tempTransform.forward * num;
			Debug.DrawLine(val2, RoundManager.Instance.tempTransform.position, Color.yellow, 20f);
			float closestMoldDistance = moldManager.GetClosestMoldDistance(val2);
			if (closestMoldDistance > num2)
			{
				num2 = closestMoldDistance;
			}
		}
		nestRange = num - num2 + 5f;
		Debug.Log((object)$"Nest range: {nestRange} ; '({num} - {num2}) + 5'");
		baseNestRange = nestRange;
	}

	public override void OnDrawGizmos()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).OnDrawGizmos();
		if (base.debugEnemyAI)
		{
			Gizmos.DrawWireSphere(mostHiddenPosition, nestRange);
			Gizmos.DrawSphere(hiddenPos, 5f);
		}
	}

	[ServerRpc]
	public void SyncWeedPositionsServerRpc(Vector3 hiddenPosition, Vector3 aggressivePosition, float nest)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Invalid comparison between Unknown and I4
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2297760435u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref hiddenPosition);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref aggressivePosition);
			((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref nest, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2297760435u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			SyncWeedPositionsClientRpc(hiddenPosition, aggressivePosition, nest);
		}
	}

	[ClientRpc]
	public void SyncWeedPositionsClientRpc(Vector3 hiddenPosition, Vector3 agg, float nest)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_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)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2653613967u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref hiddenPosition);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref agg);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref nest, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2653613967u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				mostHiddenPosition = hiddenPosition;
				aggressivePosition = agg;
				currentHidingSpot = mostHiddenPosition;
				nestRange = nest;
				baseNestRange = nest;
			}
		}
	}

	public PlayerControllerB GetClosestPlayerToNest()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		PlayerControllerB result = null;
		base.mostOptimalDistance = 2000f;
		for (int i = 0; i < 4; i++)
		{
			if (((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false, true))
			{
				base.tempDist = Vector3.Distance(currentHidingSpot, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					result = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
		}
		return result;
	}

	public override void DoAIInterval()
	{
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: 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_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_034a: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0364: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: 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_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).DoAIInterval();
		if (StartOfRound.Instance.livingPlayers == 0 || !foundSpawningPoint || base.isEnemyDead)
		{
			return;
		}
		switch (base.currentBehaviourStateIndex)
		{
		case 0:
		{
			if (runningAwayToNest)
			{
				break;
			}
			if (checkForPlayerDistanceInterval < 1)
			{
				checkForPlayerDistanceInterval++;
				break;
			}
			checkForPlayerDistanceInterval = 0;
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[checkPlayer];
			if (((EnemyAI)this).PlayerIsTargetable(val, false, false, true) && !((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)val).transform.position, true, false, false))
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
				bool flag = (val.timeSincePlayerMoving > 0.7f && num < attackDistance - 4.75f) || num < attackDistance - 7f;
				if (timeSinceChangingState > 0.35f && flag && !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.6f, ((Component)val.gameplayCamera).transform.position - Vector3.up * 0.3f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					base.targetPlayer = val;
					((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
					SyncTargetPlayerAndAttackServerRpc((int)val.playerClientId);
				}
				else if (base.pathDistance < nestRange && Vector3.Distance(((Component)val).transform.position, currentHidingSpot) < nestRange)
				{
					Debug.Log((object)$"Beginning attack on '{val.playerUsername}'; distance: {base.pathDistance}");
					base.targetPlayer = val;
					((EnemyAI)this).SwitchToBehaviourState(1);
				}
			}
			checkPlayer = (checkPlayer + 1) % StartOfRound.Instance.allPlayerScripts.Length;
			break;
		}
		case 1:
		{
			bool flag2 = false;
			PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false);
			if ((Object)(object)closestPlayer != (Object)null)
			{
				flag2 = true;
				float mostOptimalDistance = base.mostOptimalDistance;
				PlayerControllerB closestPlayerToNest = GetClosestPlayerToNest();
				if ((Object)(object)closestPlayerToNest != (Object)null && (Object)(object)closestPlayerToNest != (Object)(object)base.targetPlayer && (mostOptimalDistance > 9f || spottedMeter > 0.45f) && Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayerToNest).transform.position) - mostOptimalDistance < 15f)
				{
					((EnemyAI)this).SetMovingTowardsTargetPlayer(closestPlayerToNest);
				}
				else
				{
					((EnemyAI)this).SetMovingTowardsTargetPlayer(closestPlayer);
				}
			}
			if (flag2)
			{
				noTargetTimer = 0f;
				float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position);
				bool flag3 = (base.targetPlayer.timeSincePlayerMoving > 0.7f && num2 < attackDistance - 5f) || num2 < attackDistance - 7f;
				if (Vector3.Distance(currentHidingSpot, ((Component)base.targetPlayer).transform.position) > nestRange + 9f)
				{
					timeSinceAdjustingPosition = 0f;
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
				else if (timeSinceChangingState > 0.35f && flag3 && !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.6f, ((Component)base.targetPlayer.gameplayCamera).transform.position - Vector3.up * 0.3f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
					SyncTargetPlayerAndAttackServerRpc((int)base.targetPlayer.playerClientId);
				}
				else
				{
					ChooseClosestNodeToPlayer();
				}
			}
			else if (timeSinceChangingState > 0.25f)
			{
				if (noTargetTimer > 0.5f)
				{
					noTargetTimer = 0f;
					timeSinceAdjustingPosition = 0f;
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
				else
				{
					noTargetTimer += base.AIIntervalTime;
				}
			}
			break;
		}
		case 2:
			if (dragging && !startedShootingTongue && (((EnemyAI)this).PathIsIntersectedByLineOfSight(currentHidingSpot, false, false, false) || shootTongueTimer > 35f || (shootTongueTimer > 12f && Vector3.Distance(((Component)this).transform.position, currentHidingSpot) > 20f)))
			{
				timesFailingTongueShoot++;
				((EnemyAI)this).SwitchToBehaviourState(1);
			}
			break;
		}
	}

	[ServerRpc]
	public void SyncTargetPlayerAndAttackServerRpc(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_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Invalid comparison between Unknown and I4
		//IL_0114: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2652754198u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2652754198u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			SyncTargetPlayerAndAttackClientRpc(playerId);
		}
	}

	[ClientRpc]
	public void SyncTargetPlayerAndAttackClientRpc(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 val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1317746892u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1317746892u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsOwner)
			{
				base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerId];
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
			}
		}
	}

	[ServerRpc]
	public void SyncNewHidingSpotServerRpc(Vector3 newHidingSpot, float nest)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Invalid comparison between Unknown and I4
		//IL_012f: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2569300201u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref newHidingSpot);
			((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref nest, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2569300201u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			SyncNewHidingSpotClientRpc(newHidingSpot, nest);
		}
	}

	[ClientRpc]
	public void SyncNewHidingSpotClientRpc(Vector3 newHidingSpot, float nest)
	{
		//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_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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1637531219u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref newHidingSpot);
			((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref nest, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1637531219u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsOwner)
			{
				currentHidingSpot = newHidingSpot;
				nestRange = nest;
				baseNestRange = nest;
			}
		}
	}

	public Transform ChooseClosestHiddenNode(Vector3 pos)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: 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_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: 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)
		base.nodesTempArray = base.allAINodes.OrderBy((GameObject x) => Vector3.Distance(pos, x.transform.position)).ToArray();
		Transform val = null;
		if ((Object)(object)base.targetNode != (Object)null)
		{
			Physics.Linecast(((Component)base.targetPlayer.gameplayCamera).transform.position, ((Component)base.targetNode).transform.position, 1024, (QueryTriggerInteraction)1);
		}
		for (int i = 0; i < base.nodesTempArray.Length; i++)
		{
			if (!(Vector3.Distance(base.nodesTempArray[i].transform.position, currentHidingSpot) > nestRange) && !((EnemyAI)this).PathIsIntersectedByLineOfSight(base.nodesTempArray[i].transform.position, false, true, false))
			{
				base.mostOptimalDistance = Vector3.Distance(pos, base.nodesTempArray[i].transform.position);
				if ((Object)(object)val != (Object)null && base.mostOptimalDistance - Vector3.Distance(val.position, pos) > 10f)
				{
					break;
				}
				if (Physics.Linecast(((Component)base.targetPlayer.gameplayCamera).transform.position, base.nodesTempArray[i].transform.position, 1024, (QueryTriggerInteraction)1))
				{
					val = base.nodesTempArray[i].transform;
					break;
				}
				if (!base.targetPlayer.HasLineOfSightToPosition(base.nodesTempArray[i].transform.position + Vector3.up * 1.5f, 110f, 40, -1f, -1))
				{
					val = base.nodesTempArray[i].transform;
					break;
				}
				if (spottedMeter > 0.9f && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 12f)
				{
					val = base.nodesTempArray[i].transform;
				}
			}
		}
		if ((Object)(object)val != (Object)null)
		{
			base.mostOptimalDistance = Vector3.Distance(pos, ((Component)val).transform.position);
		}
		return val;
	}

	public void ChooseClosestNodeToPlayer()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: 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_00de: 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_0101: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: 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_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: 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_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)base.targetNode == (Object)null)
		{
			base.targetNode = base.allAINodes[0].transform;
		}
		Transform val = ChooseClosestHiddenNode(((Component)base.targetPlayer).transform.position);
		if ((Object)(object)val != (Object)null)
		{
			base.targetNode = val;
		}
		Vector3 val2 = Vector3.Normalize((((Component)this).transform.position - ((Component)base.targetPlayer).transform.position) * 100f) * 4f;
		val2.y = 0f;
		if ((Object)(object)base.targetNode != (Object)null)
		{
			base.mostOptimalDistance = Vector3.Distance(((Component)this).transform.position, base.targetNode.position + val2);
		}
		float num = base.targetPlayer.LineOfSightToPositionAngle(((Component)this).transform.position + Vector3.up * 0.75f, 70, -1f, -1);
		float num2 = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position);
		bool flag = num != -361f && num2 < 10f && ((num < 10f && spottedMeter > 0.25f) || (num > 90f && Vector3.Distance(((Component)base.targetPlayer).transform.position, currentHidingSpot) < nestRange - 7f));
		if (base.targetPlayer.isInElevator)
		{
			if (waitOutsideShipTimer > 18f && Vector3.Distance(((Component)this).transform.position, StartOfRound.Instance.elevatorTransform.position) < 27f)
			{
				base.movingTowardsTargetPlayer = true;
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(base.targetNode.position + val2, true);
			}
		}
		else if (flag || (num2 - base.mostOptimalDistance < 0.5f && (!((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)base.targetPlayer).transform.position, false, true, false) || num2 < 8f)))
		{
			base.movingTowardsTargetPlayer = true;
		}
		else
		{
			((EnemyAI)this).SetDestinationToPosition(base.targetNode.position + val2, true);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SetAnimationSpeedServerRpc(float animSpeed)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_0097: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(821084172u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref animSpeed, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 821084172u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				SetAnimationSpeedClientRpc(animSpeed);
			}
		}
	}

	[ClientRpc]
	public void SetAnimationSpeedClientRpc(float animSpeed)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_0097: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1367591999u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref animSpeed, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1367591999u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsOwner)
			{
				maxAnimSpeed = animSpeed;
			}
		}
	}

	public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null)
	{
		((EnemyAI)this).SetEnemyStunned(setToStunned, setToStunTime, setStunnedByPlayer);
		((EnemyAI)this).SwitchToBehaviourState(0);
		CancelKillAnimation();
		if (dragging && !startedShootingTongue && (Object)(object)base.targetPlayer != (Object)null)
		{
			dragging = false;
			base.targetPlayer.inShockingMinigame = false;
			base.targetPlayer.inSpecialInteractAnimation = false;
		}
		if ((Object)(object)setStunnedByPlayer != (Object)null)
		{
			lastHitByPlayer = setStunnedByPlayer;
		}
		timeSinceTakingDamage = 0f;
	}

	public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
	{
		((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
		base.enemyHP -= force;
		if (base.enemyHP <= 0 && !base.isEnemyDead && ((NetworkBehaviour)this).IsOwner)
		{
			((EnemyAI)this).KillEnemyOnOwnerClient(false);
		}
		base.creatureAnimator.SetTrigger("HitEnemy");
		timeSinceTakingDamage = 0f;
		if ((Object)(object)playerWhoHit != (Object)null)
		{
			lastHitByPlayer = playerWhoHit;
		}
		if (((NetworkBehaviour)this).IsOwner)
		{
			CancelKillAnimation();
			if (base.currentBehaviourStateIndex == 2)
			{
				((EnemyAI)this).SwitchToBehaviourState(0);
			}
		}
		CancelReelingPlayerIn();
		base.creatureVoice.PlayOneShot(hitBushWolfSFX);
	}

	private void CancelReelingPlayerIn()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		if (previousState == 2 || previousState == 1 || base.currentBehaviourStateIndex == 2)
		{
			if (dragging)
			{
				base.creatureVoice.Stop();
			}
			growlAudio.Stop();
			tongueAudio.Stop();
			playedTongueAudio = false;
			tongueTarget = null;
			tongue.localScale = Vector3.one;
			base.creatureAnimator.SetBool("ReelingPlayerIn", false);
			base.creatureAnimator.SetBool("ShootTongue", false);
			shootTongueTimer = 0f;
			timeSinceAdjustingPosition = 0f;
			if ((Object)(object)draggingPlayer != (Object)null)
			{
				draggingPlayer.inShockingMinigame = false;
				draggingPlayer.inSpecialInteractAnimation = false;
				draggingPlayer.shockingTarget = null;
				draggingPlayer.disableInteract = false;
			}
			draggingPlayer = null;
			dragging = false;
			startedShootingTongue = false;
		}
	}

	private void DoGrowlLocalClient()
	{
		timeAtLastGrowl = Time.realtimeSinceStartup;
		growlAudio.PlayOneShot(growlSFX[Random.Range(0, growlSFX.Length)]);
		if (((NetworkBehaviour)this).IsOwner)
		{
			DoGrowlServerRpc();
		}
	}

	[ServerRpc]
	public void DoGrowlServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Invalid comparison between Unknown and I4
		//IL_0107: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3735194043u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3735194043u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			DoGrowlClientRpc();
		}
	}

	[ClientRpc]
	public void DoGrowlClientRpc()
	{
		//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)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3928884262u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3928884262u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsOwner)
			{
				DoGrowlLocalClient();
			}
		}
	}

	[ServerRpc]
	public void SeeBushWolfServerRpc(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_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Invalid comparison between Unknown and I4
		//IL_0114: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2278982227u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2278982227u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			SeeBushWolfClientRpc(playerId);
		}
	}

	[ClientRpc]
	public void SeeBushWolfClientRpc(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 val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3455050024u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3455050024u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (playerId == (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
			{
				SetFearLevelFromBushWolf();
			}
		}
	}

	private void SetFearLevelFromBushWolf()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
		if (Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)this).transform.position) < 10f)
		{
			localPlayerController.JumpToFearLevel(0.6f, true);
		}
		else
		{
			localPlayerController.JumpToFearLevel(0.3f, true);
		}
	}

	public override void OnDestroy()
	{
		((EnemyAI)this).OnDestroy();
		CancelReelingPlayerIn();
	}

	public override void KillEnemy(bool destroy = false)
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).KillEnemy(destroy);
		if (!destroy)
		{
			growlAudio.Stop();
			callClose.Stop();
			callFar.Stop();
			base.creatureSFX.Stop();
			base.creatureVoice.Stop();
			CancelKillAnimation();
			base.creatureVoice.PlayOneShot(base.dieSFX);
			WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, base.dieSFX, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)base.creatureVoice).transform.position, 20f, 0.7f, 0, base.isInsidePlayerShip && StartOfRound.Instance.hangarDoorsClosed, 0);
			CancelReelingPlayerIn();
		}
	}

	public void HitTongue(PlayerControllerB playerWhoHit, int hitID)
	{
		if (dragging && !startedShootingTongue)
		{
			int playerWhoHit2 = -1;
			if ((Object)(object)playerWhoHit != (Object)null)
			{
				playerWhoHit2 = (int)playerWhoHit.playerClientId;
				HitTongueLocalClient();
			}
			HitTongueServerRpc(playerWhoHit2);
		}
	}

	private void HitTongueLocalClient()
	{
		timeSinceTakingDamage = 0f;
		base.creatureVoice.PlayOneShot(hitBushWolfSFX);
		base.creatureAnimator.ResetTrigger("HitEnemy");
		base.creatureAnimator.SetTrigger("HitEnemy");
		CancelReelingPlayerIn();
		((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0);
	}

	[ServerRpc(RequireOwnership = false)]
	public void HitTongueServerRpc(int playerWhoHit)
	{
		//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 val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(888615432u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerWhoHit);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 888615432u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				HitTongueClientRpc(playerWhoHit);
			}
		}
	}

	[ClientRpc]
	public void HitTongueClientRpc(int playerWhoHit)
	{
		//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 val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3168228498u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerWhoHit);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3168228498u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if ((int)GameNetworkManager.Instance.localPlayerController.playerClientId != playerWhoHit)
			{
				HitTongueLocalClient();
			}
		}
	}

	private void CheckHomeBase(bool overrideInterval = false)
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: 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_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		if (!((NetworkBehaviour)this).IsOwner || ((!overrideInterval || !(Time.realtimeSinceStartup - timeSinceCheckHomeBase > 5f)) && !(Time.realtimeSinceStartup - timeSinceCheckHomeBase > 30f)))
		{
			return;
		}
		timeSinceCheckHomeBase = Time.realtimeSinceStartup;
		Vector3 val = mostHiddenPosition;
		if (moldManager.GetWeeds())
		{
			mostHiddenPosition = moldManager.mostHiddenPosition;
			aggressivePosition = moldManager.aggressivePosition;
			if (val != mostHiddenPosition || changedHidingSpot)
			{
				CalculateNestRange(useCurrentHidingSpot: false);
			}
			changedHidingSpot = false;
			SyncWeedPositionsClientRpc(mostHiddenPosition, aggressivePosition, nestRange);
		}
	}

	private void DoMatingCall()
	{
		if (((NetworkBehaviour)this).IsOwner)
		{
			MatingCallServerRpc();
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void MatingCallServerRpc()
	{
		//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 val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1734476257u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1734476257u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				MatingCallClientRpc();
			}
		}
	}

	[ClientRpc]
	public void MatingCallClientRpc()
	{
		//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_0151: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2179972878u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2179972878u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				matingCallTimer = 2.2f;
				base.creatureAnimator.SetTrigger("MatingCall");
				int num = Random.Range(0, callsClose.Length);
				callClose.PlayOneShot(callsClose[num]);
				WalkieTalkie.TransmitOneShotAudio(callClose, callsClose[num], 1f);
				callFar.PlayOneShot(callsFar[num]);
				WalkieTalkie.TransmitOneShotAudio(callFar, callsFar[num], 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 20f, 0.6f, 0, false, 245403);
			}
		}
	}

	public override void Update()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: 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_00e0: 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_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_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: 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_128f: Unknown result type (might be due to invalid IL or missing references)
		//IL_038b: 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_0c5f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c6a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c75: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c85: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c8a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c94: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c99: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ca3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ca8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: 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_0ed8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ee8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0483: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: 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_04d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0756: Unknown result type (might be due to invalid IL or missing references)
		//IL_0761: Unknown result type (might be due to invalid IL or missing references)
		//IL_0766: Unknown result type (might be due to invalid IL or missing references)
		//IL_0770: Unknown result type (might be due to invalid IL or missing references)
		//IL_0775: 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_053a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d47: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d52: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d71: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_07cb: 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_0554: Unknown result type (might be due to invalid IL or missing references)
		//IL_0558: Unknown result type (might be due to invalid IL or missing references)
		//IL_055e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0565: Unknown result type (might be due to invalid IL or missing references)
		//IL_056a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0572: Unknown result type (might be due to invalid IL or missing references)
		//IL_0577: Unknown result type (might be due to invalid IL or missing references)
		//IL_0581: Unknown result type (might be due to invalid IL or missing references)
		//IL_0586: Unknown result type (might be due to invalid IL or missing references)
		//IL_058d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0592: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fc2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fd2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0604: Unknown result type (might be due to invalid IL or missing references)
		//IL_1539: Unknown result type (might be due to invalid IL or missing references)
		//IL_153e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1548: Unknown result type (might be due to invalid IL or missing references)
		//IL_155d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1562: Unknown result type (might be due to invalid IL or missing references)
		//IL_149b: Unknown result type (might be due to invalid IL or missing references)
		//IL_14ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_14bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_14d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_14e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0941: Unknown result type (might be due to invalid IL or missing references)
		//IL_0946: Unknown result type (might be due to invalid IL or missing references)
		//IL_0954: Unknown result type (might be due to invalid IL or missing references)
		//IL_064a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0655: Unknown result type (might be due to invalid IL or missing references)
		//IL_065a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0664: Unknown result type (might be due to invalid IL or missing references)
		//IL_0669: Unknown result type (might be due to invalid IL or missing references)
		//IL_105e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1063: Unknown result type (might be due to invalid IL or missing references)
		//IL_106d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1072: Unknown result type (might be due to invalid IL or missing references)
		//IL_068a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0695: Unknown result type (might be due to invalid IL or missing references)
		//IL_10d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_10d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_1632: Unknown result type (might be due to invalid IL or missing references)
		//IL_1638: Unknown result type (might be due to invalid IL or missing references)
		//IL_1660: Unknown result type (might be due to invalid IL or missing references)
		//IL_166b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1675: Unknown result type (might be due to invalid IL or missing references)
		//IL_167a: Unknown result type (might be due to invalid IL or missing references)
		//IL_167f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1689: Unknown result type (might be due to invalid IL or missing references)
		//IL_168e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1693: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e43: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e53: Unknown result type (might be due to invalid IL or missing references)
		//IL_1196: Unknown result type (might be due to invalid IL or missing references)
		//IL_11a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_1143: Unknown result type (might be due to invalid IL or missing references)
		//IL_1152: Unknown result type (might be due to invalid IL or missing references)
		//IL_15e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_15a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_15b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b0b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b33: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b38: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b3f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b45: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b4c: Unknown result type (might be due to invalid IL or missing references)
		//IL_11cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c67: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c80: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c85: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c8f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c94: Unknown result type (might be due to invalid IL or missing references)
		//IL_16ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_16f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_16c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_16d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_1cb1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1cc5: Unknown result type (might be due to invalid IL or missing references)
		//IL_17c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_17cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_175f: Unknown result type (might be due to invalid IL or missing references)
		//IL_17f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_17f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_1800: Unknown result type (might be due to invalid IL or missing references)
		//IL_1805: Unknown result type (might be due to invalid IL or missing references)
		//IL_180a: Unknown result type (might be due to invalid IL or missing references)
		//IL_1817: Unknown result type (might be due to invalid IL or missing references)
		//IL_181c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1821: Unknown result type (might be due to invalid IL or missing references)
		//IL_182b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1830: Unknown result type (might be due to invalid IL or missing references)
		//IL_183a: Unknown result type (might be due to invalid IL or missing references)
		//IL_18ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_18ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_18f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_18fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_1908: Unknown result type (might be due to invalid IL or missing references)
		//IL_190d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1918: Unknown result type (might be due to invalid IL or missing references)
		//IL_191f: Unknown result type (might be due to invalid IL or missing references)
		//IL_193f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1944: Unknown result type (might be due to invalid IL or missing references)
		//IL_1949: Unknown result type (might be due to invalid IL or missing references)
		//IL_177b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1880: Unknown result type (might be due to invalid IL or missing references)
		//IL_1860: Unknown result type (might be due to invalid IL or missing references)
		//IL_1865: Unknown result type (might be due to invalid IL or missing references)
		//IL_186f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1874: Unknown result type (might be due to invalid IL or missing references)
		//IL_1879: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a57: Unknown result type (might be due to invalid IL or missing references)
		//IL_1797: Unknown result type (might be due to invalid IL or missing references)
		//IL_179c: Unknown result type (might be due to invalid IL or missing references)
		//IL_17aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_18ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_18b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_18ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_18bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_18c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a99: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a9e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1aa0: Unknown result type (might be due to invalid IL or missing references)
		//IL_1aa5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ab5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ac0: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ac5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ada: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ae5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1aea: Unknown result type (might be due to invalid IL or missing references)
		//IL_1976: Unknown result type (might be due to invalid IL or missing references)
		//IL_1995: Unknown result type (might be due to invalid IL or missing references)
		//IL_19b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_19d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_19e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a02: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a17: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a3d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a3f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a49: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a4e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a53: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a23: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a25: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a2f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a34: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a39: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).Update();
		if (looking)
		{
			looking = false;
		}
		else
		{
			base.agent.updateRotation = true;
		}
		if (!foundSpawningPoint)
		{
			if (!(mostHiddenPosition != Vector3.zero))
			{
				return;
			}
			Debug.DrawRay(mostHiddenPosition, Vector3.up * 2f, Color.red, 15f);
			foundSpawningPoint = true;
			Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(mostHiddenPosition, default(NavMeshHit), 12f, -1);
			if (!RoundManager.Instance.GotNavMeshPositionResult)
			{
				navMeshPosition = RoundManager.Instance.GetNavMeshPosition(aggressivePosition, default(NavMeshHit), 12f, -1);
				if (!RoundManager.Instance.GotNavMeshPositionResult && ((NetworkBehaviour)this).IsOwner)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(true);
				}
			}
			((Component)this).transform.position = navMeshPosition;
			currentHidingSpot = navMeshPosition;
			base.inSpecialAnimation = false;
			((EnemyAI)this).EnableEnemyMesh(true, false, false);
			isHiding = true;
			if (((NetworkBehaviour)this).IsOwner)
			{
				((EnemyAI)this).SetDestinationToPosition(mostHiddenPosition, false);
			}
			return;
		}
		if (!base.ventAnimationFinished)
		{
			base.serverPosition = mostHiddenPosition;
			((Component)this).transform.position = mostHiddenPosition;
		}
		if (inKillAnimation || base.isEnemyDead)
		{
			tongueTarget = null;
		}
		if (StartOfRound.Instance.livingPlayers == 0 || base.isEnemyDead || !foundSpawningPoint)
		{
			return;
		}
		base.creatureAnimator.SetBool("stunned", base.stunNormalizedTimer > 0f);
		if (base.stunNormalizedTimer > 0f || matingCallTimer >= 0f)
		{
			matingCallTimer -= Time.deltaTime;
			base.agent.speed = 0f;
			return;
		}
		timeSinceTakingDamage += Time.deltaTime;
		timeSinceKillingPlayer += Time.deltaTime;
		timeSinceHitting += Time.deltaTime;
		CalculateAnimationDirection(maxAnimSpeed);
		timeSinceChangingState += Time.deltaTime;
		switch (base.currentBehaviourStateIndex)
		{
		case 0:
		{
			if (previousState != base.currentBehaviourStateIndex)
			{
				SetAnimationSpeedServerRpc(1.3f);
				backedUpFromWatchingPlayer = false;
				base.moveTowardsDestination = true;
				base.movingTowardsTargetPlayer = false;
				timeSpentHiding = 0f;
				timeSinceChangingState = 0f;
				CancelReelingPlayerIn();
				nestRange = Mathf.Clamp(nestRange / 2f, baseNestRange * 0.75f, 140f);
				previousState = base.currentBehaviourStateIndex;
			}
			if (((NetworkBehaviour)this).IsOwner && Vector3.Distance(((Component)this).transform.position, currentHidingSpot) < Mathf.Clamp(baseNestRange + 2f, 14f, 30f) && timeSinceChangingState > 0.5f && timeSinceTakingDamage < 2.5f && (Object)(object)lastHitByPlayer != (Object)null)
			{
				((EnemyAI)this).SetMovingTowardsTargetPlayer(lastHitByPlayer);
				base.agent.speed = 6f * speedMultiplier;
				runningAwayToNest = false;
				break;
			}
			if (timeSinceKillingPlayer < 2f || timeSinceTakingDamage < 0.35f)
			{
				base.agent.speed = 0f;
				break;
			}
			if (timeSinceTakingDamage < 4f && base.enemyHP < 4 && Vector3.Distance(((Component)this).transform.position, currentHidingSpot) > baseNestRange)
			{
				base.agent.speed = 12f;
				((EnemyAI)this).SetDestinationToPosition(currentHidingSpot, false);
				runningAwayToNest = true;
			}
			else
			{
				runningAwayToNest = false;
				inKillAnimation = false;
			}
			isHiding = true;
			if (!((NetworkBehaviour)this).IsOwner)
			{
				break;
			}
			timeSpentHiding += Time.deltaTime;
			if (Object.op_Implicit((Object)(object)staringAtPlayer))
			{
				LookAtPosition(((Component)staringAtPlayer).transform.position);
				staringAtPlayerTimer += Time.deltaTime;
				if (staringAtPlayerTimer > 4f)
				{
					spottedMeter = 0f;
					backedUpFromWatchingPlayer = false;
					staringAtPlayer = null;
				}
				else if (staringAtPlayerTimer > 0.55f)
				{
					if (backedUpFromWatchingPlayer)
					{
						break;
					}
					backedUpFromWatchingPlayer = true;
					if (Vector3.Distance(((Component)this).transform.position, currentHidingSpot) < 6f)
					{
						Vector3 val4 = ((Component)this).transform.position - ((Component)staringAtPlayer).transform.position;
						val4.y = 0f;
						Ray val5 = default(Ray);
						((Ray)(ref val5))..ctor(((Component)this).transform.position + Vector3.up * 0.5f, val4);
						val4 = ((!Physics.Raycast(val5, ref hit, 4.6f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) ? ((Ray)(ref val5)).GetPoint(4.6f) : ((Ray)(ref val5)).GetPoint(Mathf.Clamp(((RaycastHit)(ref hit)).distance - 1f, 0f, ((RaycastHit)(ref hit)).distance)));
						val4 = RoundManager.Instance.GetNavMeshPosition(val4, default(NavMeshHit), 5f, -1);
						Debug.DrawRay(((Component)this).transform.position + Vector3.up * 0.5f, ((Ray)(ref val5)).direction, Color.red, 5f);
						Debug.DrawRay(val4, Vector3.up, Color.green, 5f);
						if (RoundManager.Instance.GotNavMeshPositionResult)
						{
							((EnemyAI)this).SetDestinationToPosition(val4, false);
							base.moveTowardsDestination = true;
							base.agent.speed = 5f * speedMultiplier;
							if (Vector3.Distance(((Component)this).transform.position, ((Component)staringAtPlayer).transform.position) < 18f && Random.Range(0, 100) < 50 && Time.realtimeSinceStartup - timeAtLastGrowl > 5f)
							{
								DoGrowlLocalClient();
							}
							if (Physics.Linecast(((Component)staringAtPlayer.gameplayCamera).transform.position, ((Component)this).transform.position + Vector3.up * 0.5f, ref hit, 1024, (QueryTriggerInteraction)1) && Vector3.Distance(((RaycastHit)(ref hit)).point, ((Component)this).transform.position) < 6f)
							{
								SeeBushWolfServerRpc((int)staringAtPlayer.playerClientId);
							}
						}
					}
					else
					{
						base.agent.speed = 0f;
					}
				}
				else
				{
					base.agent.speed = 0f;
				}
				break;
			}
			int num3 = 0;
			int num4 = 0;
			int num5 = -1;
			float num6 = 2555f;
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				if (StartOfRound.Instance.allPlayerScripts[i].isPlayerDead || !StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled || Object.op_Implicit((Object)(object)StartOfRound.Instance.allPlayerScripts[i].inAnimationWithEnemy) || Physics.Linecast(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, ((Component)this).transform.position + Vector3.up * 0.5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					continue;
				}
				float num7 = Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position, ((Component)this).transform.position);
				float num8 = StartOfRound.Instance.allPlayerScripts[i].LineOfSightToPositionAngle(((Component)this).transform.position, 40, -1f, -1);
				if (num8 == -361f || num7 > 70f)
				{
					continue;
				}
				if (num8 < 10f || (num8 < 20f && num7 < 20f))
				{
					num3 += 2;
					num4++;
					if (num7 < num6)
					{
						num6 = num7;
						num5 = i;
					}
				}
				else if (num8 < 20f)
				{
					num4++;
					num3++;
					if (num7 < num6)
					{
						num6 = num7;
						num5 = i;
					}
				}
			}
			if (num4 <= 0)
			{
				spottedMeter = Mathf.Max(spottedMeter - Time.deltaTime * 0.75f, 0f);
			}
			else if (num4 >= Mathf.Max(StartOfRound.Instance.livingPlayers - 2, 0))
			{
				spottedMeter = Mathf.Min(spottedMeter + 0.25f * Time.deltaTime * (float)num3, 1f);
			}
			if (spottedMeter >= 1f && timeSinceChangingState > 1.2f)
			{
				staringAtPlayerTimer = 0f;
				backedUpFromWatchingPlayer = false;
				staringAtPlayer = StartOfRound.Instance.allPlayerScripts[num5];
				lastPlayerStaredAt = staringAtPlayer;
			}
			float num9 = 15f;
			if (timeSpentHiding > 70f && spottedMeter <= 0f && !changedHidingSpot)
			{
				changedHidingSpot = true;
				currentHidingSpot = aggressivePosition;
				CalculateNestRange(useCurrentHidingSpot: true);
				SyncNewHidingSpotServerRpc(aggressivePosition, nestRange);
			}
			if (timeSpentHiding > 36f)
			{
				num9 = 4f;
			}
			else if (timeSpentHiding > 25f)
			{
				num9 = 7f;
			}
			else if (timeSpentHiding > 15f)
			{
				num9 = 10f;
			}
			if (spottedMeter > 0.2f)
			{
				nestRange = Mathf.Clamp(nestRange - changeNestRangeSpeed * Mathf.Clamp(spottedMeter * 4f, 1f, 4f) * Time.deltaTime, baseNestRange * 0.75f, baseNestRange + 20f);
			}
			else if (nestRange - baseNestRange > 15f)
			{
				nestRange = Mathf.Clamp(nestRange + changeNestRangeSpeed * Time.deltaTime * 0.15f, baseNestRange * 0.75f, baseNestRange + 18f);
			}
			else
			{
				nestRange = Mathf.Clamp(nestRange + changeNestRangeSpeed * Time.deltaTime, baseNestRange * 0.75f, baseNestRange + 18f);
			}
			if (matingCallTimer <= 0f && timeSpentHiding > 10f && spottedMeter < 0.6f && Time.realtimeSinceStartup - timeSinceCall > 7f)
			{
				timeSinceCall = Time.realtimeSinceStartup;
				if (Random.Range(0, 100) < 8)
				{
					DoMatingCall();
				}
			}
			if (Time.realtimeSinceStartup - timeSinceAdjustingPosition > num9)
			{
				timeSinceAdjustingPosition = Time.realtimeSinceStartup;
				((EnemyAI)this).SetDestinationToPosition(RoundManager.Instance.GetNavMeshPosition(currentHidingSpot + new Vector3(Random.Range(-3f, 3f), 0f, Random.Range(-3f, 3f)), default(NavMeshHit), 5f, -1), false);
				if (timeSinceTakingDamage < 2f)
				{
					base.agent.speed = 14f * speedMultiplier;
				}
				else
				{
					base.agent.speed = 10f * speedMultiplier;
				}
			}
			CheckHomeBase();
			break;
		}
		case 1:
		{
			if (previousState != base.currentBehaviourStateIndex)
			{
				spottedMeter = 0f;
				staringAtPlayer = null;
				timeSpentHiding = 0f;
				noTargetTimer = 0f;
				waitOutsideShipTimer = 0f;
				CancelReelingPlayerIn();
				previousState = base.currentBehaviourStateIndex;
			}
			if (timeSinceKillingPlayer < 2f || timeSinceTakingDamage < 0.35f)
			{
				base.agent.speed = 0f;
				break;
			}
			inKillAnimation = false;
			if (!((NetworkBehaviour)this).IsOwner || (Object)(object)base.targetPlayer == (Object)null)
			{
				break;
			}
			int num10 = 0;
			float num11 = 4f;
			bool flag = false;
			bool flag2 = (Object)(object)base.targetNode != (Object)null && Vector3.Distance(((Component)this).transform.position, base.targetNode.position + Vector3.Normalize((((Component)this).transform.position - ((Component)base.targetPlayer).transform.position) * 100f) * 4f) < 0.8f;
			bool flag3 = false;
			float num12;
			for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++)
			{
				flag3 = false;
				if (StartOfRound.Instance.allPlayerScripts[j].isPlayerDead || !StartOfRound.Instance.allPlayerScripts[j].isPlayerControlled || Object.op_Implicit((Object)(object)StartOfRound.Instance.allPlayerScripts[j].inAnimationWithEnemy) || (StartOfRound.Instance.allPlayerScripts[j].isInHangarShipRoom && base.isInsidePlayerShip))
				{
					continue;
				}