Decompiled source of Surfaced v1.0.1
plugins/LC-Surfaced/Surfaced.dll
Decompiled 13 minutes ago
The result has been truncated due to the large size, download it to view full contents!
#define DEBUG 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.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using SolidLib; using SolidLib.Components.Sound; using SolidLib.Registry; using Surfaced; using Surfaced.Configuration; using Surfaced.NetcodePatcher; using Unity.Mathematics; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Surfaced")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds Aquatic themed content.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5dd93620fa94be6eacf88bcd7f00b46fb2c5c487")] [assembly: AssemblyProduct("Surfaced")] [assembly: AssemblyTitle("Surfaced")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 BruceNoseHit : NetworkBehaviour, IHittable { public BruceAI bruce; bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { if ((Object)(object)playerWhoHit == (Object)null) { Plugin.Logger.LogDebug((object)"Bruce stunned by a null player."); } if (((NetworkBehaviour)bruce).IsHost) { StunHitClientRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoHit)); } else { StunHitServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoHit)); } return true; } [ServerRpc(RequireOwnership = false)] private void StunHitServerRpc(int playerWhoHitIndex) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3947990952u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerWhoHitIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3947990952u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StunHitClientRpc(playerWhoHitIndex); } } } [ClientRpc] private void StunHitClientRpc(int playerWhoHitIndex) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1883917334u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerWhoHitIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1883917334u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((EnemyAI)bruce).SetEnemyStunned(true, 3f, StartOfRound.Instance.allPlayerScripts[playerWhoHitIndex]); ((EnemyAI)bruce).creatureAnimator.SetTrigger("Stun"); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_BruceNoseHit() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3947990952u, new RpcReceiveHandler(__rpc_handler_3947990952)); NetworkManager.__rpc_func_table.Add(1883917334u, new RpcReceiveHandler(__rpc_handler_1883917334)); } private static void __rpc_handler_3947990952(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerWhoHitIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoHitIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((BruceNoseHit)(object)target).StunHitServerRpc(playerWhoHitIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1883917334(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerWhoHitIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoHitIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((BruceNoseHit)(object)target).StunHitClientRpc(playerWhoHitIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BruceNoseHit"; } } public class Seamine : NetworkBehaviour, IHittable { private bool mineActivated = true; public bool hasExploded; public ParticleSystem explosionParticle; public AudioSource mineAudio; public AudioSource mineFarAudio; public AudioClip mineDetonate; public AudioClip mineTrigger; public AudioClip mineBeep; public AudioClip mineDetonateFar; private bool sendingExplosionRPC; private RaycastHit hit; private void Start() { ((MonoBehaviour)this).StartCoroutine(StartIdleAnimation()); } private IEnumerator StartIdleAnimation() { while (true) { yield return (object)new WaitForSeconds(Random.Range(10f, 15f)); mineAudio.PlayOneShot(mineBeep, 0.1f); mineAudio.pitch = Random.Range(0.9f, 1.1f); } } private void OnTriggerEnter(Collider other) { if (hasExploded || !mineActivated) { return; } Debug.Log((object)((Object)other).name); if (((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && !((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { TriggerMineOnLocalClientByExiting(); } } else { if (!((Component)other).tag.StartsWith("PlayerRagdoll") && !((Component)other).CompareTag("PhysicsProp")) { return; } if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<DeadBodyInfo>())) { if ((Object)(object)((Component)other).GetComponent<DeadBodyInfo>().playerScript != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } } else if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<GrabbableObject>()) && !((NetworkBehaviour)((Component)other).GetComponent<GrabbableObject>()).NetworkObject.IsOwner) { return; } TriggerMineOnLocalClientByExiting(); } } private void TriggerMineOnLocalClientByExiting() { if (!hasExploded) { SetOffMineAnimation(); sendingExplosionRPC = true; ExplodeMineServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void ExplodeMineServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(711067059u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 711067059u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ExplodeMineClientRpc(); } } } [ClientRpc] public void ExplodeMineClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3889305919u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3889305919u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (sendingExplosionRPC) { sendingExplosionRPC = false; } else { SetOffMineAnimation(); } } } public void SetOffMineAnimation() { hasExploded = true; mineAudio.PlayOneShot(mineTrigger, 1f); ((MonoBehaviour)this).StartCoroutine(DetonateDelay()); } private IEnumerator DetonateDelay() { yield return (object)new WaitForSeconds(0.5f); Detonate(); yield return (object)new WaitForSeconds(0.1f); if (((NetworkBehaviour)this).IsServer) { Object.Destroy((Object)(object)((Component)((Component)this).transform.parent).gameObject); } } private IEnumerator TriggerOtherMineDelayed(Landmine mine) { if (!mine.hasExploded) { mine.mineAudio.pitch = Random.Range(0.75f, 1.07f); mine.hasExploded = true; yield return (object)new WaitForSeconds(0.2f); mine.SetOffMineAnimation(); } } public void Detonate() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) mineAudio.pitch = Random.Range(0.93f, 1.07f); mineAudio.PlayOneShot(mineDetonate, 1f); CreateExplosion(((Component)this).transform.position + Vector3.up, spawnExplosionEffect: true, 100, 5.7f, 6f, 6, (CauseOfDeath)3); } public void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 1f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0131: 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_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Spawning explosion at pos: {explosionPosition}"); Transform val = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } if (spawnExplosionEffect) { Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true); } float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition); if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2); PlayerControllerB val2 = null; for (int i = 0; i < array.Length; i++) { float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position); if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } Vector3 val3; if (((Component)array[i]).gameObject.layer == 3) { val2 = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner) { float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange)); val3 = ((Component)val2).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; ((Component)val2).GetComponent<Rigidbody>().AddForce(normalized * 500f); Vector3 val4 = Vector3.Normalize((((Component)val2).transform.position + Vector3.up * 0.75f - ((Component)this).transform.position) * 100f) * 30f; val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, val4); } } else if (((Component)array[i]).gameObject.layer == 21) { Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f) { Debug.Log((object)"Setting off other mine"); ((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren)); } } else if (((Component)array[i]).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>(); if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f) { EnemyAI mainScript = componentInChildren2.mainScript; val3 = default(Vector3); mainScript.HitEnemyOnLocalClient(enemyHitForce, val3, attacker, false, -1); } } } int num4 = ~LayerMask.GetMask(new string[1] { "Room" }); num4 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(explosionPosition, 10f, num4); for (int j = 0; j < array.Length; j++) { Rigidbody component = ((Component)array[j]).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.AddExplosionForce(70f, explosionPosition, 10f); } } } public bool MineHasLineOfSight(Vector3 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return !Physics.Linecast(((Component)this).transform.position, pos, ref hit, 256); } bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { SetOffMineAnimation(); sendingExplosionRPC = true; ExplodeMineServerRpc(); return true; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Seamine() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(711067059u, new RpcReceiveHandler(__rpc_handler_711067059)); NetworkManager.__rpc_func_table.Add(3889305919u, new RpcReceiveHandler(__rpc_handler_3889305919)); } private static void __rpc_handler_711067059(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((Seamine)(object)target).ExplodeMineServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3889305919(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((Seamine)(object)target).ExplodeMineClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Seamine"; } } namespace Scary { internal class ScaryAI : EnemyAI { private enum State { MovingToPlayer, Teleporting } public Transform turnCompass = null; private float timeSinceHittingLocalPlayer; private float timeSinceLastProximitySound; private Random enemyRandom = null; private Coroutine? PerformTeleportCoroutine; private NavMeshAgent agent; private AudioSourceHandle scarySound; public AudioClip PoofSoundClip; public AudioClip ScareSoundClip; public ParticleSystem Poofps; private bool jumpscaring; private Vector3 lastPosition; private float inactivityTimer; [Header("SoundSets")] [SerializeField] private SoundSet LureSoundSet; private UniqueRandomizer LureRandomizer; [SerializeField] private Transform movementSource; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown ((EnemyAI)this).Start(); Plugin.Logger.LogInfo((object)"IMPENDING DOOM APPROACHES..."); LureRandomizer = new UniqueRandomizer(LureSoundSet); timeSinceHittingLocalPlayer = 0f; timeSinceLastProximitySound = 0f; enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); base.currentBehaviourStateIndex = 0; agent = ((Component)this).GetComponent<NavMeshAgent>(); } public void PlayLureSound() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) int nextStableRandomIndex = LureRandomizer.GetNextStableRandomIndex(); scarySound = SSoundManager.main.PlaySound(LureSoundSet.GetAudioClipName(nextStableRandomIndex), movementSource.position, 0.6f, 1f, 25f, true, movementSource, ((NetworkBehaviour)this).NetworkObject, 0f, true); WalkieTalkieExtensions.TransmitOneShotAudio(movementSource, LureSoundSet.GetAudioClip(nextStableRandomIndex), 0.4f, 1f); } public override void Update() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00bb: 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_00f9: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); timeSinceHittingLocalPlayer += Time.deltaTime; if (!jumpscaring) { timeSinceLastProximitySound += Time.deltaTime; } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 0) { turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime); } if (((NetworkBehaviour)this).IsHost && (Object)(object)base.targetPlayer != (Object)null) { float num = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position); if (num > 5f && !jumpscaring) { CheckInactivity(); } } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead) { switch (base.currentBehaviourStateIndex) { case 0: agent.speed = (jumpscaring ? 0f : 9f); MoveToClosestPlayer(); break; case 1: agent.speed = 0f; TeleportToRandomNode(); break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } } private void MoveToClosestPlayer() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (TargetClosestPlayerInAnyCase() && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 3f) { if (timeSinceLastProximitySound >= (float)enemyRandom.Next(7, 17)) { LogIfDebugBuild("Near Player, playing sound."); PlayLureSound(); timeSinceLastProximitySound = 0f; } if (PerformTeleportCoroutine == null) { PerformTeleportCoroutine = ((MonoBehaviour)this).StartCoroutine(PerformTeleportIfFacingPlayer()); } } else { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); } } private IEnumerator PerformTeleportIfFacingPlayer() { if ((Object)(object)base.targetPlayer != (Object)null) { Vector3 lookat = Vector3.Normalize(((Component)base.targetPlayer.gameplayCamera).transform.position - ((Component)this).transform.position); float distance = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position); if (distance < 5f && Vector3.Dot(lookat, ((Component)base.targetPlayer.gameplayCamera).transform.forward) < -0.9f) { inactivityTimer = 0f; Plugin.Logger.LogInfo((object)"JUMPSCARE"); jumpscaring = true; SSoundManager.main.StopSound(scarySound); SSoundManager.main.PlaySound(((Object)ScareSoundClip).name, movementSource.position, 0.4f, 1f, 25f, true, movementSource, ((NetworkBehaviour)this).NetworkObject, 0f, true); yield return (object)new WaitForSeconds(5f); SSoundManager.main.PlaySound(((Object)PoofSoundClip).name, movementSource.position, 0.4f, 1f, 25f, true, movementSource, ((NetworkBehaviour)this).NetworkObject, 0f, true); EmitPSClientRpc(); yield return (object)new WaitForSeconds(0.35f); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); jumpscaring = false; } } PerformTeleportCoroutine = null; } private void TeleportToRandomNode() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) Vector3 randomAINodePosition = GetRandomAINodePosition(); if (randomAINodePosition != Vector3.zero) { LogIfDebugBuild($"Teleporting to position: {randomAINodePosition}"); agent.Warp(randomAINodePosition); LogIfDebugBuild("Scary Enemy teleported to a new position."); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } else { LogIfDebugBuild("No valid AI nodes found for teleportation!"); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } private Vector3 GetRandomAINodePosition() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) GameObject[] array = GameObject.FindGameObjectsWithTag("AINode"); if (array.Length == 0) { return Vector3.zero; } float num = 5f; List<Vector3> list = new List<Vector3>(); GameObject[] array2 = array; foreach (GameObject val in array2) { bool flag = true; GameObject[] array3 = array; foreach (GameObject val2 in array3) { if ((Object)(object)val != (Object)(object)val2 && Vector3.Distance(val.transform.position, val2.transform.position) < num) { flag = false; break; } } if (flag) { list.Add(val.transform.position); } } if (list.Count == 0) { return Vector3.zero; } Vector3 val3 = list[Random.Range(0, list.Count)]; LogIfDebugBuild($"Selected random AI node position: {val3}"); return val3; } private void CheckInactivity() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0084: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, lastPosition) < 0.01f) { inactivityTimer += Time.deltaTime; if (inactivityTimer >= 3f) { LogIfDebugBuild("Scary is stuck :c"); TeleportToRandomNode(); inactivityTimer = 0f; } } else { inactivityTimer = 0f; lastPosition = ((Component)this).transform.position; } } private bool TargetClosestPlayerInAnyCase() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = 2000f; base.targetPlayer = null; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position); if (base.tempDist < base.mostOptimalDistance) { base.mostOptimalDistance = base.tempDist; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i]; } } return (Object)(object)base.targetPlayer != (Object)null; } [ClientRpc] public void EmitPSClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2066374292u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2066374292u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Poofps.Play(); } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ScaryAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2066374292u, new RpcReceiveHandler(__rpc_handler_2066374292)); } private static void __rpc_handler_2066374292(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((ScaryAI)(object)target).EmitPSClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ScaryAI"; } } } namespace Surfaced { public class BruceAI : EnemyAI { private enum Detection { None, Small, Medium, BIG } private enum State { Roaming, Chasing, Biting } public Transform turnCompass = null; public Transform attackArea = null; private float timeSinceHittingLocalPlayer; private Vector3 positionRandomness; private Vector3 StalkPos; public Random enemyRandom = null; private bool isDeadAnimationDone; [SerializeField] private Transform jawTransform; private DeadBodyInfo carryingBody; private Vector3 wanderTarget; private float biteDistance = 11f; private float wanderRadius = 25f; private Bounds PaddedShipBounds; private bool inKillAnimation = false; private float roamingCooldown = 10f; private float lastRoamingTime = 0f; [Header("SoundSets")] [SerializeField] private SoundSet swimSet; [SerializeField] private SoundSet biteSet; private UniqueRandomizer swimRandomizer; private UniqueRandomizer biteRandomizer; [SerializeField] private Transform movementSource; private Coroutine killPlayerCoroutine; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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) ((EnemyAI)this).Start(); PaddedShipBounds = StartOfRound.Instance.shipBounds.bounds; ((Bounds)(ref PaddedShipBounds)).Expand(10f); base.agent.areaMask = 749; swimRandomizer = new UniqueRandomizer(swimSet); biteRandomizer = new UniqueRandomizer(biteSet); LogIfDebugBuild("Who fished with a Truffle worm!?"); timeSinceHittingLocalPlayer = 0f; positionRandomness = new Vector3(0f, 0f, 0f); enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); isDeadAnimationDone = false; base.currentBehaviourStateIndex = 0; base.agent.angularSpeed = 30f; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } public void PlaySwimSound() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) int nextStableRandomIndex = swimRandomizer.GetNextStableRandomIndex(); SSoundManager.main.PlaySound(swimSet.GetAudioClipName(nextStableRandomIndex), movementSource.position, 0.4f, Random.Range(0.9f, 1.1f), 30f, Object.op_Implicit((Object)(object)movementSource), (Transform)null, (NetworkObject)null, 0f, true); WalkieTalkieExtensions.TransmitOneShotAudio(movementSource, swimSet.GetAudioClip(nextStableRandomIndex), 0.4f, 1f); } public override void AnimationEventA() { ((EnemyAI)this).AnimationEventA(); PlaySwimSound(); } public override void Update() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0093: 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_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_00c7: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); timeSinceHittingLocalPlayer += Time.deltaTime; Animator creatureAnimator = base.creatureAnimator; Vector3 velocity = base.agent.velocity; creatureAnimator.SetFloat("Speed", ((Vector3)(ref velocity)).magnitude); int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 2)) { turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime); } if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; LogIfDebugBuild("You goofy ahh"); } } public override void DoAIInterval() { //IL_0153: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!((NetworkBehaviour)this).IsHost || base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 3f; base.agent.angularSpeed = 30f; base.agent.acceleration = 6f; if (TargetClosestPlayerThatSmells()) { LogIfDebugBuild("Dun Dun..."); ((EnemyAI)this).StopSearch(base.currentSearch, true); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } else if (Time.time - lastRoamingTime > roamingCooldown) { Wander(); lastRoamingTime = Time.time; } break; case 1: base.agent.speed = 9f; base.agent.angularSpeed = 300f; base.agent.acceleration = 12f; if (!TargetClosestPlayerThatSmells()) { LogIfDebugBuild("Lost smell of player"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); Wander(); } else { PositionAroundPlayer(); } break; case 2: base.agent.speed = 10f; break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } public bool TargetClosestPlayerThatSmells(float bufferDistance = 1.5f) { //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_00ad: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = 2000f; PlayerControllerB targetPlayer = base.targetPlayer; base.targetPlayer = null; Detection detection = Detection.None; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { int health = StartOfRound.Instance.allPlayerScripts[i].health; Detection detectionLevel = GetDetectionLevel(health); if (detectionLevel != 0 && ((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && !StartOfRound.Instance.allPlayerScripts[i].isInHangarShipRoom) { float detectionRadius = GetDetectionRadius(detectionLevel); base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position); if (base.tempDist <= detectionRadius && (detectionLevel > detection || (detectionLevel == detection && base.tempDist < base.mostOptimalDistance))) { base.mostOptimalDistance = base.tempDist; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i]; detection = detectionLevel; } } } if ((Object)(object)base.targetPlayer != (Object)null && bufferDistance > 0f && (Object)(object)targetPlayer != (Object)null && Mathf.Abs(base.mostOptimalDistance - Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position)) < bufferDistance) { base.targetPlayer = targetPlayer; } return (Object)(object)base.targetPlayer != (Object)null; } private Detection GetDetectionLevel(int health) { if (health >= 81 && health <= 100) { return Detection.None; } if (health >= 51 && health <= 80) { return Detection.Small; } if (health >= 21 && health <= 50) { return Detection.Medium; } if (health >= 0 && health <= 20) { return Detection.BIG; } return Detection.None; } private float GetDetectionRadius(Detection detection) { return detection switch { Detection.Small => 25f, Detection.Medium => 60f, Detection.BIG => 100f, _ => 0f, }; } private void PositionAroundPlayer() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); float num = Vector3.Distance(attackArea.position, ((Component)base.targetPlayer).transform.position); if (num <= biteDistance) { ((EnemyAI)this).SwitchToBehaviourClientRpc(2); ((MonoBehaviour)this).StartCoroutine(BiteAttackCoroutine()); } } } private IEnumerator BiteAttackCoroutine() { float biteDuration = 1.5f; float startTime = Time.time; Collider attackCollider = ((Component)attackArea).GetComponent<Collider>(); if ((Object)(object)attackCollider == (Object)null) { yield break; } int num = biteRandomizer.GetNextStableRandomIndex(); SSoundManager.main.PlaySound(((Object)biteSet.sounds[num]).name, jawTransform.position, 2f, 1f, 30f, true, jawTransform, ((NetworkBehaviour)this).NetworkObject, 0f, true); WalkieTalkieExtensions.TransmitOneShotAudio(jawTransform, biteSet.GetAudioClip(num), 1.5f, 1f); DoAnimationClientRpc("Bite"); while (Time.time - startTime < biteDuration) { Bounds bounds = attackCollider.bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = attackCollider.bounds; Collider[] hitColliders = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, ((Component)attackCollider).transform.rotation); bool hitPlayer = false; Collider[] array = hitColliders; foreach (Collider hitCollider in array) { PlayerControllerB playerControllerB = ((Component)hitCollider).GetComponent<PlayerControllerB>(); if ((Object)(object)playerControllerB != (Object)null) { hitPlayer = true; playerControllerB.inAnimationWithEnemy = (EnemyAI)(object)this; KillPlayerServerRpc((int)playerControllerB.playerClientId); base.targetPlayer = null; break; } } if (hitPlayer) { yield break; } yield return null; } if ((Object)(object)base.targetPlayer == (Object)null) { if (TargetClosestPlayerThatSmells()) { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } else { ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } else { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } Plugin.Logger.LogInfo((object)"Finish Bite"); } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3127106653u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3127106653u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("Animation: " + animationName); base.creatureAnimator.SetTrigger(animationName); } } private void TakeBodyInMouth(DeadBodyInfo body) { carryingBody = body; carryingBody.attachedTo = jawTransform; carryingBody.attachedLimb = body.bodyParts[5]; carryingBody.matchPositionExactly = true; } private void DropCarriedBody() { if (!((Object)(object)carryingBody == (Object)null)) { carryingBody.speedMultiplier = 12f; carryingBody.attachedTo = null; carryingBody.attachedLimb = null; carryingBody.matchPositionExactly = false; carryingBody = null; } } [ServerRpc(RequireOwnership = false)] public void KillPlayerServerRpc(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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3092199161u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3092199161u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { if (!inKillAnimation) { inKillAnimation = true; KillPlayerClientRpc(playerId); } else { CancelKillAnimationWithPlayerClientRpc(playerId); } } } [ClientRpc] public void CancelKillAnimationWithPlayerClientRpc(int playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3969554071u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3969554071u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { StartOfRound.Instance.allPlayerScripts[playerObjectId].inAnimationWithEnemy = null; } } } [ClientRpc] public void KillPlayerClientRpc(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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(945219238u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 945219238u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (killPlayerCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(killPlayerCoroutine); } killPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(KillPlayer(playerId)); } } private IEnumerator KillPlayer(int playerId) { if (((NetworkBehaviour)this).IsOwner) { base.agent.speed = Mathf.Clamp(base.agent.speed, 12f, 0f); } base.creatureVoice.pitch = Random.Range(0.96f, 1.04f); PlayerControllerB killPlayer = StartOfRound.Instance.allPlayerScripts[playerId]; inKillAnimation = true; if (!base.isEnemyDead) { base.creatureAnimator.SetTrigger("FlingKill"); } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)killPlayer) { killPlayer.DamagePlayer(100, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); } float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)killPlayer.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 2f)); if ((Object)(object)killPlayer.deadBody == (Object)null) { Plugin.Logger.LogInfo((object)"Bruce: Player body was not spawned or found within 2 seconds."); killPlayer.inAnimationWithEnemy = null; inKillAnimation = false; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); yield break; } TakeBodyInMouth(killPlayer.deadBody); startTime = Time.timeSinceLevelLoad; Quaternion rotateTo = Quaternion.Euler(new Vector3(0f, RoundManager.Instance.YRotationThatFacesTheFarthestFromPosition(((Component)this).transform.position + Vector3.up * 0.6f, 25f, 6), 0f)); Quaternion rotateFrom = ((Component)this).transform.rotation; while (Time.timeSinceLevelLoad - startTime < 2f) { yield return null; if (((NetworkBehaviour)this).IsOwner) { ((Component)this).transform.rotation = Quaternion.RotateTowards(rotateFrom, rotateTo, 60f * Time.deltaTime); } } yield return (object)new WaitForSeconds(2.5f); DropCarriedBody(); inKillAnimation = false; ((EnemyAI)this).SwitchToBehaviourState(0); } private void Wander() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) for (int i = 0; i <= 3; i++) { wanderTarget = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, wanderRadius, default(NavMeshHit)); if (!((Bounds)(ref PaddedShipBounds)).Contains(wanderTarget)) { LogIfDebugBuild(((object)(Vector3)(ref wanderTarget)).ToString()); ((EnemyAI)this).SetDestinationToPosition(wanderTarget, false); } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_BruceAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3127106653u, new RpcReceiveHandler(__rpc_handler_3127106653)); NetworkManager.__rpc_func_table.Add(3092199161u, new RpcReceiveHandler(__rpc_handler_3092199161)); NetworkManager.__rpc_func_table.Add(3969554071u, new RpcReceiveHandler(__rpc_handler_3969554071)); NetworkManager.__rpc_func_table.Add(945219238u, new RpcReceiveHandler(__rpc_handler_945219238)); } private static void __rpc_handler_3127106653(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((BruceAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3092199161(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((BruceAI)(object)target).KillPlayerServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3969554071(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerObjectId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)2; ((BruceAI)(object)target).CancelKillAnimationWithPlayerClientRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_945219238(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((BruceAI)(object)target).KillPlayerClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BruceAI"; } } internal class MantisshrimpAI : EnemyAI { private enum State { Wander, Warn, Attack } public Transform turnCompass = null; private float timeSinceHittingLocalPlayer; private float timeSinceNewRandPos; private Vector3 wanderTarget; private Random enemyRandom = null; private bool isDeadAnimationDone; [Header("Velocity Stuff")] private Vector3 agentLocalVelocity; private Vector3 previousPosition; private int MantisSpawnGroupSize = Plugin.BoundConfig.MantisGroupSize.Value; private float velZ; public Transform animationHolder; [Header("Other shiat")] public AudioClip warnsfx; public AudioClip hitsfx; public AudioClip parrysfx; public ParticleSystem ps; private bool isInitialSpawn = true; private Coroutine? PerformNoEmotesAllowedCoroutine; [Header("SoundSets")] [SerializeField] private SoundSet footStepSet; private UniqueRandomizer stepRandomizer; [SerializeField] private Transform movementSource; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0098: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); Plugin.Logger.LogInfo((object)"6$ SHRIMP SPECIAL!!!"); stepRandomizer = new UniqueRandomizer(footStepSet); timeSinceHittingLocalPlayer = 0f; timeSinceNewRandPos = 0f; enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); isDeadAnimationDone = false; base.currentBehaviourStateIndex = 0; if (((NetworkBehaviour)this).IsOwner && isInitialSpawn) { NetworkObject val2 = default(NetworkObject); for (int i = 0; i < MantisSpawnGroupSize; i++) { RoundManager instance = RoundManager.Instance; RoundManager instance2 = RoundManager.Instance; Vector3 position = ((Component)this).transform.position; Random random = new Random(); NetworkObjectReference val = instance.SpawnEnemyGameObject(instance2.GetRandomNavMeshPositionInBoxPredictable(position, 4f, default(NavMeshHit), random, -1), ((Component)this).transform.rotation.y, -1, base.enemyType); ((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null); MantisshrimpAI component = ((Component)val2).gameObject.GetComponent<MantisshrimpAI>(); component.isInitialSpawn = false; } } } public void PlayFootstepSound() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) int nextStableRandomIndex = stepRandomizer.GetNextStableRandomIndex(); SSoundManager.main.PlaySound(footStepSet.GetAudioClipName(nextStableRandomIndex), movementSource.position, 0.4f, Random.Range(0.9f, 1.1f), 25f, true, (Transform)null, (NetworkObject)null, 0f, true); WalkieTalkieExtensions.TransmitOneShotAudio(movementSource, footStepSet.GetAudioClip(nextStableRandomIndex), 0.4f, 1f); } public override void AnimationEventA() { ((EnemyAI)this).AnimationEventA(); PlayFootstepSound(); } public override void Update() { //IL_0015: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); agentLocalVelocity = animationHolder.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f)); velZ = Mathf.Lerp(velZ, agentLocalVelocity.z, 10f * Time.deltaTime); base.creatureAnimator.SetFloat("MoveZ", Mathf.Clamp(velZ, 0f, 1f)); previousPosition = ((Component)this).transform.position; timeSinceHittingLocalPlayer += Time.deltaTime; timeSinceNewRandPos += Time.deltaTime; int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 1) { turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime); } } public override void DoAIInterval() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 3f; Wander(); if (FoundClosestPlayerInRange(7f, 3f)) { Plugin.Logger.LogInfo((object)"Machine, Turn back now..."); if (!base.creatureVoice.isPlaying) { SSoundManager.main.PlaySound(((Object)warnsfx).name, ((Component)this).transform.position, 0.7f, Random.Range(0.8f, 1.2f), 25f, true, (Transform)null, (NetworkObject)null, 0f, false); } base.creatureVoice.pitch = Random.Range(0.8f, 1.2f); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } break; case 1: base.agent.speed = 0f; Warn(); break; case 2: base.agent.speed = 0f; break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } private void Wander() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (timeSinceNewRandPos > 2f) { timeSinceNewRandPos = 0f; wanderTarget = new Vector3((float)enemyRandom.Next(-10, 10), 0f, (float)enemyRandom.Next(-10, 10)); ((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position + wanderTarget, false); } } private IEnumerator PerformNoEmotesAllowedAttack() { yield return (object)new WaitForSeconds(0.5f); float num = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position); if (num < 2f && base.targetPlayer.performingEmote && math.dot(float3.op_Implicit(((Component)this).transform.forward), float3.op_Implicit(((Component)base.targetPlayer).transform.forward)) < -0.85f) { Plugin.Logger.LogInfo((object)"No Touchy Please thank you :)"); timeSinceHittingLocalPlayer = 0f; ((EnemyAI)this).SwitchToBehaviourClientRpc(2); ((MonoBehaviour)this).StartCoroutine(PerformAttack(base.targetPlayer)); } PerformNoEmotesAllowedCoroutine = null; } private void Warn() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.targetPlayer != (Object)null)) { return; } if (base.targetPlayer.performingEmote && PerformNoEmotesAllowedCoroutine == null) { PerformNoEmotesAllowedCoroutine = ((MonoBehaviour)this).StartCoroutine(PerformNoEmotesAllowedAttack()); } if (!base.creatureAnimator.GetBool("IsWarning")) { DoAnimationBoolClientRpc("IsWarning", value: true); } if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 10f) { Plugin.Logger.LogInfo((object)"Oh wow you actually turned back, welp i guess im switching to Wander state."); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); if (base.creatureAnimator.GetBool("IsWarning")) { DoAnimationBoolClientRpc("IsWarning", value: false); } } } private bool FoundClosestPlayerInRange(float range, float senseRange) { //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) ((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f); if ((Object)(object)base.targetPlayer == (Object)null) { ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f); range = senseRange; } return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range; } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if ((Object)(object)playerWhoHit != (Object)null) { float num = Vector3.Distance(((Component)playerWhoHit).transform.position, ((Component)this).transform.position); if (num < 4f) { Plugin.Logger.LogInfo((object)"Omae wa mou shinderu"); timeSinceHittingLocalPlayer = 0f; ((EnemyAI)this).SwitchToBehaviourClientRpc(2); ((MonoBehaviour)this).StartCoroutine(PerformAttack(playerWhoHit)); } else { DoAnimationClientRpc("Punch"); SSoundManager.main.PlaySound(((Object)parrysfx).name, ((Component)this).transform.position, 2f, 1f, 15f, true, (Transform)null, (NetworkObject)null, 0f, true); EmitPSClientRpc(); } } } public override void OnCollideWithPlayer(Collider other) { if (base.currentBehaviourStateIndex == 1 && timeSinceHittingLocalPlayer > 1f) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { LogIfDebugBuild("Omae wa mou shinderu"); timeSinceHittingLocalPlayer = 0f; ((EnemyAI)this).SwitchToBehaviourClientRpc(2); ((MonoBehaviour)this).StartCoroutine(PerformAttack(val)); } } } private IEnumerator PerformAttack(PlayerControllerB playerControllerB) { DoAnimationClientRpc("Punch"); SSoundManager.main.PlaySound(((Object)hitsfx).name, ((Component)this).transform.position, 1f, 1f, 15f, true, (Transform)null, (NetworkObject)null, 0f, true); EmitPSClientRpc(); float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position); if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); } else if (num < 24f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } yield return (object)new WaitForSeconds(0.1f); if (!base.isEnemyDead) { Vector3 val = ((Component)playerControllerB).transform.position - ((Component)this).transform.position; Vector3 kickDirection = ((Vector3)(ref val)).normalized; ((Component)playerControllerB).GetComponent<Rigidbody>().AddForce(kickDirection * 500f); Vector3 bodyVelocity = Vector3.Normalize((((Component)playerControllerB).transform.position + Vector3.up * 0.75f - ((Component)this).transform.position) * 100f) * 150f; playerControllerB.DamagePlayer(100, true, true, (CauseOfDeath)16, 1, false, bodyVelocity); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); DoAnimationBoolClientRpc("IsWarning", value: false); } } [ClientRpc] public void EmitPSClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(285005414u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 285005414u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ps.Emit(1); } } } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(622706592u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 622706592u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetTrigger(animationName); } } [ClientRpc] public void DoAnimationBoolClientRpc(string animationName, bool value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d5: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(511873081u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 511873081u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetBool(animationName, value); } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_MantisshrimpAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(285005414u, new RpcReceiveHandler(__rpc_handler_285005414)); NetworkManager.__rpc_func_table.Add(622706592u, new RpcReceiveHandler(__rpc_handler_622706592)); NetworkManager.__rpc_func_table.Add(511873081u, new RpcReceiveHandler(__rpc_handler_511873081)); } private static void __rpc_handler_285005414(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((MantisshrimpAI)(object)target).EmitPSClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_622706592(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((MantisshrimpAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_511873081(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((MantisshrimpAI)(object)target).DoAnimationBoolClientRpc(animationName, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "MantisshrimpAI"; } } [BepInPlugin("Surfaced", "Surfaced", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static AssetBundle? surfacedassets; internal static PluginConfig BoundConfig { get; private set; } private void Awake() { //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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config); InitializeNetworkBehaviours(); string text = "surfacedenemies"; List<EnemyConfig> list = new List<EnemyConfig> { new EnemyConfig { Name = "Bruce", AssetName = "BruceAsset", TerminalKeywordAsset = "BruceTN", TerminalNodeAsset = "BruceTK", Enabled = true, MaxSpawnCount = BoundConfig.BruceMaxSpawn.Value, PowerLevel = 3f, SpawnWeights = BoundConfig.BruceSpawnWeight.Value }, new EnemyConfig { Name = "Mantisshrimp", AssetName = "MantisAsset", TerminalKeywordAsset = "MantisTN", TerminalNodeAsset = "MantisTK", Enabled = true, MaxSpawnCount = BoundConfig.MantisMaxSpawn.Value, PowerLevel = 0f, SpawnWeights = BoundConfig.MantisSpawnWeight.Value }, new EnemyConfig { Name = "Urchin", AssetName = "UrchinAsset", TerminalKeywordAsset = "UrchinTN", TerminalNodeAsset = "UrchinTK", Enabled = true, MaxSpawnCount = 4, PowerLevel = 0f, SpawnWeights = BoundConfig.UrchinSpawnWeight.Value }, new EnemyConfig { Name = "Scary", AssetName = "ScaryAsset", TerminalKeywordAsset = "ScaryTN", TerminalNodeAsset = "ScaryTK", Enabled = BoundConfig.ScaryMode.Value, MaxSpawnCount = 1, PowerLevel = 2f, SpawnWeights = "All:50" } }; List<MapObjectConfig> list2 = new List<MapObjectConfig> { new MapObjectConfig { Name = "SeaMine", AssetName = "Seamine", Enabled = true, SpawnAmount = BoundConfig.SeamineAbundance.Value, Outside = false } }; MapObjectInitializer.Initialize(text, list2); EnemyInitializer.Initialize(text, list); Logger.LogInfo((object)"Surfaced Enemies is loaded!!"); } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } internal class UrchinAI : EnemyAI { private enum State { Move, NoMove, Death } public Transform turnCompass = null; private float timeSinceHittingLocalPlayer; private float timeSinceIdle; private float timeSinceMoving; private int wanderRadius = 25; private float movementDelta; private float currentDeltaHeuristic = 0f; private float movementDeltaTolerance = 5f; private Vector3 positionLastUpdate; private Vector3 wanderTarget; private Random enemyRandom = null; private static int currentUrchinCount; private float nextPlayTime = 0f; private float footstepPlayInterval = 0.3f; private float animationDuration = 0.5f; public Material Material; private Material InstanceMaterial; public AnimationCurve StabCurve; public AnimationCurve DeathCurve; public MeshRenderer[] urchin; private float growthrate = Plugin.BoundConfig.UrchinGrowthRate.Value; private Bounds PaddedShipBounds; private Vector3 initialSpawnScale = new Vector3(2f, 2f, 2f); private float MaxGrowthSize = 5f; private Coroutine? deathAnimationCoroutine; private static Random UrchinSizeRandomGenerator; [Header("Other shiat")] public AudioClip FootstepSoundClip; public AudioClip PrickSoundClip; public AudioClip MitosisSoundClip; public AudioClip HitSoundClip; public AudioClip DeathSoundClip; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); positionLastUpdate = ((Component)this).transform.position; PaddedShipBounds = StartOfRound.Instance.shipBounds.bounds; ((Bounds)(ref PaddedShipBounds)).Expand(Plugin.BoundConfig.UrchinShipPadding.Value); base.agent.areaMask = 637; base.AIIntervalTime = 0.2f; ((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position, false); UrchinSizeRandomGenerator = new Random(StartOfRound.Instance.randomMapSeed); InstanceMaterial = new Material(Material); for (int i = 0; i < urchin.Length; i++) { ((Renderer)urchin[i]).material = new Material(Material); } timeSinceHittingLocalPlayer = 0f; timeSinceIdle = 25f; enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); ((EnemyAI)this).SwitchToBehaviourState(1); ((Component)this).transform.localScale = initialSpawnScale; MaxGrowthSize = (float)(UrchinSizeRandomGenerator.NextDouble() * 1.0 + 4.0); if (((NetworkBehaviour)this).IsHost) { ((MonoBehaviour)this).StartCoroutine(CheckScaleToSpawnBabies()); } } public override void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); timeSinceHittingLocalPlayer += Time.deltaTime; if (((Component)this).transform.localScale.x < MaxGrowthSize && base.currentBehaviourStateIndex != 2) { float num = growthrate * Time.deltaTime; Transform transform = ((Component)this).transform; transform.localScale += new Vector3(num, num, num); } switch (base.currentBehaviourStateIndex) { case 0: timeSinceMoving += Time.deltaTime; LogIfDebugBuild("MoveState"); break; case 1: timeSinceIdle += Time.deltaTime; LogIfDebugBuild("NoMoveState"); break; case 2: if (deathAnimationCoroutine == null) { deathAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(AnimateDeath()); if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } } LogIfDebugBuild("DeathState"); break; } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!((NetworkBehaviour)this).IsHost || base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } switch (base.currentBehaviourStateIndex) { case 0: PlayFootstepSound(); base.agent.speed = 0.7f; if (timeSinceMoving > 30f) { timeSinceMoving = 0f; currentDeltaHeuristic = 0f; ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } break; case 1: base.agent.speed = 0f; if (timeSinceIdle > 25f) { timeSinceIdle = 0f; Wander(); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } break; case 2: base.agent.speed = 0f; break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } private void PlayFootstepSound() { if (Time.time >= nextPlayTime) { base.creatureSFX.PlayOneShot(FootstepSoundClip, 0.1f); base.creatureSFX.pitch = Random.Range(0.9f, 1.1f); nextPlayTime = Time.time + footstepPlayInterval; } } private void Wander() { //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: 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_00ae: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; allPlayerScripts = allPlayerScripts.OrderBy((PlayerControllerB x) => random.Next()).ToArray(); NavMeshHit val = default(NavMeshHit); for (int i = 0; i < allPlayerScripts.Length; i++) { if ((Object)(object)allPlayerScripts[i] != (Object)null) { if (!allPlayerScripts[i].isInsideFactory && ((EnemyAI)this).PlayerIsTargetable(allPlayerScripts[i], false, false)) { for (int j = 0; j <= 4; j++) { if (NavMesh.SamplePosition(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)allPlayerScripts[i]).transform.position, math.max((float)wanderRadius, Plugin.BoundConfig.UrchinShipPadding.Value + 5f), default(NavMeshHit)), ref val, (float)wanderRadius, -1)) { wanderTarget = ((NavMeshHit)(ref val)).position; if (!((Bounds)(ref PaddedShipBounds)).Contains(wanderTarget)) { if (((EnemyAI)this).SetDestinationToPosition(wanderTarget, true)) { LogIfDebugBuild("FoundPlayer" + ((Object)((Component)allPlayerScripts[i]).gameObject).name); return; } LogIfDebugBuild("SetDestinationFailed"); } else { LogIfDebugBuild("PathInsideShip"); } } else { LogIfDebugBuild("PlayerSampleFailed"); } } } else { LogIfDebugBuild("PlayerInsideFactory"); } } else { LogIfDebugBuild("Player Null, not controlled, dead or disabled"); } } NavMeshHit val2 = default(NavMeshHit); for (int k = 0; k <= 10; k++) { if (NavMesh.SamplePosition(RoundManager.Instance.GetRandom