using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MCZombieMod.AI;
using MCZombieMod.Items;
using Microsoft.CodeAnalysis;
using PaintedThornStudios.PaintedUtils;
using PaintedUtils;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("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("CarsonJF")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("MCZombie Mod for REPO")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+bdcda596674b5ad9822154aad1f413fa6298e692")]
[assembly: AssemblyProduct("MCZombieMod")]
[assembly: AssemblyTitle("MCZombieMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.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 PlayerSickness : MonoBehaviourPun
{
[CompilerGenerated]
private sealed class <PukeActiveRoutine>d__17 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GameObject pukeEffect;
public SemiPuke semiPuke;
public PlayerSickness <>4__this;
private float <timer>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PukeActiveRoutine>d__17(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<timer>5__1 = 0f;
break;
case 1:
<>1__state = -1;
break;
}
if (<timer>5__1 < <>4__this.pukeDuration)
{
semiPuke.PukeActive(pukeEffect.transform.position, ((Component)<>4__this).transform.rotation);
<timer>5__1 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
Object.Destroy((Object)(object)pukeEffect, 1f);
<>4__this.isPuking = false;
if (<>4__this.isSick)
{
<>4__this.nextPukeTime = Random.Range(<>4__this.minPukeInterval, <>4__this.maxPukeInterval);
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[Header("Sickness Settings")]
public float sicknessDuration = 60f;
public float minPukeInterval = 10f;
public float maxPukeInterval = 30f;
public float pukeDuration = 3f;
[Header("Prefab References")]
public GameObject pukePrefab;
private bool isSick = false;
private bool isPuking = false;
private float sickTimer = 0f;
private float nextPukeTime = 0f;
private PlayerAvatar playerAvatar;
private void Awake()
{
if ((Object)(object)playerAvatar == (Object)null)
{
playerAvatar = ((Component)this).GetComponentInParent<PlayerAvatar>();
}
if ((Object)(object)playerAvatar == (Object)null)
{
Debug.LogWarning((object)"[SICKNESS] PlayerAvatar not found on self or parent.");
}
}
private PhotonView GetAvatarView()
{
return ((Object)(object)playerAvatar != (Object)null) ? ((Component)playerAvatar).GetComponentInChildren<PhotonView>() : null;
}
public void AssignPlayerAvatar(PlayerAvatar avatar)
{
playerAvatar = avatar;
}
public void BeginSickness()
{
if ((Object)(object)playerAvatar == (Object)null)
{
playerAvatar = ((Component)this).GetComponentInParent<PlayerAvatar>();
if ((Object)(object)playerAvatar == (Object)null)
{
Debug.LogWarning((object)"PlayerSickness: No PlayerAvatar found on self or parent!");
return;
}
}
if (playerAvatar.isLocal)
{
Debug.Log((object)"[SICKNESS] Starting RPC_BeginSickness");
playerAvatar.photonView.RPC("RPC_BeginSickness", (RpcTarget)3, Array.Empty<object>());
}
else
{
Debug.LogWarning((object)"Tried to start sickness but playerAvatar is not local.");
}
}
public void StartSicknessLocal()
{
if (!isSick)
{
isSick = true;
sickTimer = sicknessDuration + Random.Range(-10f, 10f);
nextPukeTime = Random.Range(2f, 5f);
Debug.Log((object)$"[SICKNESS] Local sickness started: {sickTimer:F1}s");
}
}
private void Update()
{
if (!isSick)
{
return;
}
sickTimer -= Time.deltaTime;
if (sickTimer <= 0f)
{
isSick = false;
}
else if (!isPuking)
{
nextPukeTime -= Time.deltaTime;
if (nextPukeTime <= 0f)
{
((MonoBehaviourPun)this).photonView.RPC("RPC_StartPukeEffect", (RpcTarget)0, Array.Empty<object>());
}
}
}
[PunRPC]
private void RPC_StartPukeEffect()
{
//IL_0083: 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)
if (!isPuking && !((Object)(object)pukePrefab == (Object)null) && !((Object)(object)playerAvatar == (Object)null))
{
isPuking = true;
Transform val = (playerAvatar.isLocal ? playerAvatar.localCameraTransform : ((Component)playerAvatar.playerAvatarVisuals).transform);
GameObject val2 = Object.Instantiate<GameObject>(pukePrefab, val);
val2.transform.localPosition = new Vector3(0f, -0.2f, 0.3f);
val2.transform.localRotation = Quaternion.identity;
SemiPuke componentInChildren = val2.GetComponentInChildren<SemiPuke>();
if ((Object)(object)componentInChildren != (Object)null)
{
((MonoBehaviour)this).StartCoroutine(PukeActiveRoutine(val2, componentInChildren));
}
else
{
Debug.LogError((object)"No SemiPuke component found!");
}
}
}
[IteratorStateMachine(typeof(<PukeActiveRoutine>d__17))]
private IEnumerator PukeActiveRoutine(GameObject pukeEffect, SemiPuke semiPuke)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PukeActiveRoutine>d__17(0)
{
<>4__this = this,
pukeEffect = pukeEffect,
semiPuke = semiPuke
};
}
public bool IsSick()
{
return isSick;
}
[PunRPC]
public void RPC_BeginSickness()
{
if (!isSick)
{
isSick = true;
float num = Random.Range(-10f, 10f);
sickTimer = sicknessDuration + num;
nextPukeTime = Random.Range(2f, 5f);
Debug.Log((object)$"Got sick! Will be sick for {sickTimer:F1} seconds. First puke in {nextPukeTime:F1} seconds");
}
}
[PunRPC]
public void RPC_EnsureSicknessOnTarget()
{
if ((Object)(object)((Component)this).GetComponent<PlayerSickness>() == (Object)null)
{
PlayerAvatar componentInParent = ((Component)this).GetComponentInParent<PlayerAvatar>();
if ((Object)(object)componentInParent != (Object)null)
{
PlayerSickness playerSickness = ((Component)this).gameObject.AddComponent<PlayerSickness>();
playerSickness.AssignPlayerAvatar(componentInParent);
Debug.Log((object)("[SICKNESS] RPC-added PlayerSickness to: " + componentInParent.playerName));
}
}
}
}
namespace MCZombieMod
{
public class MCZombieConfig : BaseEnemyConfig
{
public ConfigEntry<int> ZombiePlayerDamage { get; private set; }
public ConfigEntry<float> ZombiePlayerDamageCooldown { get; private set; }
public ConfigEntry<float> ZombiePlayerTumbleForce { get; private set; }
public ConfigEntry<float> ZombiePhysHitForce { get; private set; }
public ConfigEntry<float> ZombiePhysHitTorque { get; private set; }
public ConfigEntry<bool> ZombiePhysDestroy { get; private set; }
public ConfigEntry<int> ZombieHealth { get; private set; }
public ConfigEntry<float> ZombieSpawnChance { get; private set; }
public ConfigEntry<float> ZombieSpeedMultiplier { get; private set; }
public ConfigEntry<float> SpawnChance { get; private set; }
public ConfigEntry<int> MaxHordeSpawn { get; private set; }
public ConfigEntry<bool> HordeOnHurt { get; private set; }
public ConfigEntry<float> FleshDropChance { get; private set; }
public ConfigEntry<int> FleshDropAmountMin { get; private set; }
public ConfigEntry<int> FleshDropAmountMax { get; private set; }
public ConfigEntry<bool> CanEatFlesh { get; private set; }
public ConfigEntry<int> FleshHealAmount { get; private set; }
public ConfigEntry<int> GlobalHordeLimit { get; private set; }
public MCZombieConfig(ConfigFile config)
{
((BaseEnemyConfig)this).InitializeConfig(config);
}
protected override void InitializeConfig(ConfigFile config)
{
((BaseEnemyConfig)this).Health = config.Bind<float>("Zombie", "Health", 200f, "Base health of zombies");
((BaseEnemyConfig)this).SpeedMultiplier = config.Bind<float>("Zombie", "Speed Multiplier", 1f, "Multiplier for zombie movement speed");
((BaseEnemyConfig)this).PlayerDamage = config.Bind<int>("Zombie", "Player Damage", 45, "Damage dealt to players");
((BaseEnemyConfig)this).PlayerDamageCooldown = config.Bind<float>("Zombie", "Player Damage Cooldown", 3f, "Cooldown between player damage");
((BaseEnemyConfig)this).PlayerTumbleForce = config.Bind<float>("Zombie", "Player Tumble Force", 5f, "Force applied to players when hit");
((BaseEnemyConfig)this).PhysHitForce = config.Bind<float>("Zombie", "Phys Hit Force", 10f, "Force applied to physics objects when hit");
((BaseEnemyConfig)this).PhysHitTorque = config.Bind<float>("Zombie", "Phys Hit Torque", 5f, "Torque applied to physics objects when hit");
((BaseEnemyConfig)this).PhysDestroy = config.Bind<bool>("Zombie", "Phys Destroy", false, "Whether zombies can instantly destroy physics objects");
SpawnChance = config.Bind<float>("Zombie", "Horde Spawn Chance", 10f, "Chance for a zombie to spawn when hurt or killed (percentage)");
MaxHordeSpawn = config.Bind<int>("Zombie", "Max Number of Zombies a Zombie can spawn", 2, "Maximum number of zombies a zombie can spawn. if set to 2, each zombie can spawn 2 zombies when horde is triggered.");
HordeOnHurt = config.Bind<bool>("Zombie", "Horde on Hurt by Anything", false, "Whether zombies can spawn a horde when hurt by ANYTHING.");
FleshDropChance = config.Bind<float>("Zombie", "Flesh Drop Chance", 100f, "Chance for a zombie to drop flesh on death");
FleshDropAmountMin = config.Bind<int>("Zombie", "Flesh Drop Amount Min", 1, "Minimum amount of flesh dropped on death");
FleshDropAmountMax = config.Bind<int>("Zombie", "Flesh Drop Amount Max", 3, "Maximum amount of flesh dropped on death");
CanEatFlesh = config.Bind<bool>("Zombie", "Can Eat Flesh", true, "Whether Rotten Flesh is edible");
FleshHealAmount = config.Bind<int>("Zombie", "Flesh Heal Amount", 10, "Amount of health to heal the player for when eating flesh");
GlobalHordeLimit = config.Bind<int>("Zombie", "Global Horde Limit", 10, "Maximum total number of zombies allowed in the game at once");
}
}
public class MCZombieConfigController : EnemyConfigController
{
private MCZombieConfig zombieConfig;
private DropTable dropTable;
protected override void Awake()
{
zombieConfig = MCZombieMod.Instance.Config;
base.config = (BaseEnemyConfig)(object)zombieConfig;
ItemDropper componentInChildren = ((Component)this).GetComponentInChildren<ItemDropper>();
if ((Object)(object)componentInChildren != (Object)null)
{
dropTable = componentInChildren.DropTable;
}
((EnemyConfigController)this).Awake();
}
protected override void HandleDeath()
{
}
protected override void OnDestroy()
{
((EnemyConfigController)this).OnDestroy();
}
protected override void ApplyConfigurations()
{
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
if (base.config == null)
{
return;
}
((EnemyConfigController)this).ApplyConfigurations();
if (zombieConfig == null)
{
return;
}
if ((Object)(object)dropTable != (Object)null && dropTable.drops != null && dropTable.drops.Count > 0)
{
ItemDrop val = dropTable.drops.Find((ItemDrop d) => d.guaranteed);
if (val != null)
{
if (zombieConfig.FleshDropChance.Value < 100f)
{
val.guaranteed = false;
val.dropChanceType = (DropChanceType)1;
val.chance = zombieConfig.FleshDropChance.Value;
}
val.minQuantity = zombieConfig.FleshDropAmountMin.Value;
val.maxQuantity = zombieConfig.FleshDropAmountMax.Value;
}
}
EnemyMCZombie.spawnHordeChance = zombieConfig.SpawnChance.Value;
EnemyMCZombie.HordeOnHurt = zombieConfig.HordeOnHurt.Value;
EnemyMCZombie component = ((Component)this).GetComponent<EnemyMCZombie>();
if ((Object)(object)component != (Object)null)
{
component.MaxHordeSpawn = zombieConfig.MaxHordeSpawn.Value;
}
RottenFleshValuable.GlobalFleshHealAmount = zombieConfig.FleshHealAmount.Value;
}
public override void RefreshConfigurations()
{
((EnemyConfigController)this).RefreshConfigurations();
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("CarsonJF.MCZombieMod", "MCZombieMod", "1.2.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MCZombieMod : BaseUnityPlugin
{
private static readonly string BundleName = GetModName();
private AssetBundle? _assetBundle;
private bool _hasFixedAudioMixerGroups = false;
internal static MCZombieMod Instance { get; private set; } = null;
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
internal MCZombieConfig Config { get; private set; }
private static string GetModName()
{
object obj = typeof(MCZombieMod).GetCustomAttributes(typeof(BepInPlugin), inherit: false)[0];
BepInPlugin val = (BepInPlugin)((obj is BepInPlugin) ? obj : null);
return ((val != null) ? val.Name : null) ?? "MCZombieMod";
}
private void LoadAssetBundle()
{
if (!((Object)(object)_assetBundle != (Object)null))
{
_assetBundle = AssetBundleUtil.LoadAssetBundle((BaseUnityPlugin)(object)this, BundleName, Logger);
}
}
private void LoadEnemiesFromResources()
{
if ((Object)(object)_assetBundle == (Object)null)
{
return;
}
List<EnemySetup> list = (from name in _assetBundle.GetAllAssetNames()
where name.Contains("/enemies/") && name.EndsWith(".asset")
select _assetBundle.LoadAsset<EnemySetup>(name)).ToList();
foreach (EnemySetup item in list)
{
if ((Object)(object)item != (Object)null)
{
Enemies.RegisterEnemy(item);
}
else
{
Logger.LogWarning((object)"Failed to load enemy asset");
}
}
if (list.Count > 0)
{
Logger.LogInfo((object)$"Successfully registered {list.Count} enemies through REPOLib");
}
}
private void LoadNetworkPrefabsFromResources()
{
if (!((Object)(object)_assetBundle == (Object)null))
{
NetworkPrefabUtil.RegisterNetworkPrefabs(_assetBundle, Logger);
}
}
private void FixAllPrefabAudioMixerGroups()
{
if (!((Object)(object)_assetBundle == (Object)null) && !_hasFixedAudioMixerGroups)
{
AssetBundleUtil.FixAudioMixerGroups(_assetBundle, Logger);
_hasFixedAudioMixerGroups = true;
}
}
private void Awake()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
Instance = this;
Config = new MCZombieConfig(((BaseUnityPlugin)this).Config);
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
LoadAssetBundle();
LoadEnemiesFromResources();
LoadNetworkPrefabsFromResources();
FixAllPrefabAudioMixerGroups();
Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.PatchAll();
}
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
if (!_hasFixedAudioMixerGroups)
{
FixAllPrefabAudioMixerGroups();
}
}
}
}
namespace MCZombieMod.Items
{
public class RottenFleshEvents : MonoBehaviour
{
private RottenFleshValuable rottenFlesh;
private PhysGrabber localGrabber;
private void Awake()
{
rottenFlesh = ((Component)this).GetComponent<RottenFleshValuable>();
localGrabber = Object.FindObjectOfType<PhysGrabber>();
}
public void OnUse()
{
PhysGrabber[] array = Object.FindObjectsOfType<PhysGrabber>();
PhysGrabber[] array2 = array;
foreach (PhysGrabber val in array2)
{
PlayerAvatar component = ((Component)val).GetComponent<PlayerAvatar>();
if ((Object)(object)component != (Object)null && component.isLocal)
{
rottenFlesh.EatFlesh(((Component)val).gameObject);
return;
}
}
Debug.LogError((object)"No local player found to eat the flesh.");
}
}
public class RottenFleshValuable : MonoBehaviour
{
[CompilerGenerated]
private sealed class <StartSicknessAfterEffects>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RottenFleshValuable <>4__this;
private float <remainingTime>5__1;
private PhotonView <view>5__2;
private int <i>5__3;
private PhotonView <pview>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <StartSicknessAfterEffects>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<view>5__2 = null;
<pview>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<i>5__3 = 0;
goto IL_00a1;
case 1:
<>1__state = -1;
<i>5__3++;
goto IL_00a1;
case 2:
{
<>1__state = -1;
break;
}
IL_00a1:
if (<i>5__3 < <>4__this.eatEffectPlays)
{
<>4__this.PlayRandomEatSound();
if ((Object)(object)<>4__this.eatParticles != (Object)null)
{
<>4__this.eatParticles.Play();
}
<>2__current = (object)new WaitForSeconds(<>4__this.effectPlayInterval);
<>1__state = 1;
return true;
}
<remainingTime>5__1 = <>4__this.eatEffectDuration - (float)<>4__this.eatEffectPlays * <>4__this.effectPlayInterval;
if (<remainingTime>5__1 > 0f)
{
<>2__current = (object)new WaitForSeconds(<remainingTime>5__1);
<>1__state = 2;
return true;
}
break;
}
<>4__this.audioSource.PlayOneShot(<>4__this.eatBurpSound);
if ((Object)(object)<>4__this.playerAvatar != (Object)null && <>4__this.playerAvatar.isLocal)
{
Debug.Log((object)("Healed local player " + <>4__this.playerAvatar.playerName + " for " + <>4__this.fleshHealAmount + " health"));
<>4__this.playerAvatar.playerHealth.HealOther(<>4__this.fleshHealAmount, true);
<>4__this.playerAvatar.HealedOther();
<pview>5__4 = ((Component)<>4__this).GetComponent<PhotonView>();
if (PhotonNetwork.IsConnected && (Object)(object)<pview>5__4 != (Object)null && <pview>5__4.IsMine)
{
<pview>5__4.RPC("RPC_DestroyFlesh", (RpcTarget)0, Array.Empty<object>());
}
else
{
Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
}
<pview>5__4 = null;
}
if ((Object)(object)Inventory.instance != (Object)null && (Object)(object)Inventory.instance.physGrabber != (Object)null && (Object)(object)Inventory.instance.physGrabber.grabbedPhysGrabObject != (Object)null && (Object)(object)((Component)Inventory.instance.physGrabber.grabbedPhysGrabObject).gameObject == (Object)(object)((Component)<>4__this).gameObject)
{
Inventory.instance.physGrabber.ReleaseObject(0.1f);
}
<view>5__2 = ((Component)<>4__this).GetComponent<PhotonView>();
if (PhotonNetwork.IsConnected && (Object)(object)<view>5__2 != (Object)null)
{
<view>5__2.RPC("RPC_DestroyFlesh", (RpcTarget)0, Array.Empty<object>());
}
else
{
Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static int GlobalFleshHealAmount = 25;
[Header("Prefab References")]
[SerializeField]
private AudioClip[] eatSoundClips;
[SerializeField]
private AudioClip eatBurpSound;
public ParticleSystem eatParticles;
public float eatEffectDuration = 2f;
public int eatEffectPlays = 9;
public float effectPlayInterval = 0.07f;
private PlayerAvatar playerAvatar;
private AudioSource audioSource;
private int fleshHealAmount = GlobalFleshHealAmount;
private void Awake()
{
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.spatialBlend = 1f;
audioSource.playOnAwake = false;
fleshHealAmount = GlobalFleshHealAmount;
}
private void PlayRandomEatSound()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
if (eatSoundClips != null && eatSoundClips.Length != 0)
{
int num = Random.Range(0, eatSoundClips.Length);
audioSource.PlayOneShot(eatSoundClips[num]);
GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, ((Component)this).transform.position, 0.2f);
}
}
public void EatFlesh(GameObject player)
{
PlayerAvatar component = player.GetComponent<PlayerAvatar>();
if ((Object)(object)component == (Object)null)
{
Debug.LogError((object)"EatFlesh failed: PlayerAvatar component missing.");
return;
}
if (!component.isLocal)
{
Debug.LogError((object)"EatFlesh failed: PlayerAvatar is not local.");
return;
}
Debug.Log((object)("Eating flesh for " + component.playerName));
playerAvatar = component;
PhotonView componentInChildren = ((Component)playerAvatar).GetComponentInChildren<PhotonView>();
GameObject val = ((componentInChildren != null) ? ((Component)componentInChildren).gameObject : null);
PlayerSickness playerSickness = null;
if ((Object)(object)val != (Object)null)
{
playerSickness = val.GetComponent<PlayerSickness>();
if ((Object)(object)playerSickness == (Object)null)
{
playerSickness = val.AddComponent<PlayerSickness>();
playerSickness.AssignPlayerAvatar(playerAvatar);
Debug.Log((object)("[SICKNESS] Added and assigned PlayerSickness to " + ((Object)val).name));
}
}
else
{
Debug.LogWarning((object)"[SICKNESS] Failed to find PhotonView holder to attach sickness!");
}
((MonoBehaviour)this).StartCoroutine(StartSicknessAfterEffects());
}
[IteratorStateMachine(typeof(<StartSicknessAfterEffects>d__13))]
private IEnumerator StartSicknessAfterEffects()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <StartSicknessAfterEffects>d__13(0)
{
<>4__this = this
};
}
[PunRPC]
public void RPC_DestroyFlesh()
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
namespace MCZombieMod.AI
{
public class EnemyMCZombie : MonoBehaviour
{
public enum State
{
Spawn,
Idle,
Roam,
Investigate,
Chase,
LookForPlayer,
Attack,
Leave,
Stun
}
private Enemy _enemy;
private PhotonView _photonView;
public PlayerAvatar _targetPlayer;
private bool _stateImpulse;
private bool _deathImpulse;
private bool _attackImpulse;
[Header("State")]
[SerializeField]
public State currentState;
[SerializeField]
public float stateTimer;
public static float spawnHordeChance = 0.2f;
private Quaternion _horizontalRotationTarget = Quaternion.identity;
private Vector3 _agentDestination;
private Vector3 _targetPosition;
private bool _hurtImpulse;
private float hurtLerp;
private int _hurtAmount;
private Material _hurtableMaterial;
private float _pitCheckTimer;
private bool _pitCheck;
private float _ambientTimer;
private bool _ambientImpulse;
private bool _attackWindowOpen = false;
private float _attackWindowTimer = 0f;
private Vector3 _lastSeenPlayerPosition;
private float _attackCooldown;
private float _lookForPlayerTimer;
private int _unsuccessfulAttackCount;
private float _interestTimer;
private float _maxInterestTime = 30f;
private float _hurtInterestLoss = 0.5f;
private float _currentInterest = 1f;
[Header("Animation")]
[SerializeField]
private EnemyMCZombieAnim animator;
[SerializeField]
private SkinnedMeshRenderer _renderer;
[SerializeField]
private AnimationCurve hurtCurve;
[Header("Rotation and LookAt")]
public SpringQuaternion horizontalRotationSpring;
public SpringQuaternion headLookAtSpring;
public Transform headLookAtTarget;
public Transform headLookAtSource;
private float _spawnCooldown = 0f;
private const float SPAWN_COOLDOWN_TIME = 5f;
private int _spawnedZombies = 0;
private int _maxHordeSpawn = 2;
private const int DEFAULT_MAX_SPAWNED_ZOMBIES = 2;
private static bool _hordeOnHurt = false;
private static int _totalZombies = 0;
private const int MAX_TOTAL_ZOMBIES = 10;
public Enemy Enemy => _enemy;
public PhotonView PhotonView => _photonView;
private EnemyNavMeshAgent _navMeshAgent => EnemyReflectionUtil.GetEnemyNavMeshAgent(_enemy);
private EnemyRigidbody _rigidbody => EnemyReflectionUtil.GetEnemyRigidbody(_enemy);
private EnemyParent _enemyParent => EnemyReflectionUtil.GetEnemyParent(_enemy);
private EnemyVision _vision => EnemyReflectionUtil.GetEnemyVision(_enemy);
private EnemyStateInvestigate _investigate => EnemyReflectionUtil.GetEnemyStateInvestigate(_enemy);
public bool DeathImpulse
{
get
{
return _deathImpulse;
}
set
{
_deathImpulse = value;
}
}
public float RandomSpawnChance { get; set; }
public float CurrentInterest => _currentInterest;
private int MAX_SPAWNED_ZOMBIES => _maxHordeSpawn;
public static bool HordeOnHurt
{
get
{
return _hordeOnHurt;
}
set
{
_hordeOnHurt = value;
}
}
public int MaxHordeSpawn
{
get
{
return _maxHordeSpawn;
}
set
{
_maxHordeSpawn = value;
}
}
public static int TotalZombies => _totalZombies;
private void Awake()
{
_enemy = ((Component)this).GetComponent<Enemy>();
_photonView = ((Component)this).GetComponent<PhotonView>();
_hurtAmount = Shader.PropertyToID("_ColorOverlayAmount");
if ((Object)(object)_renderer != (Object)null)
{
_hurtableMaterial = ((Renderer)_renderer).material;
}
hurtCurve = AssetManager.instance.animationCurveImpact;
if ((Object)(object)_navMeshAgent != (Object)null)
{
Type type = ((object)_navMeshAgent).GetType();
FieldInfo field = type.GetField("Radius", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(_navMeshAgent, 0.5f);
}
FieldInfo field2 = type.GetField("Height", BindingFlags.Instance | BindingFlags.NonPublic);
if (field2 != null)
{
field2.SetValue(_navMeshAgent, 2f);
}
FieldInfo field3 = type.GetField("ObstacleAvoidanceType", BindingFlags.Instance | BindingFlags.NonPublic);
if (field3 != null)
{
field3.SetValue(_navMeshAgent, (object)(ObstacleAvoidanceType)4);
}
FieldInfo field4 = type.GetField("AvoidancePriority", BindingFlags.Instance | BindingFlags.NonPublic);
if (field4 != null)
{
field4.SetValue(_navMeshAgent, Random.Range(0, 100));
}
}
}
private void OnDestroy()
{
}
public void OnPlayerHit()
{
_unsuccessfulAttackCount = 0;
_attackWindowOpen = false;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayPlayerHit", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.PlayPlayerHitSound();
}
}
private void Update()
{
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
if ((!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient) && LevelGenerator.Instance.Generated)
{
if (!_enemy.IsStunned())
{
if (_enemy.IsStunned())
{
UpdateState(State.Stun);
}
switch (currentState)
{
case State.Spawn:
StateSpawn();
break;
case State.Idle:
StateIdle();
break;
case State.Roam:
StateRoam();
break;
case State.Investigate:
StateInvestigate();
break;
case State.Chase:
StateChase();
break;
case State.LookForPlayer:
StateLookForPlayer();
break;
case State.Attack:
StateAttack();
break;
case State.Leave:
StateLeave();
break;
case State.Stun:
StateStun();
break;
default:
throw new ArgumentOutOfRangeException();
}
RotationLogic();
TargetingLogic();
}
HurtEffect();
if (_ambientTimer > 0f)
{
_ambientTimer -= Time.deltaTime;
}
else
{
_ambientImpulse = true;
}
if (_attackCooldown > 0f)
{
_attackCooldown -= Time.deltaTime;
}
if (_spawnCooldown > 0f)
{
_spawnCooldown -= Time.deltaTime;
}
if (!_enemy.IsStunned())
{
Vector3 agentVelocity = EnemyReflectionUtil.GetAgentVelocity(_navMeshAgent);
float magnitude = ((Vector3)(ref agentVelocity)).magnitude;
float num = magnitude / 2f + 1f;
float @float = animator.animator.GetFloat("Walking");
float num2 = Mathf.MoveTowards(@float, num, Time.deltaTime * 10f);
if (Mathf.Abs(@float - num2) > 0.01f)
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_SetFloat", (RpcTarget)0, new object[2] { "Walking", num2 });
}
else
{
animator.animator.SetFloat("Walking", num2);
}
}
bool flag = magnitude > 0.1f;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_SetBool", (RpcTarget)0, new object[2] { "isWalking", flag });
}
else
{
animator.animator.SetBool("isWalking", flag);
}
}
}
if (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient)
{
_navMeshAgent.Warp(((Component)_rigidbody).transform.position);
}
}
private void LateUpdate()
{
HeadLookAtLogic();
}
private void UpdateState(State newState)
{
if (newState != currentState)
{
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;
}
[PunRPC]
private void UpdatePlayerTargetRPC(int viewID)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
{
if (item.photonView.ViewID == viewID)
{
_targetPlayer = item;
break;
}
}
}
private void TargetingLogic()
{
//IL_002b: 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_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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
if (currentState == State.Chase && Object.op_Implicit((Object)(object)_targetPlayer))
{
Vector3 val = ((Component)_targetPlayer).transform.position + ((Component)_targetPlayer).transform.forward * 1.5f;
if (_pitCheckTimer <= 0f)
{
_pitCheckTimer = 0.1f;
_pitCheck = !Physics.Raycast(val + Vector3.up, Vector3.down, 4f, LayerMask.GetMask(new string[1] { "Default" }));
}
else
{
_pitCheckTimer -= Time.deltaTime;
}
if (_pitCheck)
{
val = ((Component)_targetPlayer).transform.position;
}
_targetPosition = Vector3.Lerp(_targetPosition, val, 20f * Time.deltaTime);
}
}
private void RotationLogic()
{
//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_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0037: 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)
//IL_0041: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = EnemyReflectionUtil.GetAgentVelocity(_navMeshAgent);
val = ((Vector3)(ref val)).normalized;
if (((Vector3)(ref val)).magnitude > 0.01f)
{
val = EnemyReflectionUtil.GetAgentVelocity(_navMeshAgent);
_horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref val)).normalized);
((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
}
if (currentState == State.Spawn || currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.Leave)
{
horizontalRotationSpring.speed = 5f;
horizontalRotationSpring.damping = 0.7f;
}
else
{
horizontalRotationSpring.speed = 10f;
horizontalRotationSpring.damping = 0.8f;
}
((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f);
}
private void HeadLookAtLogic()
{
//IL_00af: 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)
//IL_004a: 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_0060: 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_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_0083: 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_008e: Unknown result type (might be due to invalid IL or missing references)
if (currentState == State.Chase && !_enemy.IsStunned() && Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer))
{
Vector3 val = _targetPlayer.PlayerVisionTarget.VisionTransform.position - headLookAtTarget.position;
val = SemiFunc.ClampDirection(val, headLookAtTarget.forward, 60f);
headLookAtSource.rotation = SemiFunc.SpringQuaternionGet(headLookAtSpring, Quaternion.LookRotation(val), -1f);
}
else
{
headLookAtSource.rotation = SemiFunc.SpringQuaternionGet(headLookAtSpring, headLookAtTarget.rotation, -1f);
}
}
private void HurtEffect()
{
if (!_hurtImpulse)
{
return;
}
hurtLerp += 2.5f * Time.deltaTime;
hurtLerp = Mathf.Clamp01(hurtLerp);
if ((Object)(object)_hurtableMaterial != (Object)null)
{
_hurtableMaterial.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp));
}
if (hurtLerp > 1f)
{
_hurtImpulse = false;
if ((Object)(object)_hurtableMaterial != (Object)null)
{
_hurtableMaterial.SetFloat(_hurtAmount, 0f);
}
}
}
private void StateSpawn()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (_stateImpulse)
{
_navMeshAgent.Warp(((Component)_rigidbody).transform.position);
_navMeshAgent.ResetPath();
_stateImpulse = false;
}
}
private void StateIdle()
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (_stateImpulse)
{
_stateImpulse = false;
stateTimer = Random.Range(4f, 8f);
_navMeshAgent.Warp(((Component)_rigidbody).transform.position);
_navMeshAgent.ResetPath();
}
if (!SemiFunc.EnemySpawnIdlePause())
{
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Roam);
}
if (SemiFunc.EnemyForceLeave(_enemy))
{
UpdateState(State.Leave);
}
}
}
private void StateRoam()
{
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0090: 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_009f: 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_00ee: 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)
if (_stateImpulse)
{
bool flag = false;
_ambientTimer = Random.Range(5f, 15f);
stateTimer = Random.Range(4f, 8f);
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" })))
{
_agentDestination = ((NavMeshHit)(ref val2)).position;
flag = true;
}
if (!flag)
{
return;
}
EnemyReflectionUtil.SetNotMovingTimer(_rigidbody, 0f);
_stateImpulse = false;
}
else
{
_navMeshAgent.SetDestination(_agentDestination);
if (EnemyReflectionUtil.GetNotMovingTimer(_rigidbody) > 2f)
{
UpdateState(State.Idle);
}
if (stateTimer <= 0f)
{
UpdateState(State.Idle);
}
}
if (SemiFunc.EnemyForceLeave(_enemy))
{
UpdateState(State.Leave);
}
if (_ambientImpulse)
{
_ambientImpulse = false;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayRoam", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.PlayRoamSound();
}
_ambientTimer = Random.Range(15f, 20f);
}
}
private void StateInvestigate()
{
//IL_0045: 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_00b1: 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)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
if (_stateImpulse)
{
_stateImpulse = false;
stateTimer = Random.Range(24f, 30f);
_ambientTimer = Random.Range(5f, 15f);
}
_navMeshAgent.SetDestination(_targetPosition);
stateTimer -= Time.deltaTime;
_vision.StandOverride(0.25f);
if (Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer))
{
float num = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position);
if (num <= 5f)
{
_lastSeenPlayerPosition = ((Component)_targetPlayer).transform.position;
UpdateState(State.Chase);
return;
}
}
if (stateTimer <= 0f)
{
UpdateState(State.Idle);
return;
}
if (_ambientImpulse)
{
_ambientImpulse = false;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayCurious", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.PlayCuriousSound();
}
_ambientTimer = Random.Range(15f, 20f);
}
NavMeshHit val = default(NavMeshHit);
if (_navMeshAgent.CanReach(_targetPosition, 1f) && Vector3.Distance(((Component)_rigidbody).transform.position, _navMeshAgent.GetPoint()) < 2f && !NavMesh.SamplePosition(_targetPosition, ref val, 0.5f, -1))
{
UpdateState(State.Roam);
}
}
private void StateChase()
{
//IL_015f: 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_0078: 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_007d: 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_012a: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0401: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_0407: Unknown result type (might be due to invalid IL or missing references)
//IL_0409: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_0425: Unknown result type (might be due to invalid IL or missing references)
//IL_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references)
//IL_037c: Unknown result type (might be due to invalid IL or missing references)
if (_stateImpulse)
{
_stateImpulse = false;
_ambientTimer = Random.Range(5f, 15f);
_interestTimer = _maxInterestTime;
}
if (!Object.op_Implicit((Object)(object)_targetPlayer) || EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer))
{
_lastSeenPlayerPosition = (Object.op_Implicit((Object)(object)_targetPlayer) ? ((Component)_targetPlayer).transform.position : _lastSeenPlayerPosition);
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayLookForPlayer", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.PlayLookForPlayerSound();
}
UpdateState(State.LookForPlayer);
return;
}
_interestTimer -= Time.deltaTime;
if (_interestTimer <= 0f)
{
_currentInterest -= 0.1f * Time.deltaTime;
if (_currentInterest <= 0f)
{
_lastSeenPlayerPosition = (Object.op_Implicit((Object)(object)_targetPlayer) ? ((Component)_targetPlayer).transform.position : _lastSeenPlayerPosition);
UpdateState(State.LookForPlayer);
return;
}
}
float num = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position);
if (num <= 2f && _attackCooldown <= 0f)
{
_attackImpulse = true;
_attackCooldown = 4f;
UpdateState(State.Attack);
return;
}
if (Object.op_Implicit((Object)(object)_targetPlayer) && Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position) < 1.5f)
{
float num2 = ((Component)this).transform.position.y - ((Component)_targetPlayer).transform.position.y;
if (num2 > 1f && EnemyReflectionUtil.GetNotMovingTimer(_rigidbody) > 1f)
{
_navMeshAgent.Warp(((Component)this).transform.position + Vector3.back * 2f);
_lastSeenPlayerPosition = (Object.op_Implicit((Object)(object)_targetPlayer) ? ((Component)_targetPlayer).transform.position : _lastSeenPlayerPosition);
UpdateState(State.LookForPlayer);
OnStun();
return;
}
}
if (!hasTargetLineOfSight())
{
_lastSeenPlayerPosition = ((Component)_targetPlayer).transform.position;
UpdateState(State.LookForPlayer);
return;
}
_interestTimer = _maxInterestTime;
if (num > 6f && (_targetPlayer.isCrawling || _targetPlayer.isTumbling))
{
_currentInterest -= Time.deltaTime * 0.2f;
if (_currentInterest <= 0f)
{
_lastSeenPlayerPosition = (Object.op_Implicit((Object)(object)_targetPlayer) ? ((Component)_targetPlayer).transform.position : _lastSeenPlayerPosition);
UpdateState(State.LookForPlayer);
return;
}
}
_targetPosition = ((Component)_targetPlayer).transform.position;
_navMeshAgent.SetDestination(_targetPosition);
Vector3 val = ((Component)_rigidbody).transform.position + Vector3.up * 1.5f;
Vector3 val2 = ((Component)_targetPlayer).transform.position + Vector3.up * 1f - val;
_horizontalRotationTarget = Quaternion.LookRotation(val2);
((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f);
if (_ambientImpulse)
{
_ambientImpulse = false;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayChasePlayer", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.PlayChasePlayerSound();
}
_ambientTimer = Random.Range(15f, 20f);
}
}
private void StateLookForPlayer()
{
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: 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_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: 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_0174: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
if (_stateImpulse)
{
_stateImpulse = false;
_interestTimer = Random.Range(8f, 12f);
_ambientTimer = Random.Range(5f, 15f);
_lookForPlayerTimer = Random.Range(2f, 5f);
}
_interestTimer -= Time.deltaTime;
if (Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer))
{
bool flag = true;
float num = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position);
NavMeshHit val = default(NavMeshHit);
if (num > 8f || !hasTargetLineOfSight() || !NavMesh.SamplePosition(_targetPosition, ref val, 0.5f, -1))
{
flag = false;
}
if (flag)
{
_lastSeenPlayerPosition = ((Component)_targetPlayer).transform.position;
UpdateState(State.Chase);
return;
}
}
if (_interestTimer <= 0f)
{
UpdateState(State.Leave);
return;
}
if (_lookForPlayerTimer <= 0f)
{
_targetPosition = _lastSeenPlayerPosition + Random.insideUnitSphere * 3f;
_navMeshAgent.SetDestination(_targetPosition);
_lookForPlayerTimer = Random.Range(2f, 5f);
}
if (_ambientImpulse)
{
_ambientImpulse = false;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayVision", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.PlayVisionSound();
}
_ambientTimer = Random.Range(15f, 20f);
}
}
private void StateAttack()
{
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: 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)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: 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_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references)
//IL_0390: Unknown result type (might be due to invalid IL or missing references)
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_0443: Unknown result type (might be due to invalid IL or missing references)
//IL_0448: Unknown result type (might be due to invalid IL or missing references)
//IL_0452: Unknown result type (might be due to invalid IL or missing references)
//IL_0457: Unknown result type (might be due to invalid IL or missing references)
if (_stateImpulse)
{
_stateImpulse = false;
_attackImpulse = false;
_attackWindowOpen = true;
_attackWindowTimer = 2.6f;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayAttack", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.AttackPlayer();
animator.PlayAttackSound();
}
_navMeshAgent.ResetPath();
}
_unsuccessfulAttackCount++;
if (_unsuccessfulAttackCount >= 2)
{
_unsuccessfulAttackCount = 0;
_currentInterest -= 0.6f;
if (_currentInterest <= 0f)
{
UpdateState(State.Roam);
_currentInterest = 0f;
return;
}
}
if (_attackWindowOpen)
{
_attackWindowTimer -= Time.deltaTime;
if (_attackWindowTimer <= 0f)
{
_attackWindowOpen = false;
if (Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer))
{
float num = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position);
if (num <= 2f)
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayAttack", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.AttackPlayer();
animator.PlayAttackSound();
}
}
}
_navMeshAgent.SetDestination(_targetPosition);
}
}
else
{
animator.animator.SetBool("isAttacking", false);
_navMeshAgent.SetDestination(_targetPosition);
}
if (Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer))
{
Vector3 val = ((Component)_rigidbody).transform.position + Vector3.up * 1.5f;
Vector3 val2 = ((Component)_targetPlayer).transform.position + Vector3.up * 1f - val;
float magnitude = ((Vector3)(ref val2)).magnitude;
bool flag = false;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val, ((Vector3)(ref val2)).normalized, ref val3, magnitude, LayerMask.GetMask(new string[1] { "Default" })))
{
if (((Component)((RaycastHit)(ref val3)).transform).CompareTag("Player"))
{
flag = true;
}
}
else
{
flag = true;
}
if (!flag)
{
UpdateState(State.LookForPlayer);
return;
}
_horizontalRotationTarget = Quaternion.LookRotation(val2);
((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f);
float num2 = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position);
if (num2 <= 10f)
{
_lastSeenPlayerPosition = ((Component)_targetPlayer).transform.position;
UpdateState(State.Chase);
return;
}
}
if ((Object)(object)_targetPlayer != (Object)null && Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position) < 1.5f)
{
float num3 = ((Component)this).transform.position.y - ((Component)_targetPlayer).transform.position.y;
if (num3 > 1f && EnemyReflectionUtil.GetNotMovingTimer(_rigidbody) > 1f)
{
_navMeshAgent.Warp(((Component)this).transform.position + Vector3.back * 2f);
UpdateState(State.Roam);
OnStun();
return;
}
}
UpdateState(State.LookForPlayer);
}
private void StateLeave()
{
//IL_0037: 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_0063: 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_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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
if (_stateImpulse)
{
_ambientTimer = Random.Range(5f, 15f);
stateTimer = 5f;
bool flag = false;
LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 30f, 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 + Random.insideUnitSphere * 1f, 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.NavMeshAgent.SetDestination(_agentDestination);
EnemyReflectionUtil.SetNotMovingTimer(_rigidbody, 0f);
_stateImpulse = false;
}
}
else
{
if (EnemyReflectionUtil.GetNotMovingTimer(_rigidbody) > 2f)
{
stateTimer -= Time.deltaTime;
}
SemiFunc.EnemyCartJump(_enemy);
if (Vector3.Distance(((Component)this).transform.position, _agentDestination) < 1f || stateTimer <= 0f)
{
SemiFunc.EnemyCartJumpReset(_enemy);
UpdateState(State.Idle);
}
}
if (_ambientImpulse)
{
_ambientImpulse = false;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayRoam", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.PlayRoamSound();
}
_ambientTimer = Random.Range(15f, 20f);
}
}
private void StateStun()
{
if (_stateImpulse)
{
_stateImpulse = false;
}
if (!_enemy.IsStunned())
{
UpdateState(State.Idle);
}
}
public void OnSpawn()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(_enemy))
{
UpdateState(State.Spawn);
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_SetTrigger", (RpcTarget)0, new object[1] { "Spawn" });
_photonView.RPC("RPC_PlaySpawn", (RpcTarget)0, Array.Empty<object>());
_photonView.RPC("RPC_PlaySpawnParticles", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.animator.SetTrigger("Spawn");
animator.PlaySpawnSound();
animator.SpawnParticlesImpulse();
}
}
}
[PunRPC]
private void PlaySpawnEffectsRPC()
{
_photonView.RPC("RPC_SetTrigger", (RpcTarget)0, new object[1] { "Attack" });
animator.SpawnParticlesImpulse();
animator.PlaySpawnSound();
}
public void OnVision()
{
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
if ((currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate) && !_enemy.IsStunned())
{
if (SemiFunc.IsMasterClientOrSingleplayer())
{
_targetPlayer = EnemyReflectionUtil.GetVisionTriggeredPlayer(_vision);
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { _photonView.ViewID });
}
UpdateState(State.Investigate);
animator.PlayVisionSound();
}
}
else if (currentState == State.Investigate || currentState == State.LookForPlayer)
{
if (!Object.op_Implicit((Object)(object)_targetPlayer))
{
_targetPlayer = EnemyReflectionUtil.GetVisionTriggeredPlayer(_vision);
}
if (Enemy.Vision.onVisionTriggeredCulled && !Enemy.Vision.onVisionTriggeredNear)
{
_targetPosition = ((Component)_targetPlayer).transform.position;
}
else if (Enemy.Vision.onVisionTriggeredDistance < 5f)
{
UpdateState(State.Chase);
}
}
}
public void OnInvestigate()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && (currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.LookForPlayer))
{
_targetPosition = EnemyReflectionUtil.GetOnInvestigateTriggeredPosition(_investigate);
UpdateState(State.Investigate);
}
}
public void OnHurt()
{
_hurtImpulse = true;
_unsuccessfulAttackCount = 0;
_currentInterest -= _hurtInterestLoss;
if (_currentInterest <= 0f)
{
UpdateState(State.Roam);
}
if (HordeOnHurt && SemiFunc.IsMasterClientOrSingleplayer() && _spawnedZombies < MAX_SPAWNED_ZOMBIES && _spawnCooldown <= 0f)
{
RandomSpawnChance = Random.Range(0f, 100f);
if (RandomSpawnChance <= spawnHordeChance)
{
ZombieHordeSpawn();
_spawnCooldown = 5f;
_spawnedZombies++;
}
}
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayHurt", (RpcTarget)0, Array.Empty<object>());
return;
}
animator.PlayHurtSound();
animator.HurtParticlesImpulse();
}
[PunRPC]
private void PlayHurtEffectsRPC()
{
animator.PlayHurtSound();
animator.HurtParticlesImpulse();
}
public void OnObjectHurt()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_enemy.Health.onObjectHurtPlayer != (Object)null && _spawnedZombies < MAX_SPAWNED_ZOMBIES && _spawnCooldown <= 0f)
{
RandomSpawnChance = Random.Range(0f, 100f);
if (RandomSpawnChance <= spawnHordeChance)
{
ZombieHordeSpawn();
_spawnCooldown = 5f;
_spawnedZombies++;
}
}
_hurtImpulse = true;
_unsuccessfulAttackCount = 0;
_currentInterest -= _hurtInterestLoss;
if (_currentInterest <= 0f)
{
UpdateState(State.Roam);
}
animator.PlayHurtSound();
animator.HurtParticlesImpulse();
}
public void ZombieHordeSpawn()
{
//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_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_004e: 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_0050: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: 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_00c8: 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 (!SemiFunc.IsMasterClientOrSingleplayer() || _totalZombies >= 10)
{
return;
}
EnemySetup enemyByName = Enemies.GetEnemyByName("mczombie");
Vector3 val = _lastSeenPlayerPosition + Random.insideUnitSphere * 3f;
NavMeshHit val2 = default(NavMeshHit);
if (NavMesh.SamplePosition(val + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("SpawnEnemyRPC", (RpcTarget)0, new object[2]
{
((NavMeshHit)(ref val2)).position,
((Component)_enemy).transform.rotation
});
}
else
{
Enemies.SpawnEnemy(enemyByName, ((NavMeshHit)(ref val2)).position, ((Component)_enemy).transform.rotation, false);
}
_totalZombies++;
}
}
[PunRPC]
private void SpawnEnemyRPC(Vector3 position, Quaternion rotation)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
EnemySetup enemyByName = Enemies.GetEnemyByName("mczombie");
Enemies.SpawnEnemy(enemyByName, position, rotation, false);
_totalZombies++;
}
public void OnDeath()
{
//IL_0065: 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)
_deathImpulse = true;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayDeath", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.PlayDeathSound();
animator.DeathParticlesImpulse();
}
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())
{
_enemyParent.Despawn();
RandomSpawnChance = Random.Range(0f, 100f);
if (_spawnCooldown <= 0f && RandomSpawnChance <= spawnHordeChance && _spawnedZombies < MAX_SPAWNED_ZOMBIES)
{
ZombieHordeSpawn();
_spawnCooldown = 5f;
_spawnedZombies++;
}
}
_totalZombies--;
}
public void OnStun()
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayStunned", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.OnStun();
}
}
public void OnUnstun()
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("RPC_PlayUnstunned", (RpcTarget)0, Array.Empty<object>());
}
else
{
animator.OnUnstun();
}
}
public void OnGrabbed()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && currentState != State.Attack && currentState != State.Chase && currentState != State.Stun)
{
_targetPlayer = _enemy.Vision.onVisionTriggeredPlayer;
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID });
}
UpdateState(State.Chase);
}
}
public void OnSpawnComplete()
{
UpdateState(State.Idle);
}
public bool hasTargetLineOfSight()
{
//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_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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//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_0074: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)_targetPlayer) || EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer))
{
return false;
}
Vector3 val = ((Component)_rigidbody).transform.position + Vector3.up * 1.5f;
Vector3 val2 = ((Component)_targetPlayer).transform.position + Vector3.up * 1f - val;
float magnitude = ((Vector3)(ref val2)).magnitude;
if (magnitude > 10f)
{
return false;
}
bool result = false;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val, ((Vector3)(ref val2)).normalized, ref val3, magnitude, LayerMask.GetMask(new string[1] { "Default" })))
{
if (((Component)((RaycastHit)(ref val3)).transform).CompareTag("Player"))
{
result = true;
}
}
else
{
result = true;
}
return result;
}
[PunRPC]
private void PlayAttackEffectsRPC()
{
animator.PlayAttackSound();
animator.AttackPlayer();
animator.animator.SetBool("isAttacking", true);
}
[PunRPC]
private void TriggerAttackRPC()
{
_photonView.RPC("RPC_SetTrigger", (RpcTarget)0, new object[1] { "Attack" });
}
[PunRPC]
public void RPC_SetTrigger(string trigger)
{
animator.animator.SetTrigger(trigger);
}
[PunRPC]
public void RPC_SetBool(string param, bool value)
{
animator.animator.SetBool(param, value);
}
[PunRPC]
public void RPC_SetFloat(string param, float value)
{
animator.animator.SetFloat(param, value);
}
[PunRPC]
public void RPC_PlayAttack()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
animator.animator.SetTrigger("Attack");
animator.attackSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayHurt()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
animator.hurtSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
ParticleSystem[] hurtParticles = animator.hurtParticles;
foreach (ParticleSystem val in hurtParticles)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
[PunRPC]
public void RPC_PlayDeath()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
animator.deathSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
ParticleSystem[] deathParticles = animator.deathParticles;
foreach (ParticleSystem val in deathParticles)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
[PunRPC]
public void RPC_PlaySpawn()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
animator.spawnSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
ParticleSystem[] spawnParticles = animator.spawnParticles;
foreach (ParticleSystem val in spawnParticles)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
[PunRPC]
public void RPC_SetDespawn()
{
EnemyReflectionUtil.GetEnemyParent(Enemy).Despawn();
}
[PunRPC]
public void RPC_PlayRoam()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
animator.roamSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayVision()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
animator.visionSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayCurious()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
animator.curiousSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayLookForPlayer()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
animator.lookForPlayerSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayChasePlayer()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
animator.chasePlayerSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayPlayerHit()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
animator.playerHitSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayStunned()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
animator.animator.SetBool("isStunned", true);
animator.stunnedSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayUnstunned()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
animator.animator.SetBool("isStunned", false);
animator.unstunnedSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayFootstep()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
animator.footstepSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
[PunRPC]
public void RPC_PlayDeathParticles()
{
ParticleSystem[] deathParticles = animator.deathParticles;
foreach (ParticleSystem val in deathParticles)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
[PunRPC]
public void RPC_PlayHurtParticles()
{
ParticleSystem[] hurtParticles = animator.hurtParticles;
foreach (ParticleSystem val in hurtParticles)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
[PunRPC]
public void RPC_PlaySpawnParticles()
{
ParticleSystem[] spawnParticles = animator.spawnParticles;
foreach (ParticleSystem val in spawnParticles)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
}
public class EnemyMCZombieAnim : MonoBehaviour
{
public enum AnimValueType
{
Trigger,
Float,
Int,
Bool
}
[Serializable]
public class AnimValueDisplay
{
public string name;
public AnimValueType type;
public bool enabled = true;
}
[Header("References")]
public EnemyMCZombie controller;
public Animator animator;
public HurtCollider hurtCollider;
public Rigidbody rigidbody;
[Header("Particles")]
public ParticleSystem[] hurtParticles;
public ParticleSystem[] deathParticles;
public ParticleSystem[] spawnParticles;
[Header("Sounds")]
public Sound roamSounds;
public Sound curiousSounds;
public Sound visionSounds;
public Sound hurtSounds;
public Sound deathSounds;
public Sound attackSounds;
public Sound lookForPlayerSounds;
public Sound chasePlayerSounds;
public Sound stunnedSounds;
public Sound unstunnedSounds;
public Sound footstepSounds;
public Sound spawnSounds;
public Sound playerHitSounds;
[Header("Constraints")]
public ParentConstraint parentConstraint;
[SerializeField]
private List<AnimValueDisplay> availableAnimValues = new List<AnimValueDisplay>
{
new AnimValueDisplay
{
name = "Walking",
type = AnimValueType.Float
},
new AnimValueDisplay
{
name = "isWalking",
type = AnimValueType.Bool
},
new AnimValueDisplay
{
name = "isStunned",
type = AnimValueType.Bool
},
new AnimValueDisplay
{
name = "isAttacking",
type = AnimValueType.Bool
}
};
public List<AnimValueDisplay> AvailableAnimValues => availableAnimValues;
private void Awake()
{
animator = ((Component)this).GetComponent<Animator>();
if ((Object)(object)hurtCollider == (Object)null)
{
hurtCollider = ((Component)this).GetComponentInChildren<HurtCollider>();
}
if ((Object)(object)hurtCollider != (Object)null)
{
((Component)hurtCollider).gameObject.SetActive(false);
}
if ((Object)(object)parentConstraint == (Object)null)
{
parentConstraint = ((Component)this).GetComponent<ParentConstraint>();
}
Transform obj = ((Component)this).transform.parent.Find("Rigidbody");
rigidbody = ((obj != null) ? ((Component)obj).GetComponent<Rigidbody>() : null);
if ((Object)(object)rigidbody == (Object)null)
{
Debug.LogError((object)"Rigidbody not found");
}
}
private void Update()
{
if (controller.DeathImpulse)
{
controller.DeathImpulse = false;
animator.SetTrigger("Death");
}
}
public void SetDespawn()
{
EnemyReflectionUtil.GetEnemyParent(controller.Enemy).Despawn();
}
public void DeathParticlesImpulse()
{
ParticleSystem[] array = deathParticles;
foreach (ParticleSystem val in array)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
public void HurtParticlesImpulse()
{
ParticleSystem[] array = hurtParticles;
foreach (ParticleSystem val in array)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
public void SpawnParticlesImpulse()
{
ParticleSystem[] array = spawnParticles;
foreach (ParticleSystem val in array)
{
((Component)val).gameObject.SetActive(true);
val.Play();
}
}
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 PlayVisionSound()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
visionSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void PlayCuriousSound()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
curiousSounds.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)
attackSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void AttackPlayer()
{
animator.SetTrigger("Attack");
}
public void PlayLookForPlayerSound()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
lookForPlayerSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void PlayChasePlayerSound()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
chasePlayerSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void PlaySpawnSound()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
spawnSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void PlayPlayerHitSound()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
playerHitSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void OnFootstep()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
footstepSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void OnStun()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
animator.SetBool("isStunned", true);
stunnedSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void OnUnstun()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
animator.SetBool("isStunned", false);
unstunnedSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void OnSpawnComplete()
{
controller.OnSpawnComplete();
((Behaviour)parentConstraint).enabled = true;
rigidbody.isKinematic = false;
}
public void OnSpawnsStart()
{
((Behaviour)parentConstraint).enabled = false;
rigidbody.isKinematic = true;
}
}
}