Decompiled source of Wesleys Enemies v1.2.4
WesleysEnemies.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; 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("Magic_Wesley")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2025 Magic_Wesley")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+821e3516aba9ed1f4bc1c877fe23775cd38a8a01")] [assembly: AssemblyProduct("WesleysEnemies")] [assembly: AssemblyTitle("WesleysEnemies")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WesleysEnemies { internal class JustFuckingRound : MonoBehaviour { public AudioSource audioSource; public List<ParticleSystem> _particles; public List<AudioClip> _songs = new List<AudioClip>(); private PhotonView _photonView; private PhysGrabObject _physGrabObject; private int _currentSongIndex; private ItemToggle _toggle; private bool _isPlaying; private bool _isFirstGrab = true; private bool _changeImpulse = false; private readonly Dictionary<AudioClip, ParticleSystem> _songParticleMap = new Dictionary<AudioClip, ParticleSystem>(); private void Awake() { _toggle = ((Component)this).GetComponent<ItemToggle>(); _photonView = ((Component)this).GetComponent<PhotonView>(); _physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); for (int i = 0; i < _songs.Count; i++) { if (i < _particles.Count) { _songParticleMap[_songs[i]] = _particles[i]; } } } private void Update() { if (_physGrabObject.grabbed) { audioSource.volume = 1f; FirstGrab(); } else if (!_physGrabObject.grabbed && _isPlaying) { audioSource.volume = 0.4f; } if (_changeImpulse) { PlaySong(); _changeImpulse = false; } } private void FirstGrab() { if (_isFirstGrab) { _toggle.toggleState = true; _isFirstGrab = false; } else { ToggleAudio(); } } private void ToggleAudio() { if (_toggle.toggleState) { SetRandomSong(); } else if (!_toggle.toggleState) { _isPlaying = false; StopParticles(); audioSource.Stop(); } } private void ToggleParticles() { foreach (ParticleSystem particle in _particles) { particle.Stop(); } if (_toggle.toggleState && _currentSongIndex < _particles.Count) { _particles[_currentSongIndex].Play(); } } private void PlayParticle(string songName) { AudioClip key = ((IEnumerable<AudioClip>)_songs).FirstOrDefault((Func<AudioClip, bool>)((AudioClip s) => ((Object)s).name == songName)); if (_songParticleMap.ContainsKey(key)) { _songParticleMap[key].Play(); } } private void StopParticles() { foreach (ParticleSystem particle in _particles) { particle.Stop(true, (ParticleSystemStopBehavior)0); } } private void SetRandomSong() { if (!_isPlaying) { _isPlaying = true; if (GameManager.Multiplayer()) { _photonView.RPC("ChangeRandomSongValue", (RpcTarget)0, Array.Empty<object>()); } _changeImpulse = true; } } private void PlaySong() { AudioClip val = _songs[_currentSongIndex]; audioSource.clip = val; audioSource.Play(); PlayParticle(((Object)val).name); ToggleParticles(); } [PunRPC] private void ChangeRandomSongValue() { int currentSongIndex = Random.Range(0, _songs.Count); _currentSongIndex = currentSongIndex; } } [BepInPlugin("WesleysEnemies", "WesleysEnemies", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class WesleysEnemies : BaseUnityPlugin { private void Awake() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, "wesleysenemies_enemyprefabs"); string[] array = new string[11] { "EnemySetup - Gusher", "EnemySetup - 2GusherGroup", "EnemySetup - 4GusherGroup", "EnemySetup - Roaster", "EnemySetup - 2RoasterGroup", "EnemySetup - LostDroid", "EnemySetup - 2LostDroidGroup", "EnemySetup - 3LostDroidGroup", "EnemySetup - Shotgunner", "EnemySetup - LostDestroyer", "EnemySetup - 2DestroyerGroup" }; AssetBundle val = AssetBundle.LoadFromFile(text); string[] array2 = array; foreach (string text2 in array2) { EnemySetup val2 = ScriptableObject.CreateInstance<EnemySetup>(); val2 = val.LoadAsset<EnemySetup>(text2); Enemies.RegisterEnemy(val2); Debug.Log((object)("Loaded " + text2)); } Debug.Log((object)"Please, if you don't like a mod, at least be respectful about it, do not call someones work 'dogshit' while calling them 'bluddingtons'.."); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "WesleysEnemies"; public const string PLUGIN_NAME = "WesleysEnemies"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace WesleysEnemies.AI { internal class Gusher : MonoBehaviour { public enum State { Spawn, StartListen, Listen, EndListen, Attack, Wander, Stun, Despawn, Flee } public GusherAnimationController GusherAnim; private LayerMask layermask; private LayerMask playerLayermask; internal Enemy _enemy; private PhotonView _photonView; public Transform feetTransform; public bool Terminator = false; private float _speedChangeCooldown; private int _hitAmount; internal float _animSpeed; private float _spawnCool; private bool _stateImpulse; internal bool _deathImpulse; internal bool _despawnImpulse; internal bool _roamImpulse; internal bool _attackImpulse; internal bool _hearImpulse; internal bool _isListening; private Quaternion _horizontalRotationTarget = Quaternion.identity; private Vector3 _agentDestination; private Vector3 _investigatePoint; private int _hearCount; private int _hurtAmount; private bool _hurtImpulse; private float hurtLerp; private float _hearCooldown; private List<Material> _hurtMaterial = new List<Material>(); [Header("State")] [SerializeField] public State CurrentState; [SerializeField] public float stateTimer; [SerializeField] public float stateHaltTimer; [Header("Animation")] [SerializeField] private AnimationCurve hurtCurve; [SerializeField] private SkinnedMeshRenderer[] _skinnedMeshRenderer; [SerializeField] private MeshRenderer[] _MeshRenderer; [Header("Rotation and LookAt")] public SpringQuaternion horizontalRotationSpring; [SerializeField] private Transform _listenPoint; private EnemyNavMeshAgent _navMeshAgent => _enemy.NavMeshAgent; private EnemyRigidbody _rigidbody => _enemy.Rigidbody; private EnemyParent _enemyParent => _enemy.EnemyParent; private EnemyVision _Vision => _enemy.Vision; public Enemy Enemy => _enemy; private void Awake() { //IL_0035: 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_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) layermask = LayerMask.op_Implicit(LayerMask.GetMask(new string[5] { "Default", "PhysGrabObject", "PhysGrabObjectCart", "PhysGrabObjectHinge", "StaticGrabObject" })); playerLayermask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Player" })); _enemy = ((Component)this).GetComponent<Enemy>(); _photonView = ((Component)this).GetComponent<PhotonView>(); _hurtAmount = Shader.PropertyToID("_ColorOverlayAmount"); SkinnedMeshRenderer[] skinnedMeshRenderer = _skinnedMeshRenderer; foreach (SkinnedMeshRenderer val in skinnedMeshRenderer) { if ((Object)(object)val != (Object)null) { _hurtMaterial.AddRange(((Renderer)val).materials); } } MeshRenderer[] meshRenderer = _MeshRenderer; for (int j = 0; j < meshRenderer.Length; j++) { Renderer val2 = (Renderer)(object)meshRenderer[j]; if ((Object)(object)val2 != (Object)null) { _hurtMaterial.AddRange(val2.materials); } } hurtCurve = AssetManager.instance.animationCurveImpact; } private void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 if (!SemiFunc.IsMasterClientOrSingleplayer() || !LevelGenerator.Instance.Generated) { return; } if (!_enemy.IsStunned()) { if ((int)_enemy.EnemyParent.Enemy.CurrentState == 11 && CurrentState != State.Despawn) { UpdateState(State.Despawn); } switch (CurrentState) { case State.Spawn: StateSpawn(); break; case State.Listen: StateListen(); break; case State.StartListen: StateStartListen(); break; case State.EndListen: StateEndListen(); break; case State.Attack: StateAttack(); break; case State.Wander: StateWander(); break; case State.Flee: StateFlee(); break; case State.Stun: StateStun(); break; case State.Despawn: StateDespawn(); break; default: throw new ArgumentOutOfRangeException(); } RotationLogic(); } else { UpdateState(State.Stun); StateStun(); } HurtEffect(); if (_spawnCool > 0f) { _spawnCool -= Time.deltaTime; } } private void StateSpawn() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _navMeshAgent.Warp(((Component)_rigidbody).transform.position); _navMeshAgent.ResetPath(); _stateImpulse = false; stateTimer = 2f; _navMeshAgent.Agent.speed = 1f; if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f }); } else { ChangeAnimSpeedRPC(1f); } } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Wander); } } private void StateListen() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; if (Terminator) { stateTimer = Random.Range(7f, 12f); } else { stateTimer = Random.Range(20f, 33f); } _navMeshAgent.Warp(((Component)_rigidbody).transform.position); _navMeshAgent.ResetPath(); } if (!SemiFunc.EnemySpawnIdlePause()) { stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { _hearCount = 0; UpdateState(State.EndListen); } if (_hearCooldown > 0f) { _hearCooldown -= Time.deltaTime; } } } private void StateStartListen() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _hearCount = 0; _isListening = true; if (GameManager.Multiplayer()) { _photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening }); _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f }); } else { IsListeningRPC(_isListening); ChangeAnimSpeedRPC(1f); } _stateImpulse = false; stateTimer = 1f; _navMeshAgent.Warp(((Component)_rigidbody).transform.position); _navMeshAgent.ResetPath(); } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Listen); } } private void StateEndListen() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; stateTimer = 1f; _navMeshAgent.Warp(((Component)_rigidbody).transform.position); _navMeshAgent.ResetPath(); Debug.Log((object)CrazyCalculation()); } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { if (SemiFunc.EnemyForceLeave(_enemy)) { UpdateState(State.Flee); } else { UpdateState(State.Wander); } } } private void StateWander() { //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0182: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _isListening = false; if (GameManager.Multiplayer()) { _photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening }); _photonView.RPC("RoamImpulseRPC", (RpcTarget)0, Array.Empty<object>()); } else { IsListeningRPC(_isListening); RoamImpulseRPC(); } if (Terminator) { if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 6f }); } else { ChangeAnimSpeedRPC(6f); } _navMeshAgent.Agent.speed = 12f; } else { _navMeshAgent.Agent.speed = 0.05f; } bool flag = false; LevelPoint val; if (Terminator) { stateTimer = Random.Range(4f, 10f); val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 15f); } else { stateTimer = Random.Range(8f, 12f); 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" }))) { _agentDestination = ((NavMeshHit)(ref val2)).position; flag = true; } if (flag) { _enemy.Rigidbody.notMovingTimer = 0f; _stateImpulse = false; _navMeshAgent.SetDestination(_agentDestination); } return; } _navMeshAgent.SetDestination(_agentDestination); if (_navMeshAgent.Agent.speed <= 4f && !Terminator) { if (_speedChangeCooldown <= 0f) { if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { _navMeshAgent.Agent.speed / 1.5f + 1f }); _speedChangeCooldown = 1f; } else { ChangeAnimSpeedRPC(_navMeshAgent.Agent.speed / 1.5f + 1f); _speedChangeCooldown = 1f; } } else { _speedChangeCooldown -= Time.deltaTime; } NavMeshAgent agent = _navMeshAgent.Agent; agent.speed += 0.4f * Time.deltaTime; } if (_enemy.Rigidbody.notMovingTimer > 2f) { stateTimer -= Time.deltaTime; } if (stateTimer <= 0f || CheckPathCompletion()) { UpdateState(State.StartListen); } } private void StateFlee() { //IL_0109: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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) if (_stateImpulse) { _isListening = false; if (GameManager.Multiplayer()) { _photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening }); _photonView.RPC("RoamImpulseRPC", (RpcTarget)0, Array.Empty<object>()); _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 7f }); } else { IsListeningRPC(_isListening); RoamImpulseRPC(); ChangeAnimSpeedRPC(7f); } _navMeshAgent.Agent.speed = 24f; stateTimer = 5f; stateHaltTimer = 1f; bool flag = false; LevelPoint val = ((!Terminator) ? SemiFunc.LevelPointGet(((Component)this).transform.position, 15f, 80f) : SemiFunc.LevelPointGet(((Component)this).transform.position, 10f, 30f)); 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" }))) { _agentDestination = ((Component)val).transform.position; flag = true; } if (flag) { _navMeshAgent.SetDestination(_agentDestination); _enemy.Rigidbody.notMovingTimer = 0f; _stateImpulse = false; } return; } if (_enemy.Rigidbody.notMovingTimer > 2f) { stateTimer -= Time.deltaTime; } stateHaltTimer -= Time.deltaTime; if (stateHaltTimer <= 0f) { SemiFunc.EnemyCartJump(_enemy); if (stateTimer <= 0f || CheckPathCompletion()) { SemiFunc.EnemyCartJumpReset(_enemy); UpdateState(State.StartListen); } } } private void StateAttack() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { if (GameManager.Multiplayer()) { _photonView.RPC("AttackImpulseRPC", (RpcTarget)0, Array.Empty<object>()); } else { AttackImpulseRPC(); } stateTimer = 5f; _stateImpulse = false; _navMeshAgent.Warp(((Component)_rigidbody).transform.position); _navMeshAgent.ResetPath(); return; } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Flee); _isListening = false; if (GameManager.Multiplayer()) { _photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening }); } else { IsListeningRPC(_isListening); } } } private void StateDespawn() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _enemy.NavMeshAgent.Warp(feetTransform.position); _enemy.NavMeshAgent.ResetPath(); if (GameManager.Multiplayer()) { _photonView.RPC("DespawnImpulseRPC", (RpcTarget)0, Array.Empty<object>()); } else { DespawnImpulseRPC(); } } } private void StateStun() { if (_stateImpulse) { _stateImpulse = false; } if (!_enemy.IsStunned()) { _hearCount = 0; _isListening = false; if (GameManager.Multiplayer()) { _photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening }); _photonView.RPC("AttackImpulseRPC", (RpcTarget)0, Array.Empty<object>()); } else { IsListeningRPC(_isListening); AttackImpulseRPC(); } if (_spawnCool <= 0f) { UpdateState(State.Attack); } else { UpdateState(State.Wander); } } } private void UpdateState(State _newState) { if (CurrentState != _newState) { CurrentState = _newState; stateTimer = 0f; _stateImpulse = true; if (GameManager.Multiplayer()) { _photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { CurrentState }); } else { UpdateStateRPC(CurrentState); } } } [PunRPC] private void UpdateStateRPC(State _state) { CurrentState = _state; if (CurrentState == State.Spawn) { GusherAnim.SetSpawn(); } } [PunRPC] private void RoamImpulseRPC() { _roamImpulse = true; } [PunRPC] private void DespawnImpulseRPC() { _despawnImpulse = true; } [PunRPC] private void AttackImpulseRPC() { _attackImpulse = true; } [PunRPC] private void HearImpulseRPC() { _hearImpulse = true; } [PunRPC] private void IsListeningRPC(bool value) { _isListening = value; } [PunRPC] private void ChangeAnimSpeedRPC(float value) { _animSpeed = value; } private bool CheckPathCompletion() { NavMeshAgent agent = _navMeshAgent.Agent; float remainingDistance = agent.remainingDistance; if (remainingDistance <= 0.07f) { return true; } return false; } private float CrazyCalculation() { return 5.5f; } private void RotationLogic() { //IL_00d5: 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_0067: 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_008c: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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 (CurrentState != State.Stun && CurrentState != State.StartListen && CurrentState != State.Listen && CurrentState != State.EndListen && CurrentState != State.Attack) { horizontalRotationSpring.speed = 8f; horizontalRotationSpring.damping = 0.85f; Vector3 normalized = ((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized; if (((Vector3)(ref normalized)).magnitude > 0.1f) { _horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); } } ((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f); } private void HurtEffect() { if (!_hurtImpulse) { return; } hurtLerp += 2.5f * Time.deltaTime; hurtLerp = Mathf.Clamp01(hurtLerp); foreach (Material item in _hurtMaterial) { if ((Object)(object)item != (Object)null) { item.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp)); } if (hurtLerp >= 1f) { hurtLerp = 0f; _hurtImpulse = false; if ((Object)(object)item != (Object)null) { item.SetFloat(_hurtAmount, 0f); } } } } public void OnInvestigate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_004b: 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_0052: Unknown result type (might be due to invalid IL or missing references) if (CurrentState != State.Listen || !(_hearCooldown <= 0f)) { return; } _investigatePoint = _enemy.StateInvestigate.onInvestigateTriggeredPosition; Vector3 position = _listenPoint.position; if (!(Vector3.Distance(_investigatePoint, position) < 14f)) { return; } int num; float hearCooldown; if (Terminator) { num = 2; hearCooldown = 1f; } else { num = 4; hearCooldown = 2f; } if (_hearCount < num) { _hearCooldown = hearCooldown; _hearCount++; if (GameManager.Multiplayer()) { _photonView.RPC("HearImpulseRPC", (RpcTarget)0, Array.Empty<object>()); } else { HearImpulseRPC(); } } else { _stateImpulse = true; _hearCount = 0; UpdateState(State.Attack); } } public void OnSpawn() { if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(_enemy)) { UpdateState(State.Spawn); } _spawnCool = 8f; if (CheckIfSmxrezInLobby()) { _enemy.EnemyParent.Despawn(); } } private bool CheckIfSmxrezInLobby() { return false; } public void OnGrab() { if (CurrentState == State.Listen) { _hearCount = 0; UpdateState(State.Attack); _stateImpulse = true; } } public void OnHurt() { _hurtImpulse = true; if (CurrentState == State.Listen && !(_spawnCool > 0f)) { if ((float)_hitAmount < 2f) { _hitAmount++; } else { UpdateState(State.Attack); } } } public void OnDeath() { _deathImpulse = true; _despawnImpulse = true; _enemy.Stunned = false; GusherAnim.PlayDeathParticles(); if (SemiFunc.IsMasterClientOrSingleplayer()) { _enemy.EnemyParent.Despawn(); } } } internal class GusherAnimationController : MonoBehaviour { [Header("References")] public Gusher Controller; public Animator animator; [Header("Particles")] public ParticleSystem[] pukeParticles; public ParticleSystem[] pukeSplashParticles; public ParticleSystem[] pukeEndParticles; public ParticleSystem[] Deathparticles; [Header("Sounds")] [SerializeField] private Sound roamSounds; [SerializeField] private Sound hearSounds; [SerializeField] private Sound attackSounds; [SerializeField] private Sound attackGlobalSounds; [SerializeField] private Sound hurtSounds; [SerializeField] private Sound deathSounds; private void Update() { if (Controller.Enemy.IsStunned()) { animator.SetTrigger("stun"); EndPukePart(); ChangeAnimSpeed(1f); } if (Controller._roamImpulse) { Controller._roamImpulse = false; animator.SetTrigger("roam"); } if (Controller._attackImpulse) { Controller._attackImpulse = false; animator.SetTrigger("attack"); } if (Controller._despawnImpulse) { Controller._despawnImpulse = false; animator.SetTrigger("despawn"); } if (Controller._deathImpulse) { Controller._deathImpulse = false; animator.SetTrigger("death"); } if (Controller._hearImpulse) { Controller._hearImpulse = false; animator.SetTrigger("hear"); } if (Controller._isListening) { animator.SetBool("isListening", true); } else { animator.SetBool("isListening", false); } if (Controller._animSpeed != animator.speed) { animator.speed = Controller._animSpeed; } } public void ChangeAnimSpeed(float value) { animator.speed = value; } public void PlayRoamSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) roamSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayHurtSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) hurtSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayDeathSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) deathSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayAttackSound() { //IL_0017: 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) attackSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); attackGlobalSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayHearSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) hearSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void StartPukePart() { ParticleSystem[] array = pukeSplashParticles; for (int i = 0; i < array.Length; i++) { array[i].Play(); } ParticleSystem[] array2 = pukeParticles; for (int j = 0; j < array2.Length; j++) { array2[j].Play(); } } public void StartRandomPukePart() { ParticleSystem[] array = pukeSplashParticles; ParticleSystem[] array2 = pukeParticles; int num = Random.Range(0, array.Length); array[num].Play(); array2[num].Play(); } public void EndPukePart() { ParticleSystem[] array = pukeEndParticles; for (int i = 0; i < array.Length; i++) { array[i].Play(); } ParticleSystem[] array2 = pukeParticles; for (int j = 0; j < array2.Length; j++) { array2[j].Stop(); } } public void PlayDeathParticles() { PlayDeathSound(); ParticleSystem[] deathparticles = Deathparticles; foreach (ParticleSystem val in deathparticles) { val.Play(); } } public void SetDespawn() { Controller._enemy.EnemyParent.Despawn(); } public void SetSpawn() { animator.Play("New State", -1, 0f); } public void Despawn() { Controller._enemy.EnemyParent.Despawn(); } } internal class LostDroid : MonoBehaviour { public enum State { Spawn, Idle, Wander, RWander, RSwing, Stun, Notice, Follow, Transform, RAttack, RShortAttack, Despawn } public LostDroidAnimationController LostDroidAnim; internal Enemy _enemy; private PhotonView _photonView; public Renderer[] renderers; private Color[] colors = (Color[])(object)new Color[5]; private int droidVariant; public Transform _bulletPosition; public Transform feetTransform; public GameObject bulletPrefab; [Header("Sounds")] public Sound soundHit; public Sound genericLines; public Sound SadLines; public Sound EnvyLines; public Sound HateLines; public Sound CuteLines; public Sound MurderLines; public Sound RageLines; public AnimationCurve shootLineWidthCurve; public ParticleSystem minigunParticles; public bool Terminator = false; public bool Transformed = false; private bool _stateImpulse = false; private Quaternion _horizontalRotationTarget = Quaternion.identity; private Vector3 _agentDestination; private Vector3 _targetPosition; private Vector3 _turnPosition; private PlayerAvatar _targetPlayer; private List<Material> _hurtMaterial = new List<Material>(); private float _overrideAgentLerp; private bool _hurtImpulse; private float hurtLerp; private float _attackCooldown; private int _hurtAmount; private float _talkTimer; private float _avoidDist; private bool _talker; private float _bulletSpread; internal bool _isWalking; internal bool _isSprinting; internal bool _isTurning; internal bool _deathImpulse; internal bool _despawnImpulse; internal bool _attackImpulse; internal bool _attackShortImpulse; internal bool _fireBullets; internal bool _swingImpulse; internal bool _firstStun; internal bool _hasSpawned; internal bool _isTurningToPlayer; internal bool _transformImpulse; internal bool _isStun; internal int _damageAmount; internal float _animSpeed = 1f; internal float _transformCountMax; internal float _transformCount; private float _bulletFireCooldown; [Header("State")] [SerializeField] public State CurrentState; [SerializeField] public float stateTimer; [SerializeField] public float stateHaltTimer; [Header("Animation")] [SerializeField] private AnimationCurve hurtCurve; [SerializeField] private SkinnedMeshRenderer[] _skinnedMeshRenderer; [SerializeField] private MeshRenderer[] _MeshRenderer; [Header("Rotation and LookAt")] public SpringQuaternion horizontalRotationSpring; private EnemyNavMeshAgent _navMeshAgent => _enemy.NavMeshAgent; private EnemyRigidbody _rigidbody => _enemy.Rigidbody; private EnemyParent _enemyParent => _enemy.EnemyParent; private EnemyVision _Vision => _enemy.Vision; public Enemy Enemy => _enemy; private void Awake() { //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_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_008e: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) _enemy = ((Component)this).GetComponent<Enemy>(); _photonView = ((Component)this).GetComponent<PhotonView>(); _hurtAmount = Shader.PropertyToID("_ColorOverlayAmount"); colors[0] = new Color(1f, 0.1764706f, 0.1764706f, 0f); colors[1] = new Color(0.4117647f, 7f / 15f, 1f, 0f); colors[2] = new Color(1f, 0.7607843f, 0f, 0f); colors[3] = new Color(0.95686275f, 0.08627451f, 40f / 51f, 0f); colors[4] = new Color(1f, 1f, 1f, 0f); if (Terminator) { _transformCount = 5f; _transformCountMax = Random.Range(5f, 10f); _bulletSpread = 10f; } else { _transformCount = 8f; _transformCountMax = Random.Range(6f, 12f); _bulletSpread = 20f; } _talker = Random.value < 0.5f; _talkTimer = Random.Range(5f, 28f); _avoidDist = Random.Range(2f, 4f); SkinnedMeshRenderer[] skinnedMeshRenderer = _skinnedMeshRenderer; foreach (SkinnedMeshRenderer val in skinnedMeshRenderer) { if ((Object)(object)val != (Object)null) { _hurtMaterial.AddRange(((Renderer)val).materials); } } MeshRenderer[] meshRenderer = _MeshRenderer; for (int j = 0; j < meshRenderer.Length; j++) { Renderer val2 = (Renderer)(object)meshRenderer[j]; if ((Object)(object)val2 != (Object)null) { _hurtMaterial.AddRange(val2.materials); } } hurtCurve = AssetManager.instance.animationCurveImpact; } private void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 if (!SemiFunc.IsMasterClientOrSingleplayer() || !LevelGenerator.Instance.Generated) { return; } if (!_enemy.IsStunned()) { if ((int)_enemy.EnemyParent.Enemy.CurrentState == 11 && CurrentState != State.Despawn) { UpdateState(State.Despawn); } switch (CurrentState) { case State.Spawn: StateSpawn(); break; case State.Wander: StateWander(); break; case State.RAttack: StateRAttack(); break; case State.RShortAttack: StateRShortAttack(); break; case State.Stun: StateStun(); break; case State.RWander: StateWander(); break; case State.RSwing: StateRSwing(); break; case State.Notice: StateNotice(); break; case State.Idle: StateIdle(); break; case State.Follow: StateFollow(); break; case State.Despawn: StateDespawn(); break; case State.Transform: StateTransform(); break; default: throw new ArgumentOutOfRangeException(); } RotationLogic(); } else { UpdateState(State.Stun); StateStun(); } HurtEffect(); if (_transformCount < _transformCountMax) { _transformCount += Time.deltaTime * 0.25f; } if (_attackCooldown > 0f) { _attackCooldown -= Time.deltaTime; } if (_talkTimer > 0f) { _talkTimer -= Time.deltaTime; return; } Talk(); if (SemiFunc.IsMasterClientOrSingleplayer()) { _talkTimer = Random.Range(5f, 28f); } } private void StateSpawn() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _navMeshAgent.Warp(((Component)this).transform.position); _navMeshAgent.ResetPath(); if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f }); _photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false }); } else { ChangeAnimSpeedRPC(1f); IsSprintingRPC(value: false); IsWalkingRPC(value: false); IsTurningRPC(value: false); } stateTimer = 2f; } else { UpdateState(State.Wander); _hasSpawned = true; } } private void StateIdle() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _isTurningToPlayer = false; _navMeshAgent.Warp(((Component)this).transform.position); _navMeshAgent.ResetPath(); stateTimer = Random.Range(6f, 8f); if (GameManager.Multiplayer()) { _photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false }); } else { IsSprintingRPC(value: false); IsWalkingRPC(value: false); IsTurningRPC(value: false); } } else { stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Wander); } } } private void StateWander() { //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_008e: 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: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { bool flag = false; LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 10f, 20f); if (Transformed) { stateTimer = 30f; } else { stateTimer = 18f; } if (!Object.op_Implicit((Object)(object)val)) { val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 999f); } NavMeshHit val2 = default(NavMeshHit); if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 4f, ref val2, 8f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" }))) { _agentDestination = ((NavMeshHit)(ref val2)).position; flag = true; } if (!flag) { return; } if (GameManager.Multiplayer()) { _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { true }); _photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false }); } else { IsWalkingRPC(value: true); IsTurningRPC(value: false); IsSprintingRPC(value: false); } _enemy.Rigidbody.notMovingTimer = 0f; _stateImpulse = false; if (Transformed) { if (Terminator) { _navMeshAgent.Agent.speed = 0.75f; if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 3f }); } else { ChangeAnimSpeedRPC(3f); } } else { _navMeshAgent.Agent.speed = 0.25f; } } else { _navMeshAgent.Agent.speed = 1.4f; } _navMeshAgent.SetDestination(_agentDestination); return; } _navMeshAgent.SetDestination(_agentDestination); if (_enemy.Rigidbody.notMovingTimer > 2f) { stateTimer -= Time.deltaTime; } if (stateTimer <= 0f || CheckPathCompletion()) { if (Transformed) { UpdateState(State.RWander); _stateImpulse = true; } else { UpdateState(State.Idle); } } } private void StateDespawn() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _enemy.NavMeshAgent.Warp(feetTransform.position); _enemy.NavMeshAgent.ResetPath(); if (GameManager.Multiplayer()) { _photonView.RPC("DespawnImpulseRPC", (RpcTarget)0, Array.Empty<object>()); } else { DespawnImpulseRPC(); } } } private void StateRSwing() { //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_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) if (_stateImpulse) { if (Terminator) { if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 2f }); } else { ChangeAnimSpeedRPC(2f); } stateTimer = 1.2f; } else { stateTimer = 2.4f; } _stateImpulse = false; _navMeshAgent.Warp(((Component)this).transform.position); _navMeshAgent.ResetPath(); _turnPosition = ((Component)_targetPlayer).transform.position; if (GameManager.Multiplayer()) { _photonView.RPC("SwingImpulseRPC", (RpcTarget)0, Array.Empty<object>()); _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false }); } else { SwingImpulseRPC(); IsWalkingRPC(value: false); } return; } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { float num = Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position); if (num < 1f) { UpdateState(State.RSwing); _stateImpulse = true; } else { UpdateState(State.RWander); } } } private void StateRShortAttack() { //IL_001b: 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) if (_stateImpulse) { _navMeshAgent.Warp(((Component)this).transform.position); _navMeshAgent.ResetPath(); _stateImpulse = false; stateTimer = 5.5f; if ((Object)(object)_targetPlayer != (Object)null) { _turnPosition = ((Component)_targetPlayer).transform.position; } if (Terminator) { if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f }); } else { ChangeAnimSpeedRPC(1f); } } if (GameManager.Multiplayer()) { _photonView.RPC("AttackShortImpulseRPC", (RpcTarget)0, Array.Empty<object>()); _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false }); } else { AttackShortImpulseRPC(); IsWalkingRPC(value: false); } } else { FireBullets(); stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.RWander); } } } private void StateRAttack() { //IL_009d: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { if (Terminator) { stateTimer = 17f; if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f }); } else { ChangeAnimSpeedRPC(1f); } } else { stateTimer = 19.4f; } _attackCooldown = Random.Range(22f, 32f); _stateImpulse = false; _navMeshAgent.Warp(((Component)this).transform.position); _navMeshAgent.ResetPath(); _turnPosition = ((Component)this).transform.position; if ((Object)(object)_targetPlayer != (Object)null) { _turnPosition = ((Component)_targetPlayer).transform.position; } if (GameManager.Multiplayer()) { _photonView.RPC("AttackImpulseRPC", (RpcTarget)0, Array.Empty<object>()); _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false }); } else { AttackImpulseRPC(); IsWalkingRPC(value: false); } } else { FireBullets(); stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.RWander); } } } private void StateTransform() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { stateTimer = 12f; _stateImpulse = false; _isTurningToPlayer = false; _navMeshAgent.Warp(((Component)this).transform.position); _navMeshAgent.ResetPath(); if (GameManager.Multiplayer()) { _photonView.RPC("TransformImpulseRPC", (RpcTarget)0, Array.Empty<object>()); _photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false }); } else { TransformImpulseRPC(); IsSprintingRPC(value: false); IsWalkingRPC(value: false); IsTurningRPC(value: false); } } else { stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.RAttack); Transformed = true; } } } private void StateStun() { if (_stateImpulse) { LostDroidAnim.StopFiring(); _isTurningToPlayer = false; if (Terminator) { if (GameManager.Multiplayer()) { _photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f }); } else { ChangeAnimSpeedRPC(1f); } } _stateImpulse = false; if (!Transformed) { if (!_firstStun && _hasSpawned) { if (GameManager.Multiplayer()) { _photonView.RPC("IsStunnedRPC", (RpcTarget)0, new object[1] { true }); } else { IsStunnedRPC(value: true); } _firstStun = true; } } else if (GameManager.Multiplayer()) { _photonView.RPC("IsStunnedRPC", (RpcTarget)0, new object[1] { true }); } else { IsStunnedRPC(value: true); } } if (_enemy.IsStunned()) { return; } if (GameManager.Multiplayer()) { _photonView.RPC("IsStunnedRPC", (RpcTarget)0, new object[1] { false }); } else { IsStunnedRPC(value: false); } if (Transformed) { if (_attackCooldown > 0f) { UpdateState(State.RShortAttack); } else { UpdateState(State.RAttack); } } else { UpdateState(State.Transform); } } private void StateFollow() { //IL_008c: 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) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { stateTimer = 6f; _stateImpulse = false; if (GameManager.Multiplayer()) { _photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { true }); _photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false }); } else { IsSprintingRPC(value: true); IsTurningRPC(value: false); } return; } if (Vector3.Distance(((Component)this).transform.position, ((Component)_targetPlayer).transform.position) > _avoidDist) { _overrideAgentLerp -= Time.deltaTime / 0.01f; _enemy.Rigidbody.OverrideFollowPosition(0.2f, 5f, 30f); _overrideAgentLerp = Mathf.Clamp(_overrideAgentLerp, 0f, 1f); float num = 25f; float num2 = 25f; float num3 = Mathf.Lerp(_enemy.NavMeshAgent.DefaultSpeed, num, _overrideAgentLerp); float num4 = Mathf.Lerp(_enemy.Rigidbody.positionSpeedChase, num2, _overrideAgentLerp); _enemy.NavMeshAgent.OverrideAgent(num3 * 2f, _enemy.NavMeshAgent.DefaultAcceleration, 0.2f); _enemy.Rigidbody.OverrideFollowPosition(1f, num4 * 2f, -1f); _targetPosition = ((Component)_targetPlayer).transform.position; _enemy.NavMeshAgent.SetDestination(_targetPosition); _isTurningToPlayer = false; if (GameManager.Multiplayer()) { _photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { true }); _photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false }); } else { IsSprintingRPC(value: true); IsTurningRPC(value: false); } } else { _navMeshAgent.Agent.ResetPath(); _isTurningToPlayer = true; if (GameManager.Multiplayer()) { _photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false }); } else { IsSprintingRPC(value: false); IsWalkingRPC(value: false); } } if (_transformCount > 0f) { _transformCount -= Time.deltaTime * 0.8f; stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Wander); } } else { UpdateState(State.Transform); } } private void StateNotice() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _navMeshAgent.Warp(((Component)this).transform.position); _navMeshAgent.ResetPath(); stateTimer = Random.Range(2f, 4f); if (GameManager.Multiplayer()) { _photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false }); _photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false }); } else { IsSprintingRPC(value: false); IsWalkingRPC(value: false); } return; } if (_transformCount > 0f) { _transformCount -= Time.deltaTime * 0.4f; stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Idle); } } else { UpdateState(State.Transform); } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Follow); } } private void UpdateState(State _newState) { if (CurrentState != _newState) { CurrentState = _newState; stateTimer = 0f; _stateImpulse = true; if (GameManager.Multiplayer()) { _photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { CurrentState }); } else { UpdateStateRPC(CurrentState); } } } [PunRPC] private void PickRandomVariantRPC(int value) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) droidVariant = value; Renderer[] array = renderers; foreach (Renderer val in array) { val.material.SetColor("_AlbedoColor", colors[droidVariant]); } } [PunRPC] private void UpdateStateRPC(State _state) { CurrentState = _state; if (CurrentState == State.Spawn) { LostDroidAnim.SetSpawn(); } } [PunRPC] private void IsWalkingRPC(bool value) { _isWalking = value; } [PunRPC] private void IsSprintingRPC(bool value) { _isSprinting = value; } [PunRPC] private void IsTurningRPC(bool value) { _isTurning = value; } [PunRPC] private void TransformImpulseRPC() { _transformImpulse = true; } [PunRPC] private void IsStunnedRPC(bool value) { _isStun = value; } [PunRPC] private void AttackImpulseRPC() { _attackImpulse = true; } [PunRPC] private void AttackShortImpulseRPC() { _attackShortImpulse = true; } [PunRPC] private void SwingImpulseRPC() { _swingImpulse = true; } [PunRPC] private void DespawnImpulseRPC() { _despawnImpulse = true; } [PunRPC] private void TargetPlayerRPC(int _playerID) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (player.photonView.ViewID == _playerID) { _targetPlayer = player; } } } [PunRPC] private void FireBulletRPC() { //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_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_0054: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_007d: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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) if (SemiFunc.IsMasterClientOrSingleplayer()) { Vector3 endPosition = _bulletPosition.position; bool hit = false; bool flag = false; Vector3 forward = _bulletPosition.forward; float num = Random.Range(0f, _bulletSpread); float num2 = Random.Range(0f, 360f); Vector3 val = Vector3.Cross(forward, Random.onUnitSphere); Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion val2 = Quaternion.AngleAxis(num, normalized); val = Quaternion.AngleAxis(num2, forward) * val2 * forward; forward = ((Vector3)(ref val)).normalized; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(_bulletPosition.position, forward, ref val3, 80f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" }))) { endPosition = ((RaycastHit)(ref val3)).point; hit = true; } else { flag = true; } if (flag) { endPosition = _bulletPosition.position + _bulletPosition.forward * 80f; } ShootBullet(endPosition, hit); } } [PunRPC] public void ShootBulletRPC(Vector3 _endPosition, bool _hit) { //IL_000d: 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_0029: 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_003c: Unknown result type (might be due to invalid IL or missing references) ItemGunBullet component = Object.Instantiate<GameObject>(bulletPrefab, _bulletPosition.position, _bulletPosition.rotation).GetComponent<ItemGunBullet>(); component.hitPosition = _endPosition; component.bulletHit = _hit; soundHit.Play(_endPosition, 1f, 1f, 1f, 1f); component.shootLineWidthCurve = shootLineWidthCurve; component.ActivateAll(); } [PunRPC] private void ChangeAnimSpeedRPC(float value) { _animSpeed = value; } [PunRPC] private void PlayVoicelineRPC(int value) { //IL_0042: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) switch (value) { case 0: HateLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f); break; case 1: SadLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f); break; case 2: EnvyLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f); break; case 3: CuteLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f); break; case 4: genericLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f); break; case 5: RageLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f); break; case 6: MurderLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f); break; } } public void OnHurt() { if (!Transformed) { if (_damageAmount < 2) { _damageAmount++; } else { UpdateState(State.Transform); } } } public void OnSpawn() { if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(_enemy)) { UpdateState(State.Spawn); } _damageAmount = 0; _talker = Random.value < 0.5f; _talkTimer = Random.Range(5f, 28f); _avoidDist = Random.Range(2f, 4f); if (GameManager.Multiplayer()) { _photonView.RPC("IsStunnedRPC", (RpcTarget)0, new object[1] { false }); } else { IsStunnedRPC(value: false); } if (!Terminator) { int num = Random.Range(0, colors.Length); if (GameManager.Multiplayer() && SemiFunc.IsMasterClientOrSingleplayer()) { _photonView.RPC("PickRandomVariantRPC", (RpcTarget)0, new object[1] { num }); } else { PickRandomVariantRPC(num); } } } public void OnGrab() { _targetPlayer = _enemy.Vision.onVisionTriggeredPlayer; if (CurrentState == State.Idle || CurrentState == State.Wander) { if (GameManager.Multiplayer() && (Object)(object)_targetPlayer != (Object)null) { _photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID }); } if ((Object)(object)_targetPlayer != (Object)null) { UpdateState(State.Notice); } } else if (CurrentState == State.RWander) { if (GameManager.Multiplayer() && (Object)(object)_targetPlayer != (Object)null) { _photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID }); } UpdateState(State.RSwing); } } public void OnDeath() { _deathImpulse = true; _enemy.Stunned = false; LostDroidAnim.PlayDeathParticles(); if (SemiFunc.IsMasterClientOrSingleplayer()) { _enemy.EnemyParent.Despawn(); } } public void OnVision() { //IL_0177: 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) if (!Transformed) { if (CurrentState == State.Wander || CurrentState == State.Idle) { _targetPlayer = _enemy.Vision.onVisionTriggeredPlayer; if (!_targetPlayer.isCrawling && !_targetPlayer.isCrouching) { UpdateState(State.Notice); if (GameManager.Multiplayer()) { _photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID }); } } } else if ((CurrentState == State.Follow || CurrentState == State.Notice) && (Object)(object)_targetPlayer == (Object)(object)_enemy.Vision.onVisionTriggeredPlayer && !_targetPlayer.isCrawling && !_targetPlayer.isCrouching) { stateTimer = MathF.Max(stateTimer, 6f); } } else { if (CurrentState != State.RWander) { return; } _targetPlayer = _enemy.Vision.onVisionTriggeredPlayer; if (!_targetPlayer.isCrawling) { if (Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position) < 3f) { UpdateState(State.RSwing); } else if (_attackCooldown > 0f) { UpdateState(State.RShortAttack); } else { UpdateState(State.RAttack); } if (GameManager.Multiplayer()) { _photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID }); } } } } public void OnDestroyerVision() { //IL_0055: 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 (CurrentState != State.RWander) { return; } _targetPlayer = _enemy.Vision.onVisionTriggeredPlayer; if (!_targetPlayer.isCrawling && !_targetPlayer.isCrouching) { if (Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position) < 2f) { UpdateState(State.RSwing); } else { UpdateState(State.RShortAttack); } if (GameManager.Multiplayer()) { _photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID }); } } } private void Talk() { if (!_talker) { return; } if (!Terminator && !Transformed && CurrentState != State.Transform) { if (_transformCount < _transformCountMax / 6f * 2f) { PlayVoicelineMultiplayer(5); } else if (Random.value < 0.95f) { switch (droidVariant) { case 0: PlayVoicelineMultiplayer(0); break; case 1: PlayVoicelineMultiplayer(1); break; case 2: PlayVoicelineMultiplayer(2); break; case 3: PlayVoicelineMultiplayer(3); break; case 4: PlayVoicelineMultiplayer(4); break; } } else { PlayVoicelineMultiplayer(4); } } else { PlayVoicelineMultiplayer(6); } } private void PlayVoicelineMultiplayer(int value) { if (SemiFunc.IsMasterClientOrSingleplayer()) { if (GameManager.Multiplayer()) { _photonView.RPC("PlayVoicelineRPC", (RpcTarget)0, new object[1] { value }); } else { PlayVoicelineRPC(value); } } } private void ShootBullet(Vector3 _endPosition, bool _hit) { //IL_0050: 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) if (SemiFunc.IsMasterClientOrSingleplayer()) { minigunParticles.Play(); if (SemiFunc.IsMultiplayer()) { _photonView.RPC("ShootBulletRPC", (RpcTarget)0, new object[2] { _endPosition, _hit }); } else { ShootBulletRPC(_endPosition, _hit); } } } public void FireBullets() { if (!_fireBullets) { return; } if (_bulletFireCooldown <= 0f) { _bulletFireCooldown = 0.02f; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("FireBulletRPC", (RpcTarget)0, Array.Empty<object>()); } else { FireBulletRPC(); } } _bulletFireCooldown -= Time.deltaTime; } private void RotationLogic() { //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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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) if (CurrentState != State.Stun && CurrentState != State.Idle && CurrentState != State.Notice && CurrentState != State.Transform && CurrentState != State.RAttack && CurrentState != State.RShortAttack && CurrentState != State.RSwing) { horizontalRotationSpring.speed = 10f; horizontalRotationSpring.damping = 1f; Vector3 normalized = ((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized; if (((Vector3)(ref normalized)).magnitude > 0.1f) { _horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); } else if (_isTurningToPlayer) { Vector3 val = ((Component)_targetPlayer).transform.position - ((Component)this).transform.position; _horizontalRotationTarget = Quaternion.LookRotation(val, Vector3.up); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); TurnDroid(); } } else if (CurrentState == State.Notice) { horizontalRotationSpring.speed = 10f; horizontalRotationSpring.damping = 1f; Vector3 val2 = ((Component)_targetPlayer).transform.position - ((Component)this).transform.position; if (val2 != Vector3.zero) { _horizontalRotationTarget = Quaternion.LookRotation(val2, Vector3.up); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); } TurnDroid(); } else if (CurrentState == State.RSwing || CurrentState == State.RShortAttack || (CurrentState == State.RAttack && _isTurningToPlayer)) { horizontalRotationSpring.speed = 5f; horizontalRotationSpring.damping = 0.5f; Vector3 val3 = _turnPosition - ((Component)this).transform.position; if (val3 != Vector3.zero) { _horizontalRotationTarget = Quaternion.LookRotation(val3, Vector3.up); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); } } ((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f); } private void TurnDroid() { //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) float num = Quaternion.Angle(((Component)this).transform.rotation, _horizontalRotationTarget); if (num > 7f || num < -7f) { if (GameManager.Multiplayer()) { _photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { true }); } else { IsTurningRPC(value: true); } } else if (GameManager.Multiplayer()) { _photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false }); } else { IsTurningRPC(value: false); } } private void HurtEffect() { if (!_hurtImpulse) { return; } hurtLerp += 2.5f * Time.deltaTime; hurtLerp = Mathf.Clamp01(hurtLerp); foreach (Material item in _hurtMaterial) { if ((Object)(object)item != (Object)null) { item.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp)); } if (hurtLerp >= 1f) { hurtLerp = 0f; _hurtImpulse = false; if ((Object)(object)item != (Object)null) { item.SetFloat(_hurtAmount, 0f); } } } } private bool CheckPathCompletion() { NavMeshAgent agent = _navMeshAgent.Agent; float remainingDistance = agent.remainingDistance; if (remainingDistance <= 0.07f) { return true; } return false; } } internal class LostDroidAnimationController : MonoBehaviour { [Header("References")] public LostDroid Controller; public Animator animator; public Transform minigunFirePosition; public GameObject ExplosionPrefab; [Header("Particles")] public ParticleSystem[] Deathparticles; public ParticleSystem footstepParticles; public ParticleSystem goreExplosion; [Header("Sounds")] [SerializeField] private Sound mediumFootstepSounds; [SerializeField] private Sound mediumWoodFootstepSounds; [SerializeField] private Sound mediumStoneFootstepSounds; [SerializeField] private Sound smallFootstepSounds; [SerializeField] private Sound largeFootstepSounds; [SerializeField] private Sound transformSounds; [SerializeField] private Sound stingerSounds; [SerializeField] public Sound minigunAttackSounds; [SerializeField] public Sound minigunShortAttackSounds; [SerializeField] public Sound minigunAttackGlobalSounds; [SerializeField] public Sound minigunShortAttackGlobalSounds; [SerializeField] private Sound hurtSounds; [SerializeField] private Sound deathSounds; [SerializeField] private Sound whipSounds; [SerializeField] private Sound explodeSounds; private void Update() { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) animator.SetBool("isSprinting", Controller._isSprinting); animator.SetBool("isWalking", Controller._isWalking); animator.SetBool("isTurning", Controller._isTurning); animator.SetBool("stun", Controller._isStun); if (Controller._animSpeed != animator.speed) { animator.speed = Controller._animSpeed; } if (Controller._despawnImpulse) { Controller._despawnImpulse = false; animator.SetTrigger("despawn"); } if (Controller._transformImpulse) { Controller._transformImpulse = false; animator.SetTrigger("transform"); } if (Controller._attackImpulse) { Controller._attackImpulse = false; animator.SetTrigger("attack"); } if (Controller._attackShortImpulse) { Controller._attackShortImpulse = false; animator.SetTrigger("attack2"); } if (Controller._deathImpulse) { Controller._deathImpulse = false; animator.SetTrigger("death"); deathSounds.Play(Controller._enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } if (Controller._swingImpulse) { Controller._swingImpulse = false; animator.SetTrigger("swing"); } } public void ShakeCameraSmall() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) GameDirector.instance.CameraShake.ShakeDistance(2f, 5f, 15f, ((Component)this).transform.position, 0.8f); } public void ShakeCameraBig() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) GameDirector.instance.CameraShake.ShakeDistance(6f, 5f, 15f, ((Component)this).transform.position, 1.8f); } public void ShakeCameraStep() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) GameDirector.instance.CameraShake.ShakeDistance(3f, 5f, 15f, ((Component)this).transform.position, 1f); footstepParticles.Play(); } public void ShakeCameraFire() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) GameDirector.instance.CameraShake.ShakeDistance(7f, 10f, 20f, ((Component)this).transform.position, 8.64f); EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, 40f); } public void StartFiring() { Controller._fireBullets = true; } public void StopFiring() { Controller._fireBullets = false; } public void ExplodeMinigun() { Object.Instantiate<GameObject>(ExplosionPrefab, minigunFirePosition); PlayExplode(); } public void StartTurning() { Controller._isTurningToPlayer = true; } public void StopTurning() { Controller._isTurningToPlayer = false; } public void PlayGorePartExplosion() { goreExplosion.Play(); } public void PlaySmallFootstep() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) smallFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayMediumFootstep() { //IL_0035: 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_00e4: Unknown result type (might be due to invalid IL or missing references) if (LevelGenerator.Instance.Level.NarrativeName == "McJannek Station") { mediumFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } else if (LevelGenerator.Instance.Level.NarrativeName == "Headman Manor") { mediumWoodFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } else if (LevelGenerator.Instance.Level.NarrativeName == "Swiftbroom Academy") { mediumStoneFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } } public void PlayLargeFootstep() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) largeFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayStinger() { //IL_0017: 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_0081: Unknown result type (might be due to invalid IL or missing references) stingerSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); minigunAttackSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); minigunAttackGlobalSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayShortStinger() { //IL_0017: 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) minigunShortAttackSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); minigunShortAttackGlobalSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayAttackSmall() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) stingerSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayWhipSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) whipSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayHurtSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) hurtSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayTransform() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) transformSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayDeathsound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) deathSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayExplode() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) explodeSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayDeathParticles() { PlayDeathsound(); ParticleSystem[] deathparticles = Deathparticles; foreach (ParticleSystem val in deathparticles) { val.Play(); } } public void SetDespawn() { if (SemiFunc.IsMasterClientOrSingleplayer()) { Controller._enemy.EnemyParent.Despawn(); } } public void SetSpawn() { animator.Play("New State", -1, 0f); Controller._damageAmount = 0; Controller.Transformed = false; if (Controller.Terminator) { Controller._transformCount = 5f; Controller._transformCountMax = Random.Range(5f, 10f); } else { Controller._transformCount = 8f; Controller._transformCountMax = Random.Range(6f, 12f); } } public void Despawn() { Controller._enemy.EnemyParent.Despawn(); } } internal class Popper : MonoBehaviour { public enum State { Spawn, Idle, Wander, Stun, Despawn } private Enemy _enemy; private PhotonView _photonView; public bool Terminator = false; private bool _stateImpulse = false; private Quaternion _horizontalRotationTarget = Quaternion.identity; private Material _hurtMaterial; private bool _hurtImpulse; private float hurtLerp; private int _hurtAmount; [Header("State")] [SerializeField] public State currentState; [SerializeField] public float stateTimer; [SerializeField] public float stateHaltTimer; [Header("Animation")] [SerializeField] private AnimationCurve hurtCurve; [SerializeField] private SkinnedMeshRenderer _skinnedMeshRenderer; [Header("Rotation and LookAt")] public SpringQuaternion horizontalRotationSpring; private EnemyNavMeshAgent _navMeshAgent => _enemy.NavMeshAgent; private EnemyRigidbody _rigidbody => _enemy.Rigidbody; private EnemyParent _enemyParent => _enemy.EnemyParent; private EnemyVision _Vision => _enemy.Vision; public Enemy Enemy => _enemy; private void Awake() { _enemy = ((Component)this).GetComponent<Enemy>(); _photonView = ((Component)this).GetComponent<PhotonView>(); _hurtAmount = Shader.PropertyToID("_ColorOverlayAmount"); if ((Object)(object)_skinnedMeshRenderer != (Object)null) { _hurtMaterial = ((Renderer)_skinnedMeshRenderer).material; } hurtCurve = AssetManager.instance.animationCurveImpact; } private void Update() { if ((GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) || !LevelGenerator.Instance.Generated) { return; } if (!_enemy.IsStunned()) { switch (currentState) { case State.Spawn: StateSpawn(); break; case State.Wander: StateWander(); break; case State.Idle: StateIdle(); break; case State.Despawn: StateDespawn(); break; default: throw new ArgumentOutOfRangeException(); } RotationLogic(); } else { UpdateState(State.Stun); StateStun(); } HurtEffect(); } private void StateSpawn() { } private void StateWander() { } private void StateIdle() { } private void StateDespawn() { } private void StateStun() { } private void UpdateState(State _newState) { if (currentState != _newState) { currentState = _newState; stateTimer = 0f; _stateImpulse = true; if (GameManager.Multiplayer()) { _photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState }); } else if (SemiFunc.IsMasterClientOrSingleplayer()) { _enemy.EnemyParent.Despawn(); } } } [PunRPC] private void UpdateStateRPC(State _state) { currentState = _state; Debug.Log((object)_state); } private void RotationLogic() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_0051: 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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (currentState != State.Stun && currentState != State.Idle) { horizontalRotationSpring.speed = 8f; horizontalRotationSpring.damping = 0.85f; Vector3 normalized = ((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized; if (((Vector3)(ref normalized)).magnitude > 0.1f) { _horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); } } ((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f); } private void HurtEffect() { if (!_hurtImpulse) { return; } hurtLerp += 2.5f * Time.deltaTime; hurtLerp = Mathf.Clamp01(hurtLerp); if ((Object)(object)_hurtMaterial != (Object)null) { _hurtMaterial.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp)); } if (hurtLerp >= 1f) { hurtLerp = 0f; _hurtImpulse = false; if ((Object)(object)_hurtMaterial != (Object)null) { _hurtMaterial.SetFloat(_hurtAmount, 0f); } } } } internal class PopperAnimationController : MonoBehaviour { [Header("References")] public Popper Controller; public Animator animator; } public class Shotgunner : MonoBehaviour { public enum State { Spawn, Idle, Roam, Investigate, InvestigateWalk, Aim, Shoot, ShootEnd, LeaveStart, Leave, Despawn, Stun } public bool debugSpawn; [Space] public State currentState; private bool stateImpulse; internal float stateTimer; [Space] public Enemy enemy; public ShotgunnerAnimationController enemyHunterAnim; public EnemyHunterAlwaysActive enemyHunterAlwaysActive; private PhotonView photonView; public bool Ghost; 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; public AudioSource ambientAudio; private void Awake() { photonView = ((Component)this).GetComponent<PhotonView>(); if (!Application.isEditor || (SemiFunc.IsMultiplayer() && !GameManager.instance.localTest)) { debugSpawn = false; } } private void Update() { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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; } if ((Object)(object)ambientAudio != (Object)null) { if (currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || (currentState == State.InvestigateWalk && ambientAudio.volume < 1f)) { AudioSource obj = ambientAudio; obj.volume += Time.deltaTime; } else if (ambientAudio.volume > 0f) { AudioSource obj2 = ambientAudio; obj2.volume -= Time.deltaTime * 2f; } } } private void StateSpawn() { if (stateImpulse) { stateImpulse = false; stateTimer = 1f; } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Idle); } } private void StateIdle() { //IL_0043: 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()) { stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Roam); } if (SemiFunc.EnemyForceLeave(enemy)) { UpdateState(State.LeaveStart); } } } private void StateRoam() { //IL_0029: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_002e: 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_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_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_0056: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) 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_0018: 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_002a: 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_0053: 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) //IL_00b9: 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) { if (Ghost) { DeathGhost(); } else { UpdateState(State.Shoot); } } } private void StateShoot() { //IL_0015: 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_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_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_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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown r