using System;
using System.Collections;
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 BepInEx.Bootstrap;
using BepInEx.Configuration;
using BigEyes.Utils;
using GameNetcodeStuff;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using com.github.zehsteam.SellMyScrap.MonoBehaviours;
using com.github.zehsteam.SellMyScrap.ScrapEaters;
[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("BigEyes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("BigEyes")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+19ce93332f127c10c40b65a7308d0d9c7d7ac34b")]
[assembly: AssemblyProduct("BigEyes")]
[assembly: AssemblyTitle("BigEyes")]
[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 BigEyes
{
[BepInPlugin("wexop.bigeyes", "BigEyes", "1.3.6")]
[BepInDependency("evaisa.lethallib", "0.15.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BigEyesPlugin : BaseUnityPlugin
{
private const string GUID = "wexop.bigeyes";
private const string NAME = "BigEyes";
private const string VERSION = "1.3.6";
public bool isSellMyScrapIsHere;
public static string SellMyScrapReferenceChain = "com.github.zehsteam.SellMyScrap";
public static BigEyesPlugin instance;
public ConfigEntry<string> spawnMoonRarity;
public ConfigEntry<string> scrapMoonRarity;
public ConfigEntry<float> smallEyesScrapVolume;
public ConfigEntry<float> minSleepTimeEntry;
public ConfigEntry<float> maxSleepTimeEntry;
public ConfigEntry<float> minSearchTimeEntry;
public ConfigEntry<float> maxSearchTimeEntry;
public ConfigEntry<float> wakeUpTimeEntry;
public ConfigEntry<float> visionWidthEntry;
public ConfigEntry<float> searchSpeedEntry;
public ConfigEntry<float> angrySpeedEntry;
public ConfigEntry<float> normalAccelerationEntry;
public ConfigEntry<float> angryAccelerationEntry;
public ConfigEntry<float> angularSpeedEntry;
public ConfigEntry<float> chaseTime;
public ConfigEntry<float> openDoorMutliplierNormalEntry;
public ConfigEntry<float> openDoorMutliplierAngryEntry;
public ConfigEntry<int> scrapEaterWeight;
public ConfigEntry<int> maxBigEyesSpawnNb;
private void Awake()
{
instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)"BigEyes starting....");
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bigeyes");
AssetBundle bundle = AssetBundle.LoadFromFile(text);
((BaseUnityPlugin)this).Logger.LogInfo((object)"BigEyes bundle found !");
LoadConfigs();
RegisterMonster(bundle);
RegisterScrap(bundle);
if (Chainloader.PluginInfos.ContainsKey(SellMyScrapReferenceChain))
{
Debug.Log((object)"SellMyScrap found !");
isSellMyScrapIsHere = true;
LoadScrapEater(bundle);
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"BigEyes is ready!");
}
private void LoadScrapEater(AssetBundle bundle)
{
scrapEaterWeight = ((BaseUnityPlugin)this).Config.Bind<int>("SellMyScrap", "bigEyesScrapEaterWeight", 1, "BigEyes scrap eater weight");
CreateIntConfig(scrapEaterWeight);
GameObject val = bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/BigEyes/BigEyesScrapEaterPrefab.prefab");
Debug.Log((object)(((Object)val).name + " FOUND"));
ScrapEaterManager.AddScrapEater(val, (Func<int>)(() => scrapEaterWeight.Value));
}
private void LoadConfigs()
{
spawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SpawnRarity", "Modded:40,ExperimentationLevel:20,AssuranceLevel:20,VowLevel:20,OffenseLevel:25,MarchLevel:25,RendLevel:30,DineLevel:30,TitanLevel:50,Adamance:50,Embrion:50,Artifice:55", "Chance for big eyes to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
CreateStringConfig(spawnMoonRarity, requireRestart: true);
scrapMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "ScrapSpawnRarity", "Modded:15,ExperimentationLevel:10,AssuranceLevel:10,VowLevel:15,OffenseLevel:15,MarchLevel:15,RendLevel:20,DineLevel:20,TitanLevel:20,Adamance:20,Embrion:30,Artifice:30", "Chance for big eyes to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
CreateStringConfig(scrapMoonRarity, requireRestart: true);
smallEyesScrapVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "smallEyesScrapVolume", 0.7f, "SmallEyes scrap item sound volume. You need to restart the game.");
CreateFloatConfig(smallEyesScrapVolume, 0f, 1f);
maxBigEyesSpawnNb = ((BaseUnityPlugin)this).Config.Bind<int>("Custom Behavior", "maxSpawnNumber", 2, "BigEyes max spawn number in one moon. You don't need to restart the game !");
CreateIntConfig(maxBigEyesSpawnNb, 1, 20);
minSleepTimeEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "minSleepDuration", 10f, "BigEyes min sleep phase duration. You don't need to restart the game !");
CreateFloatConfig(minSleepTimeEntry);
maxSleepTimeEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "maxSleepDuration", 25f, "BigEyes max sleep phase duration. You don't need to restart the game !");
CreateFloatConfig(maxSleepTimeEntry);
minSearchTimeEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "minSearchDuration", 10f, "BigEyes min search phase duration. You don't need to restart the game !");
CreateFloatConfig(minSearchTimeEntry);
maxSearchTimeEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "maxSearchDuration", 25f, "BigEyes max search phase duration. You don't need to restart the game !");
CreateFloatConfig(maxSearchTimeEntry);
wakeUpTimeEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "wakeUpDuration", 2f, "BigEyes wake up duration, where he can't detect any player. You don't need to restart the game !");
CreateFloatConfig(wakeUpTimeEntry);
visionWidthEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "visionWidth", 100f, "BigEyes vision with. You don't need to restart the game !");
CreateFloatConfig(visionWidthEntry, 1f, 500f);
searchSpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "searchSpeed", 5f, "BigEyes speed on search phase. See NavMeshAgent from Unity for more infos. You don't need to restart the game !");
CreateFloatConfig(searchSpeedEntry);
angrySpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "angrySpeed", 9f, "BigEyes speed on angry phase. See NavMeshAgent from Unity for more infos. You don't need to restart the game !");
CreateFloatConfig(angrySpeedEntry);
normalAccelerationEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "normalAcceleration", 10f, "BigEyes acceleration on angry phase. See NavMeshAgent from Unity for more infos. You don't need to restart the game !");
CreateFloatConfig(normalAccelerationEntry);
angryAccelerationEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "angryAcceleration", 12f, "BigEyes acceleration on angry phase. See NavMeshAgent from Unity for more infos. You don't need to restart the game !");
CreateFloatConfig(angryAccelerationEntry);
angularSpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "angularSpeed", 400f, "BigEyes angularSpeed. See NavMeshAgent from Unity for more infos. You don't need to restart the game !");
CreateFloatConfig(angularSpeedEntry, 1f, 1500f);
chaseTime = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "chaseDuration", 4f, "BigEyes chase duration when he detect a player. You don't need to restart the game !");
CreateFloatConfig(chaseTime);
openDoorMutliplierNormalEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "openDoorMultiplierNormal", 1.5f, "BigEyes open door multiplier on search phase. You don't need to restart the game !");
CreateFloatConfig(openDoorMutliplierNormalEntry);
openDoorMutliplierAngryEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Behavior", "openDoorMultiplierAngry", 0.8f, "BigEyes open door multiplier on angry phase. You don't need to restart the game !");
CreateFloatConfig(openDoorMutliplierAngryEntry);
}
private void RegisterMonster(AssetBundle bundle)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/BigEyes/BigEyes.asset");
val.MaxCount = maxBigEyesSpawnNb.Value;
((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND"));
((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val.enemyPrefab} prefab");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
Utilities.FixMixerGroups(val.enemyPrefab);
TerminalNode val2 = new TerminalNode();
val2.creatureName = "BigEyes";
val2.displayText = "Don't wake him, or he will be very angry...";
TerminalKeyword val3 = new TerminalKeyword();
val3.word = "BigEyes";
RegisterUtil.RegisterEnemyWithConfig(spawnMoonRarity.Value, val, val2, val3, val.PowerLevel, val.MaxCount);
}
private void RegisterScrap(AssetBundle bundle)
{
Item val = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/BigEyes/SmallEyesItem.asset");
((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND"));
((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val.spawnPrefab} prefab");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Utilities.FixMixerGroups(val.spawnPrefab);
RegisterUtil.RegisterScrapWithConfig(scrapMoonRarity.Value, val);
}
private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 100f)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
FloatSliderOptions val = new FloatSliderOptions();
((BaseRangeOptions<float>)val).Min = min;
((BaseRangeOptions<float>)val).Max = max;
((BaseOptions)val).RequiresRestart = false;
FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
}
private void CreateIntConfig(ConfigEntry<int> configEntry, int min = 0, int max = 100)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
IntSliderOptions val = new IntSliderOptions();
((BaseRangeOptions<int>)val).Min = min;
((BaseRangeOptions<int>)val).Max = max;
((BaseOptions)val).RequiresRestart = false;
IntSliderConfigItem val2 = new IntSliderConfigItem(configEntry, val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
}
private void CreateStringConfig(ConfigEntry<string> configEntry, bool requireRestart = false)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions
{
RequiresRestart = requireRestart
});
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "BigEyes";
public const string PLUGIN_NAME = "BigEyes";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace BigEyes.Utils
{
public class RegisterUtil
{
public static void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount)
{
enemy.MaxCount = spawnCount;
enemy.PowerLevel = powerLevel;
var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
}
public static void RegisterScrapWithConfig(string configMoonRarity, Item scrap)
{
var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
Items.RegisterScrap(scrap, dictionary, dictionary2);
}
public static void RegisterShopItemWithConfig(bool enabledScrap, Item item, TerminalNode terminalNode, int itemCost, string configMoonRarity)
{
Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, itemCost);
if (enabledScrap)
{
RegisterScrapWithConfig(configMoonRarity, item);
}
}
public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
foreach (string item in from s in configMoonRarity.Split(',')
select s.Trim())
{
string[] array = item.Split(':');
if (array.Length != 2)
{
continue;
}
string text = array[0];
if (!int.TryParse(array[1], out var result))
{
continue;
}
if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
{
dictionary[result2] = result;
continue;
}
string value = text + "Level";
if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2))
{
dictionary[result2] = result;
}
else
{
dictionary2[text] = result;
}
}
return (dictionary, dictionary2);
}
}
}
namespace BigEyes.Scripts
{
public class BigEyesEnemyAI : EnemyAI
{
public AudioClip wakeUpSound;
public AudioClip angrySound;
public GameObject eyesBody;
public GameObject normalLight;
public GameObject angryLight;
private float minSleepTime = 10f;
private float maxSleepTime = 25f;
private float minSearchTime = 10f;
private float maxSearchTime = 20f;
private float wakeUpTime = 2f;
private float visionWidth = 150f;
private float searchSpeed = 5f;
private float angrySpeed = 10f;
private float normalAcceleration = 10f;
private float angryAcceleration = 13f;
private float angularSpeed = 400f;
private float chaseTime = 4f;
private float openDoorMutliplierNormal = 1.5f;
private float openDoorMutliplierAngry = 0.8f;
private float sleepingTimer = 15f;
private float searchTimer = 15f;
private float attackPlayerTimer = 2f;
private float wakeUpTimer = 2f;
public bool isSleeping;
public float aiInterval;
private Renderer _render;
public Material normalMaterial;
public Material angryMaterial;
private static readonly int Attack = Animator.StringToHash("Attack");
private static readonly int Sleep = Animator.StringToHash("Sleep");
public int lastBehaviorState;
private static readonly int DamagePlayer = Animator.StringToHash("DamagePlayer");
public void ChangeEyesMaterial(bool angry)
{
normalLight.SetActive(!angry);
angryLight.SetActive(angry);
if ((Object)(object)_render != (Object)null)
{
_render.material = (angry ? angryMaterial : normalMaterial);
}
}
public void SetConfigs()
{
minSleepTime = BigEyesPlugin.instance.minSleepTimeEntry.Value;
maxSleepTime = BigEyesPlugin.instance.maxSleepTimeEntry.Value;
minSearchTime = BigEyesPlugin.instance.minSearchTimeEntry.Value;
maxSearchTime = BigEyesPlugin.instance.maxSearchTimeEntry.Value;
wakeUpTime = BigEyesPlugin.instance.wakeUpTimeEntry.Value;
visionWidth = BigEyesPlugin.instance.visionWidthEntry.Value;
searchSpeed = BigEyesPlugin.instance.searchSpeedEntry.Value;
angrySpeed = BigEyesPlugin.instance.angrySpeedEntry.Value;
normalAcceleration = BigEyesPlugin.instance.normalAccelerationEntry.Value;
angryAcceleration = BigEyesPlugin.instance.angryAccelerationEntry.Value;
angularSpeed = BigEyesPlugin.instance.angularSpeedEntry.Value;
chaseTime = BigEyesPlugin.instance.chaseTime.Value;
openDoorMutliplierNormal = BigEyesPlugin.instance.openDoorMutliplierNormalEntry.Value;
openDoorMutliplierAngry = BigEyesPlugin.instance.openDoorMutliplierAngryEntry.Value;
}
public override void Start()
{
((EnemyAI)this).Start();
ChangeEyesMaterial(angry: false);
SetAnimation();
SetConfigs();
List<Renderer> list = eyesBody.GetComponents<Renderer>().ToList();
foreach (Renderer item in list)
{
if (((Object)item.material).name.Contains("BigEyeNormalText"))
{
_render = item;
}
}
base.agent.angularSpeed = angularSpeed;
}
public override void Update()
{
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
aiInterval -= Time.deltaTime;
wakeUpTimer -= Time.deltaTime;
if (isSleeping)
{
sleepingTimer -= Time.deltaTime;
}
else
{
searchTimer -= Time.deltaTime;
}
attackPlayerTimer -= Time.deltaTime;
if (lastBehaviorState != base.currentBehaviourStateIndex)
{
lastBehaviorState = base.currentBehaviourStateIndex;
SetAnimation();
ChangeEyesMaterial(base.currentBehaviourStateIndex == 2);
isSleeping = base.currentBehaviourStateIndex == 0;
}
if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 100f, 60, -1f) && base.currentBehaviourStateIndex == 2)
{
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.8f, true);
}
if (aiInterval <= 0f && ((NetworkBehaviour)this).IsOwner)
{
aiInterval = base.AIIntervalTime;
((EnemyAI)this).DoAIInterval();
}
}
public override void DoAIInterval()
{
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 0f;
isSleeping = true;
base.openDoorSpeedMultiplier = 0f;
if (sleepingTimer <= 0f)
{
isSleeping = false;
sleepingTimer = Random.Range(minSleepTime, maxSleepTime);
wakeUpTimer = wakeUpTime;
((EnemyAI)this).SwitchToBehaviourState(1);
}
break;
case 1:
base.agent.speed = searchSpeed;
base.agent.acceleration = normalAcceleration;
((EnemyAI)this).TargetClosestPlayer(1.5f, true, visionWidth);
base.openDoorSpeedMultiplier = openDoorMutliplierNormal;
if ((Object)(object)base.targetPlayer == (Object)null)
{
if (searchTimer <= 0f)
{
searchTimer = Random.Range(minSearchTime, maxSearchTime);
((EnemyAI)this).SwitchToBehaviourState(0);
}
if (!(wakeUpTimer > 0f) && !base.currentSearch.inProgress)
{
AISearchRoutine val = new AISearchRoutine();
val.searchWidth = 50f;
val.searchPrecision = 8f;
((EnemyAI)this).StartSearch(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false, 50, false).position, val);
}
}
else if (((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false))
{
if ((Object)(object)base.targetPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
break;
}
attackPlayerTimer = chaseTime;
searchTimer = Mathf.Clamp(searchTimer, 0f, 100f) + 3f;
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourState(2);
}
break;
case 2:
base.agent.speed = angrySpeed;
base.agent.acceleration = angryAcceleration;
base.openDoorSpeedMultiplier = openDoorMutliplierAngry;
if (attackPlayerTimer <= 0f)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, true, visionWidth);
attackPlayerTimer = chaseTime / 2f;
searchTimer += 2f;
}
if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false))
{
((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
}
else
{
((EnemyAI)this).SwitchToBehaviourState(1);
}
break;
}
}
public void SetAnimation()
{
switch (base.currentBehaviourStateIndex)
{
case 0:
searchTimer = Random.Range(minSearchTime, maxSearchTime);
base.creatureVoice.clip = null;
base.creatureAnimator.SetBool(Attack, false);
base.creatureAnimator.SetBool(Sleep, true);
break;
case 1:
sleepingTimer = Random.Range(minSearchTime, maxSearchTime);
base.creatureVoice.clip = wakeUpSound;
base.creatureVoice.Play();
base.creatureAnimator.SetBool(Attack, false);
base.creatureAnimator.SetBool(Sleep, false);
break;
case 2:
base.creatureVoice.clip = angrySound;
base.creatureVoice.Play();
base.creatureAnimator.SetBool(Attack, true);
base.creatureAnimator.SetBool(Sleep, false);
break;
}
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (!isSleeping)
{
base.creatureAnimator.SetTrigger(DamagePlayer);
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, true);
if ((Object)(object)val != (Object)null)
{
val.KillPlayer(Vector3.forward * 3f, true, (CauseOfDeath)0, 0, default(Vector3));
}
((EnemyAI)this).PlayAnimationOfCurrentState();
}
}
}
public class SmallEyeItem : NoisemakerProp
{
public Animator Animator;
private static readonly int Angry = Animator.StringToHash("Angry");
public AudioClip grabSFX;
public override void Start()
{
((NoisemakerProp)this).Start();
ResetVolume();
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
ResetVolume();
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
ResetVolume();
((NoisemakerProp)this).ItemActivate(used, buttonDown);
Animator.SetTrigger(Angry);
}
public void ResetVolume()
{
base.noiseAudio.volume = BigEyesPlugin.instance.smallEyesScrapVolume.Value;
base.noiseAudioFar.volume = BigEyesPlugin.instance.smallEyesScrapVolume.Value;
base.minLoudness = BigEyesPlugin.instance.smallEyesScrapVolume.Value;
base.maxLoudness = BigEyesPlugin.instance.smallEyesScrapVolume.Value;
}
public override void GrabItem()
{
ResetVolume();
base.noiseAudio.PlayOneShot(grabSFX);
((GrabbableObject)this).GrabItem();
}
}
}
namespace BigEyes.ScrapEater
{
public class BigEyesScrapEater : ScrapEaterExtraBehaviour
{
public Animator animator;
private static readonly int Angry = Animator.StringToHash("Angry");
public List<Transform> mouthPos;
public Collider collider;
protected override IEnumerator StartAnimation()
{
yield return ((MonoBehaviour)this).StartCoroutine(((ScrapEaterExtraBehaviour)this).MoveToPosition(base.spawnPosition, base.startPosition, 2f));
((ScrapEaterExtraBehaviour)this).PlayOneShotSFX(base.landSFX, base.landIndex, 1f);
((ScrapEaterExtraBehaviour)this).ShakeCamera(8f, 18f);
yield return (object)new WaitForSeconds(1f);
((ScrapEaterExtraBehaviour)this).PlayAudioSource(base.movementAudio);
yield return ((MonoBehaviour)this).StartCoroutine(((ScrapEaterExtraBehaviour)this).MoveToPosition(base.startPosition, base.endPosition, base.movementDuration));
((ScrapEaterExtraBehaviour)this).StopAudioSource(base.movementAudio);
yield return (object)new WaitForSeconds(base.pauseDuration);
MoveScrapsToEyes(base.suckDuration - 0.1f);
yield return (object)new WaitForSeconds(base.suckDuration * 0.25f);
animator.SetBool(Angry, true);
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
collider.enabled = true;
yield return (object)new WaitForSeconds(((ScrapEaterExtraBehaviour)this).PlayOneShotSFX(base.eatSFX, 1f));
((ScrapEaterExtraBehaviour)this).PlayAudioSource(base.movementAudio);
yield return ((MonoBehaviour)this).StartCoroutine(((ScrapEaterExtraBehaviour)this).MoveToPosition(base.endPosition, base.startPosition, base.movementDuration));
((ScrapEaterExtraBehaviour)this).StopAudioSource(base.movementAudio);
yield return (object)new WaitForSeconds(1f);
((ScrapEaterExtraBehaviour)this).PlayOneShotSFX(base.takeOffSFX, 1f);
yield return ((MonoBehaviour)this).StartCoroutine(((ScrapEaterExtraBehaviour)this).MoveToPosition(base.startPosition, base.spawnPosition, base.takeOffSFX.length));
}
private void MoveScrapsToEyes(float duration)
{
((ScrapEaterBehaviour)this).targetScrap.ForEach(delegate(GrabbableObject item)
{
if (!((Object)(object)item == (Object)null))
{
SuckBehaviour val = ((Component)item).gameObject.AddComponent<SuckBehaviour>();
val.StartEvent(mouthPos[Random.Range(0, mouthPos.Count)], Random.Range(duration * 0.5f, duration * 2f));
}
});
}
private void OnTriggerEnter(Collider other)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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)
if (((Component)other).CompareTag("Player"))
{
PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
if (!component.isPlayerDead)
{
component.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3));
}
}
}
}
}