using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("MyName")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MyRepoMod")]
[assembly: AssemblyTitle("MyRepoMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public class EnemyRobot : MonoBehaviour
{
public enum State
{
Spawn = 0,
Idle = 1,
Roam = 2,
Investigate = 3,
InvestigateWalk = 4,
Aim = 5,
Shoot = 6,
ShootEnd = 7,
SetTrap = 88,
LeaveStart = 8,
Leave = 9,
Despawn = 10,
Stun = 11
}
public bool debugSpawn;
[Space]
public State currentState;
private bool stateImpulse;
public Sound soundTrapActivation;
internal float stateTimer;
[Space]
public Enemy enemy;
public EnemyRobotAnim enemyRobotAnim;
[Header("Trap Settings")]
public GameObject trapPrefab;
public EnemyHunterAlwaysActive enemyHunterAlwaysActive;
private PhotonView photonView;
public Transform investigateRayTransform;
public Transform verticalAimTransform;
public Transform gunAimTransform;
public Transform gunTipTransform;
public HurtCollider hurtCollider;
private float hurtColliderTimer;
private bool shootFast;
[Space]
public LineRenderer lineRenderer;
public AnimationCurve lineRendererWidthCurve;
private float lineRendererLerp;
private bool lineRendererActive;
[Space]
public SpringQuaternion horizontalAimSpring;
private Quaternion horizontalAimTarget = Quaternion.identity;
public SpringQuaternion verticalAimSpring;
private float pitCheckTimer;
private int shotsFired;
private int shotsFiredMax = 4;
private Vector3 leavePosition;
private Vector3 investigatePoint;
private Quaternion investigateAimHorizontal = Quaternion.identity;
private Quaternion investigateAimVertical = Quaternion.identity;
private Quaternion investigateAimVerticalPrevious = Quaternion.identity;
private float investigateAimVerticalRPCTimer;
private bool investigatePointHasTransform;
private Transform investigatePointTransform;
private Vector3 investigatePointTransformPrevious;
private Vector3 investigatePointSpread;
private Vector3 investigatePointSpreadTarget;
private float investigatePointSpreadTimer;
private int leaveInterruptCounter;
private float leaveInterruptTimer;
private float tripTimer;
[Space]
public Transform shootEffectTransform;
public List<ParticleSystem> shootEffects;
[Space]
public Transform hitEffectTransform;
public List<ParticleSystem> hitEffects;
[Space]
public List<ParticleSystem> deathEffects;
[Space]
public Sound soundHurt;
public Sound soundDeath;
public Sound soundShoot;
public Sound soundShootGlobal;
public Sound soundHit;
private void Awake()
{
photonView = ((Component)this).GetComponent<PhotonView>();
if (!Application.isEditor || (SemiFunc.IsMultiplayer() && !GameManager.instance.localTest))
{
debugSpawn = false;
}
}
private void Update()
{
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Invalid comparison between Unknown and I4
VerticalRotationLogic();
HurtColliderTimer();
LineRendererLogic();
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
if (enemy.Rigidbody.physGrabObject.rbVelocity.y < -0.5f && (enemy.Rigidbody.timeSinceStun == 0f || enemy.Rigidbody.timeSinceStun > 3f))
{
tripTimer += Time.deltaTime;
if (enemy.Rigidbody.physGrabObject.rbVelocity.y <= -2f)
{
tripTimer = 999f;
}
}
else
{
tripTimer = 0f;
}
if (tripTimer > 0.5f)
{
enemy.StateStunned.Set(2f);
tripTimer = 0f;
}
if (enemy.IsStunned())
{
UpdateState(State.Stun);
}
if ((int)enemy.CurrentState == 11 && !enemy.IsStunned())
{
UpdateState(State.Despawn);
}
ShotsFiredLogic();
HorizontalRotationLogic();
LeaveInterruptLogic();
switch (currentState)
{
case State.Spawn:
StateSpawn();
break;
case State.Idle:
StateIdle();
break;
case State.Roam:
StateRoam();
break;
case State.Investigate:
StateInvestigate();
break;
case State.InvestigateWalk:
StateInvestigateWalk();
break;
case State.Aim:
AimLogic();
StateAim();
break;
case State.Shoot:
StateShoot();
break;
case State.ShootEnd:
StateShootEnd();
break;
case State.LeaveStart:
StateLeaveStart();
break;
case State.Leave:
StateLeave();
break;
case State.Despawn:
StateDespawn();
break;
case State.Stun:
StateStun();
break;
case State.SetTrap:
StateSetTrap();
break;
}
}
private void StateSpawn()
{
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 1f;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Idle);
}
}
private void StateIdle()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = Random.Range(2f, 8f);
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
}
if (SemiFunc.EnemySpawnIdlePause())
{
return;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
if (Random.value < 0.3f)
{
UpdateState(State.SetTrap);
}
else
{
UpdateState(State.Roam);
}
}
if (SemiFunc.EnemyForceLeave(enemy))
{
UpdateState(State.LeaveStart);
}
}
private void StateSetTrap()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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)
if (stateImpulse)
{
stateImpulse = false;
Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * 1.5f;
if ((Object)(object)trapPrefab != (Object)null)
{
GameObject val2 = PhotonNetwork.Instantiate("valuables/02 small/tnt", val, Quaternion.identity, (byte)0, (object[])null);
TrapTrigger trapTrigger = val2.GetComponent<TrapTrigger>();
if ((Object)(object)trapTrigger == (Object)null)
{
trapTrigger = val2.AddComponent<TrapTrigger>();
}
trapTrigger.enemyRobot = this;
}
if ((Object)(object)enemyRobotAnim != (Object)null)
{
enemyRobotAnim.PlaySetTrapAnimation();
}
stateTimer = 3f;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Idle);
}
}
private void StateRoam()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: 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_0095: 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)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 1f;
bool flag = false;
LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 10f, 25f);
if (!Object.op_Implicit((Object)(object)val))
{
val = SemiFunc.LevelPointGet(((Component)this).transform.position, 0f, 999f);
}
NavMeshHit val2 = default(NavMeshHit);
if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
{
enemy.NavMeshAgent.SetDestination(((NavMeshHit)(ref val2)).position);
flag = true;
}
if (!flag)
{
return;
}
pitCheckTimer = 0.1f;
enemy.Rigidbody.notMovingTimer = 0f;
stateImpulse = false;
}
else
{
if (enemy.Rigidbody.notMovingTimer > 1f)
{
stateTimer -= Time.deltaTime;
}
if (PitCheckLogic())
{
enemy.NavMeshAgent.ResetPath();
}
if (stateTimer <= 0f || !enemy.NavMeshAgent.HasPath())
{
UpdateState(State.Idle);
}
}
if (SemiFunc.EnemyForceLeave(enemy))
{
UpdateState(State.LeaveStart);
}
}
private void StateDespawn()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
}
}
private void StateStun()
{
if (!enemy.IsStunned())
{
UpdateState(State.Idle);
}
}
private void StateInvestigate()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0051: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (!stateImpulse)
{
return;
}
stateImpulse = false;
float num = 12f;
Vector3 val = investigatePoint - investigateRayTransform.position;
bool flag = false;
if (((Vector3)(ref val)).magnitude < num)
{
flag = true;
RaycastHit[] array = Physics.RaycastAll(investigateRayTransform.position, val, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()));
for (int i = 0; i < array.Length; i++)
{
RaycastHit val2 = array[i];
if (!(Vector3.Distance(investigatePoint, ((RaycastHit)(ref val2)).point) < 1f) && !((Component)((RaycastHit)(ref val2)).transform).CompareTag("Player") && !Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val2)).transform).GetComponent<EnemyRigidbody>()))
{
flag = false;
break;
}
}
}
if (flag)
{
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
UpdateState(State.Aim);
}
else
{
UpdateState(State.InvestigateWalk);
}
}
private void StateInvestigateWalk()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.SetDestination(investigatePoint);
pitCheckTimer = 0f;
enemy.Rigidbody.notMovingTimer = 0f;
stateTimer = 1f;
stateImpulse = false;
}
else
{
if (enemy.Rigidbody.notMovingTimer > 1f)
{
stateTimer -= Time.deltaTime;
}
if (PitCheckLogic())
{
enemy.NavMeshAgent.ResetPath();
}
if (stateTimer <= 0f || !enemy.NavMeshAgent.HasPath())
{
UpdateState(State.Idle);
}
}
if (SemiFunc.EnemyForceLeave(enemy))
{
UpdateState(State.LeaveStart);
}
}
private void StateAim()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
stateImpulse = false;
investigatePointSpread = Vector3.zero;
investigatePointSpreadTarget = Vector3.zero;
investigatePointSpreadTimer = 0f;
if (shootFast)
{
stateTimer = 0.5f;
}
else
{
stateTimer = Random.Range(0.25f, 1f);
}
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Shoot);
}
}
private void StateShoot()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
Vector3 val = gunAimTransform.position + gunAimTransform.forward * 50f;
float num = 1f;
if (shootFast)
{
num = 1.5f;
}
if (Vector3.Distance(((Component)this).transform.position, investigatePoint) > 10f)
{
num = 0.5f;
}
bool flag = false;
RaycastHit[] array = Physics.SphereCastAll(gunAimTransform.position, num, gunAimTransform.forward, 50f, LayerMask.GetMask(new string[1] { "Player" }) + LayerMask.GetMask(new string[1] { "PhysGrabObject" }));
for (int i = 0; i < array.Length; i++)
{
RaycastHit val2 = array[i];
PlayerAvatar val3 = null;
bool flag2 = false;
if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer == LayerMask.NameToLayer("Player"))
{
flag2 = true;
PlayerController componentInParent = ((Component)((RaycastHit)(ref val2)).transform).GetComponentInParent<PlayerController>();
val3 = ((!Object.op_Implicit((Object)(object)componentInParent)) ? ((Component)((RaycastHit)(ref val2)).transform).GetComponentInParent<PlayerAvatar>() : componentInParent.playerAvatarScript);
}
else
{
PlayerTumble componentInParent2 = ((Component)((RaycastHit)(ref val2)).transform).GetComponentInParent<PlayerTumble>();
if (Object.op_Implicit((Object)(object)componentInParent2))
{
val3 = componentInParent2.playerAvatar;
flag2 = true;
}
}
if (!flag2)
{
continue;
}
bool flag3 = true;
if (((RaycastHit)(ref val2)).point != Vector3.zero)
{
Vector3 val4 = ((RaycastHit)(ref val2)).point - gunAimTransform.position;
RaycastHit[] array2 = Physics.RaycastAll(gunAimTransform.position, val4, ((Vector3)(ref val4)).magnitude, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()));
for (int j = 0; j < array2.Length; j++)
{
RaycastHit val5 = array2[j];
if (((Component)((RaycastHit)(ref val5)).transform).gameObject.layer != LayerMask.NameToLayer("Player") && (((Component)((RaycastHit)(ref val5)).transform).gameObject.layer != LayerMask.NameToLayer("PhysGrabObject") || !Object.op_Implicit((Object)(object)((Component)this).GetComponentInParent<PlayerTumble>())))
{
flag3 = false;
break;
}
}
}
if (flag3)
{
if (((RaycastHit)(ref val2)).point != Vector3.zero)
{
val = ((RaycastHit)(ref val2)).point;
flag = true;
}
else if (Object.op_Implicit((Object)(object)val3))
{
val = val3.PlayerVisionTarget.VisionTransform.position;
flag = true;
}
break;
}
}
RaycastHit val6 = default(RaycastHit);
if (!flag && Physics.Raycast(gunAimTransform.position, gunAimTransform.forward, ref val6, 50f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" })))
{
val = ((RaycastHit)(ref val6)).point;
}
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("ShootRPC", (RpcTarget)0, new object[1] { val });
}
else
{
ShootRPC(val);
}
stateImpulse = false;
stateTimer = 2f;
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.ShootEnd);
}
}
private void StateShootEnd()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
shotsFired++;
stateImpulse = false;
stateTimer = 2f;
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
if (shotsFired >= shotsFiredMax)
{
UpdateState(State.LeaveStart);
}
else
{
UpdateState(State.Idle);
}
}
}
private void StateLeaveStart()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
shotsFired++;
stateImpulse = false;
stateTimer = 3f;
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Leave);
}
}
public void SetInvestigationPoint(Vector3 position)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
investigatePoint = position;
}
public void SetState(State newState)
{
UpdateState(newState);
}
private void StateLeave()
{
//IL_0114: 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_0062: 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_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
if (!enemy.EnemyParent.playerClose)
{
UpdateState(State.Idle);
return;
}
bool flag = false;
LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 25f, 50f, false);
if (!Object.op_Implicit((Object)(object)val))
{
val = SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f);
}
NavMeshHit val2 = default(NavMeshHit);
if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
{
leavePosition = ((NavMeshHit)(ref val2)).position;
flag = true;
}
if (!flag)
{
return;
}
stateImpulse = false;
stateTimer = 5f;
}
enemy.NavMeshAgent.SetDestination(leavePosition);
if (enemy.Rigidbody.notMovingTimer > 2f)
{
stateTimer -= Time.deltaTime;
}
if (PitCheckLogic())
{
stateImpulse = true;
}
else if (stateTimer <= 0f || Vector3.Distance(((Component)this).transform.position, leavePosition) < 1f)
{
UpdateState(State.Idle);
}
}
public void OnSpawn()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(enemy))
{
UpdateState(State.Spawn);
}
}
public void OnHurt()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundHurt.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
if (SemiFunc.IsMasterClientOrSingleplayer() && currentState == State.Leave)
{
UpdateState(State.Idle);
}
}
public void OnDeath()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
soundDeath.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
foreach (ParticleSystem deathEffect in deathEffects)
{
deathEffect.Play();
}
GameDirector.instance.CameraShake.ShakeDistance(3f, 3f, 10f, ((Component)this).transform.position, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(3f, 3f, 10f, ((Component)this).transform.position, 0.05f);
if (SemiFunc.IsMasterClientOrSingleplayer())
{
enemy.EnemyParent.Despawn();
}
}
public void OnInvestigate()
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
if (!SemiFunc.IsMasterClientOrSingleplayer() || !(enemy.Rigidbody.timeSinceStun > 1.5f))
{
return;
}
if (currentState == State.Idle || currentState == State.Roam || currentState == State.InvestigateWalk || (currentState == State.ShootEnd && shotsFired < shotsFiredMax) || (currentState == State.Leave && leaveInterruptCounter >= 3))
{
investigatePoint = enemy.StateInvestigate.onInvestigateTriggeredPosition;
if (Vector3.Distance(investigatePoint, ((Component)this).transform.position) < 4f)
{
shootFast = true;
}
else
{
shootFast = false;
}
InvestigateTransformGet();
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UpdateInvestigationPoint", (RpcTarget)1, new object[1] { investigatePoint });
}
UpdateState(State.Investigate);
}
else if (currentState == State.Leave && Vector3.Distance(((Component)this).transform.position, enemy.StateInvestigate.onInvestigateTriggeredPosition) < 5f)
{
leaveInterruptCounter++;
leaveInterruptTimer = 3f;
}
}
public void OnTouchPlayer()
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && enemy.Rigidbody.timeSinceStun > 1.5f && (currentState == State.Idle || currentState == State.Roam || currentState == State.InvestigateWalk || currentState == State.ShootEnd || currentState == State.LeaveStart || currentState == State.Leave))
{
shootFast = true;
investigatePoint = enemy.Rigidbody.onTouchPlayerAvatar.PlayerVisionTarget.VisionTransform.position;
investigatePointHasTransform = true;
investigatePointTransform = enemy.Rigidbody.onTouchPlayerAvatar.PlayerVisionTarget.VisionTransform;
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UpdateInvestigationPoint", (RpcTarget)1, new object[1] { investigatePoint });
}
UpdateState(State.Aim);
}
}
public void OnTouchPlayerGrabbedObject()
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && enemy.Rigidbody.timeSinceStun > 1.5f && (currentState == State.Idle || currentState == State.Roam || currentState == State.InvestigateWalk || currentState == State.ShootEnd || currentState == State.LeaveStart || currentState == State.Leave))
{
shootFast = true;
investigatePoint = enemy.Rigidbody.onTouchPlayerGrabbedObjectPosition;
investigatePointHasTransform = true;
investigatePointTransform = enemy.Rigidbody.onTouchPlayerGrabbedObjectAvatar.PlayerVisionTarget.VisionTransform;
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UpdateInvestigationPoint", (RpcTarget)1, new object[1] { investigatePoint });
}
UpdateState(State.Aim);
}
}
public void OnGrabbed()
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && enemy.Rigidbody.timeSinceStun > 1.5f && (currentState == State.Idle || currentState == State.Roam || currentState == State.InvestigateWalk || currentState == State.ShootEnd || currentState == State.LeaveStart || currentState == State.Leave))
{
shootFast = true;
investigatePoint = enemy.Rigidbody.onGrabbedPlayerAvatar.PlayerVisionTarget.VisionTransform.position;
investigatePointHasTransform = true;
investigatePointTransform = enemy.Rigidbody.onGrabbedPlayerAvatar.PlayerVisionTarget.VisionTransform;
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UpdateInvestigationPoint", (RpcTarget)1, new object[1] { investigatePoint });
}
UpdateState(State.Aim);
}
}
private void UpdateState(State _state)
{
if (currentState != _state)
{
currentState = _state;
stateImpulse = true;
stateTimer = 0f;
if (GameManager.Multiplayer())
{
photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState });
}
else
{
UpdateStateRPC(currentState);
}
}
}
private void AimLogic()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: 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)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: 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_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: 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_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = investigatePoint;
if (investigatePointHasTransform)
{
Vector3 val2 = investigatePointTransform.position - investigatePointTransformPrevious;
val2.y = 0f;
val = investigatePointTransform.position + val2 * 25f;
investigatePointTransformPrevious = investigatePointTransform.position;
}
if (investigatePointSpreadTimer <= 0f)
{
Vector3 val3 = Random.insideUnitSphere * Random.Range(0f, 0.5f);
if (Vector3.Distance(((Component)this).transform.position, val) > 10f)
{
val3 = Random.insideUnitSphere * Random.Range(0.5f, 1f);
}
investigatePointSpreadTimer = Random.Range(0.1f, 0.5f);
investigatePointSpreadTarget = val3;
}
else
{
investigatePointSpreadTimer -= Time.deltaTime;
}
investigatePointSpread = Vector3.Lerp(investigatePointSpread, investigatePointSpreadTarget, Time.deltaTime * 20f);
val += investigatePointSpread;
float num = 5f;
if (shootFast)
{
num = 20f;
}
investigatePoint = Vector3.Lerp(investigatePoint, val, num * Time.deltaTime);
Vector3 position = ((Component)this).transform.position;
Transform transform = ((Component)this).transform;
transform.position += gunAimTransform.position - verticalAimTransform.position;
Quaternion rotation = ((Component)this).transform.rotation;
((Component)this).transform.LookAt(investigatePoint);
((Component)this).transform.eulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f);
Quaternion rotation2 = ((Component)this).transform.rotation;
((Component)this).transform.rotation = rotation;
((Component)this).transform.position = position;
investigateAimHorizontal = rotation2;
Vector3 position2 = verticalAimTransform.position;
Transform obj = verticalAimTransform;
obj.position += gunAimTransform.position - verticalAimTransform.position;
verticalAimTransform.LookAt(investigatePoint);
float num2 = 45f;
float x = verticalAimTransform.localEulerAngles.x;
x = ((!(x < 180f)) ? Mathf.Clamp(x, 360f - num2, 360f) : Mathf.Clamp(x, 0f, num2));
verticalAimTransform.localEulerAngles = new Vector3(x, 0f, 0f);
Quaternion localRotation = verticalAimTransform.localRotation;
verticalAimTransform.position = position2;
investigateAimVertical = localRotation;
if (!SemiFunc.IsMultiplayer())
{
return;
}
if (investigateAimVerticalRPCTimer <= 0f)
{
if (investigateAimVerticalPrevious != investigateAimVertical)
{
investigateAimVerticalRPCTimer = 1f;
photonView.RPC("UpdateVerticalAimRPC", (RpcTarget)1, new object[1] { investigateAimVertical });
investigateAimVerticalPrevious = investigateAimVertical;
}
}
else
{
investigateAimVerticalRPCTimer -= Time.deltaTime;
}
}
private void HorizontalRotationLogic()
{
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: 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_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
if (currentState == State.Idle || currentState == State.Roam || currentState == State.InvestigateWalk || currentState == State.LeaveStart || currentState == State.Leave)
{
horizontalAimSpring.damping = 0.7f;
horizontalAimSpring.speed = 3f;
if (((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).magnitude > 0.01f)
{
Quaternion rotation = ((Component)this).transform.rotation;
((Component)this).transform.rotation = Quaternion.LookRotation(((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).normalized);
((Component)this).transform.eulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f);
Quaternion rotation2 = ((Component)this).transform.rotation;
((Component)this).transform.rotation = rotation;
horizontalAimTarget = rotation2;
}
}
else if (currentState == State.Aim)
{
if (shootFast)
{
horizontalAimSpring.damping = 0.9f;
horizontalAimSpring.speed = 30f;
}
else
{
horizontalAimSpring.damping = 0.8f;
horizontalAimSpring.speed = 20f;
}
horizontalAimTarget = investigateAimHorizontal;
}
((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalAimSpring, horizontalAimTarget, -1f);
}
private void VerticalRotationLogic()
{
//IL_001f: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if (currentState == State.Aim || currentState == State.Shoot)
{
verticalAimTransform.localRotation = SemiFunc.SpringQuaternionGet(verticalAimSpring, investigateAimVertical, -1f);
}
else
{
verticalAimTransform.localRotation = SemiFunc.SpringQuaternionGet(verticalAimSpring, Quaternion.identity, -1f);
}
}
private bool PitCheckLogic()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0089: 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_00b7: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
if (pitCheckTimer <= 0f)
{
Vector3 normalized = ((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).normalized;
if (((Vector3)(ref normalized)).magnitude > 0.1f)
{
pitCheckTimer = 0.5f;
Vector3 normalized2 = ((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).normalized;
normalized2.y = 0f;
bool flag = Physics.Raycast(((Component)this).transform.position + normalized2 + Vector3.up * 1f, Vector3.down, 5f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()));
if (!flag)
{
enemy.NavMeshAgent.Warp(((Component)this).transform.position - normalized2 * 0.5f);
enemy.NavMeshAgent.ResetPath();
enemy.NavMeshAgent.Agent.velocity = Vector3.zero;
}
return !flag;
}
}
pitCheckTimer -= Time.deltaTime;
return false;
}
private void HurtColliderTimer()
{
if (hurtColliderTimer > 0f)
{
hurtColliderTimer -= Time.deltaTime;
if (hurtColliderTimer <= 0f)
{
((Component)hurtCollider).gameObject.SetActive(false);
}
}
}
private void LineRendererLogic()
{
if (lineRendererActive)
{
lineRenderer.widthMultiplier = lineRendererWidthCurve.Evaluate(lineRendererLerp);
lineRendererLerp += Time.deltaTime * 5f;
if (lineRendererLerp >= 1f)
{
((Component)lineRenderer).gameObject.SetActive(false);
lineRendererActive = false;
}
}
}
private void ShotsFiredLogic()
{
if (currentState == State.Spawn || currentState == State.Leave)
{
shotsFired = 0;
}
}
private void InvestigateTransformGet()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
investigatePointHasTransform = false;
Collider[] array = Physics.OverlapSphere(investigatePoint, 1.5f, LayerMask.GetMask(new string[1] { "Player" }) + LayerMask.GetMask(new string[1] { "PhysGrabObject" }));
Collider[] array2 = array;
foreach (Collider val in array2)
{
if (((Component)val).CompareTag("Player"))
{
PlayerController componentInParent = ((Component)val).GetComponentInParent<PlayerController>();
if (Object.op_Implicit((Object)(object)componentInParent))
{
investigatePointHasTransform = true;
investigatePointTransform = componentInParent.playerAvatarScript.PlayerVisionTarget.VisionTransform;
continue;
}
PlayerAvatar componentInParent2 = ((Component)val).GetComponentInParent<PlayerAvatar>();
if (Object.op_Implicit((Object)(object)componentInParent2))
{
investigatePointHasTransform = true;
investigatePointTransform = componentInParent2.PlayerVisionTarget.VisionTransform;
}
}
else
{
PlayerTumble componentInParent3 = ((Component)val).GetComponentInParent<PlayerTumble>();
if (Object.op_Implicit((Object)(object)componentInParent3))
{
investigatePointHasTransform = true;
investigatePointTransform = componentInParent3.playerAvatar.PlayerVisionTarget.VisionTransform;
}
}
}
}
private void LeaveInterruptLogic()
{
if (currentState == State.Leave)
{
if (leaveInterruptTimer <= 0f)
{
leaveInterruptCounter = 0;
}
else
{
leaveInterruptTimer -= Time.deltaTime;
}
}
else
{
leaveInterruptTimer = 0f;
}
}
[PunRPC]
private void UpdateStateRPC(State _state)
{
currentState = _state;
if (currentState == State.Spawn)
{
enemyRobotAnim.OnSpawn();
}
}
[PunRPC]
private void UpdateVerticalAimRPC(Quaternion _rotation)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
investigateAimVertical = _rotation;
}
[PunRPC]
private void ShootRPC(Vector3 _hitPosition)
{
//IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: 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_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = _hitPosition - gunTipTransform.position;
((Component)lineRenderer).gameObject.SetActive(true);
lineRenderer.SetPosition(0, gunTipTransform.position);
lineRenderer.SetPosition(1, gunTipTransform.position + ((Vector3)(ref val)).normalized * 0.5f);
lineRenderer.SetPosition(2, _hitPosition - ((Vector3)(ref val)).normalized * 0.5f);
lineRenderer.SetPosition(3, _hitPosition);
lineRendererActive = true;
lineRendererLerp = 0f;
((Component)hurtCollider).transform.position = _hitPosition;
((Component)hurtCollider).transform.rotation = Quaternion.LookRotation(gunTipTransform.forward);
((Component)hurtCollider).gameObject.SetActive(true);
hurtColliderTimer = 0.25f;
shootEffectTransform.position = gunTipTransform.position;
shootEffectTransform.rotation = gunTipTransform.rotation;
foreach (ParticleSystem shootEffect in shootEffects)
{
shootEffect.Play();
}
hitEffectTransform.position = _hitPosition;
hitEffectTransform.rotation = gunTipTransform.rotation;
foreach (ParticleSystem hitEffect in hitEffects)
{
hitEffect.Play();
}
enemyHunterAlwaysActive.Trigger();
GameDirector.instance.CameraShake.ShakeDistance(5f, 3f, 15f, gunTipTransform.position, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(5f, 3f, 15f, gunTipTransform.position, 0.05f);
GameDirector.instance.CameraShake.ShakeDistance(3f, 3f, 10f, _hitPosition, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(3f, 3f, 10f, _hitPosition, 0.05f);
soundShoot.Play(gunTipTransform.position, 1f, 1f, 1f, 1f);
soundShootGlobal.Play(gunTipTransform.position, 1f, 1f, 1f, 1f);
soundHit.Play(_hitPosition, 1f, 1f, 1f, 1f);
}
[PunRPC]
private void UpdateInvestigationPoint(Vector3 _point)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
investigatePoint = _point;
}
}
public class EnemyRobotAnim : MonoBehaviour
{
public Enemy enemy;
public EnemyRobot enemyRobot;
internal Animator animator;
public MaterialTrigger material;
private float moveTimer;
private bool stunImpulse;
internal bool spawnImpulse;
[Space]
public List<ParticleSystem> teleportEffects;
[Space]
public Sound soundFootstepShort;
public Sound soundFootstepLong;
public Sound soundReload01;
public Sound soundAimStart;
public Sound soundAimStartGlobal;
public Sound soundReload02;
public Sound soundMoveShort;
public Sound soundMoveLong;
public Sound soundGunLong;
public Sound soundGunShort;
public Sound soundSpawn;
public Sound soundDespawn;
public Sound soundLeaveStart;
public Sound soundAnalysing;
public float analysisSoundDelay = 10f;
private float analysisSoundCooldown;
[Space]
public AudioClip[] aimStartClips;
public AudioClip[] aimStartGlobalClips;
private void Awake()
{
animator = ((Component)this).GetComponent<Animator>();
animator.keepAnimatorStateOnDisable = true;
}
private void Update()
{
if (analysisSoundCooldown > 0f)
{
analysisSoundCooldown -= Time.deltaTime;
}
if (enemy.Rigidbody.frozen)
{
animator.speed = 0f;
}
else
{
animator.speed = 1f;
}
if ((enemyRobot.currentState == EnemyRobot.State.Roam || enemyRobot.currentState == EnemyRobot.State.InvestigateWalk || enemyRobot.currentState == EnemyRobot.State.Leave) && (((Vector3)(ref enemy.Rigidbody.velocity)).magnitude > 0.2f || ((Vector3)(ref enemy.Rigidbody.physGrabObject.rbAngularVelocity)).magnitude > 0.25f))
{
moveTimer = 0.1f;
}
if (moveTimer > 0f)
{
moveTimer -= Time.deltaTime;
animator.SetBool("Moving", true);
}
else
{
animator.SetBool("Moving", false);
}
if (enemyRobot.currentState == EnemyRobot.State.LeaveStart)
{
animator.SetBool("Leaving", true);
}
else
{
animator.SetBool("Leaving", false);
}
if (enemyRobot.currentState == EnemyRobot.State.Stun)
{
if (stunImpulse)
{
animator.SetTrigger("Stun");
stunImpulse = false;
}
animator.SetBool("Stunned", true);
}
else
{
animator.SetBool("Stunned", false);
stunImpulse = true;
}
if (enemyRobot.currentState == EnemyRobot.State.Aim)
{
animator.SetBool("Aiming", true);
}
else
{
animator.SetBool("Aiming", false);
}
if (enemyRobot.currentState == EnemyRobot.State.Shoot || enemyRobot.currentState == EnemyRobot.State.ShootEnd)
{
animator.SetBool("Shooting", true);
}
else
{
animator.SetBool("Shooting", false);
}
if (enemyRobot.currentState == EnemyRobot.State.Despawn)
{
animator.SetBool("Despawning", true);
}
else
{
animator.SetBool("Despawning", false);
}
}
public void OnSpawn()
{
animator.SetBool("Stunned", false);
animator.Play("Spawn", 0, 0f);
}
public void TeleportEffect()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
GameDirector.instance.CameraShake.ShakeDistance(3f, 3f, 10f, ((Component)this).transform.position, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(3f, 3f, 10f, ((Component)this).transform.position, 0.05f);
foreach (ParticleSystem teleportEffect in teleportEffects)
{
teleportEffect.Play();
}
}
public void FootstepShort()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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)
soundFootstepShort.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 1f, Vector3.down, (SoundType)1, true, material, (HostType)2);
}
public void Analysing()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
if (analysisSoundCooldown <= 0f)
{
soundAnalysing.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 1f, Vector3.down, (SoundType)1, true, material, (HostType)2);
analysisSoundCooldown = analysisSoundDelay;
}
}
public void FootstepLong()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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)
soundFootstepLong.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 1f, Vector3.down, (SoundType)1, true, material, (HostType)2);
}
public void PlaySetTrapAnimation()
{
if ((Object)(object)animator != (Object)null)
{
animator.SetTrigger("SetTrapTrigger");
}
}
public void AimStart()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
int num = Random.Range(0, aimStartClips.Length);
soundAimStart.Sounds[0] = aimStartClips[num];
soundAimStartGlobal.Sounds[0] = aimStartGlobalClips[num];
soundAimStart.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
soundAimStartGlobal.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void Despawn()
{
enemy.EnemyParent.Despawn();
}
public void Reload01()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundReload01.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void Reload02()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundReload02.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void MoveShort()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundMoveShort.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void MoveLong()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundMoveLong.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void GunLong()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundGunLong.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void GunShort()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundGunShort.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void Spawn()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundSpawn.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void DespawnSound()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundDespawn.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void StartSoLeaveund()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
soundLeaveStart.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void LeaveStartDone()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && enemyRobot.currentState == EnemyRobot.State.LeaveStart)
{
enemyRobot.stateTimer = 0f;
}
}
}
public class Test : MonoBehaviour
{
}
public class TrapTrigger : MonoBehaviour
{
public EnemyRobot enemyRobot;
public Sound trapActivationSound;
private void OnTriggerEnter(Collider other)
{
//IL_0021: 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)
if (((Component)other).CompareTag("Player"))
{
if (trapActivationSound != null)
{
trapActivationSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
if ((Object)(object)enemyRobot != (Object)null)
{
enemyRobot.SetInvestigationPoint(((Component)this).transform.position);
enemyRobot.SetState(EnemyRobot.State.Aim);
}
Object.Destroy((Object)(object)((Component)this).gameObject, 2f);
}
}
}
namespace MyRepoMod
{
[HarmonyPatch(typeof(PlayerController))]
internal static class ExamplePlayerControllerPatch
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static void Start_Prefix(PlayerController __instance)
{
MyRepoMod.Logger.LogDebug((object)$"{__instance} Start Prefix");
}
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Start_Postfix(PlayerController __instance)
{
MyRepoMod.Logger.LogDebug((object)$"{__instance} Start Postfix");
}
}
[BepInPlugin("MyName.MyRepoMod", "MyRepoMod", "1.0")]
public class MyRepoMod : BaseUnityPlugin
{
internal static MyRepoMod Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_0019: 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_0020: Expected O, but got Unknown
//IL_0025: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}