Decompiled source of L42A1 v1.0.2

L42A1.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using Popcron;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;
using Sodalite.Api;
using Sodalite.Utilities;
using UnityEditor;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
using UnityEngine.UI;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Gamemodes
{
	[CreateAssetMenu(fileName = "New Atlas Object Table", menuName = "MeatKit/Gamemodes/AtlasObjectTable", order = 0)]
	public class AtlasObjectTable : ScriptableObject
	{
		[Header("General Tags")]
		public ObjectCategory Category;

		public List<OTagEra> Eras = new List<OTagEra>();

		public List<OTagSet> Sets = new List<OTagSet>();

		public List<OTagFirearmCountryOfOrigin> CountriesOfOrigin = new List<OTagFirearmCountryOfOrigin>();

		public int EarliestYear = -1;

		public int LatestYear = -1;

		[Header("Firearm Tags")]
		public List<OTagFirearmSize> Sizes = new List<OTagFirearmSize>();

		public List<OTagFirearmAction> Actions = new List<OTagFirearmAction>();

		public List<OTagFirearmFiringMode> Modes = new List<OTagFirearmFiringMode>();

		public List<OTagFirearmFiringMode> ExcludedModes = new List<OTagFirearmFiringMode>();

		public List<OTagFirearmFeedOption> FeedOptions = new List<OTagFirearmFeedOption>();

		public List<OTagFirearmMount> MountsAvailable = new List<OTagFirearmMount>();

		public List<OTagFirearmRoundPower> RoundPowers = new List<OTagFirearmRoundPower>();

		[Header("Attachment Tags")]
		public List<OTagAttachmentFeature> Features = new List<OTagAttachmentFeature>();

		public List<OTagFirearmMount> MountTypes = new List<OTagFirearmMount>();

		[Header("Melee Tags")]
		public List<OTagMeleeStyle> MeleeStyles = new List<OTagMeleeStyle>();

		public List<OTagMeleeHandedness> MeleeHandedness = new List<OTagMeleeHandedness>();

		public List<OTagThrownType> ThrownTypes = new List<OTagThrownType>();

		public List<OTagThrownDamageType> ThrownDamageTypes = new List<OTagThrownDamageType>();

		[Header("Misc Tags")]
		public List<OTagPowerupType> PowerupTypes = new List<OTagPowerupType>();

		[Header("Ammo Properties")]
		public int MinAmmoCapacity = -1;

		public int MaxAmmoCapacity = -1;

		public bool OverrideMagType;

		public bool OverrideRoundType;

		public FireArmMagazineType MagTypeOverride;

		public FireArmRoundType RoundTypeOverride;

		[Header("Misc Properties")]
		public List<string> WhitelistedObjectIDs = new List<string>();

		public List<string> BlacklistedObjectIDs = new List<string>();

		[NonSerialized]
		public List<FVRObject> generatedObjects;

		public void GenerateTable()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			generatedObjects = new List<FVRObject>();
			foreach (FVRObject fvr in IM.OD.Values)
			{
				if (WhitelistedObjectIDs.Contains(fvr.ItemID))
				{
					generatedObjects.Add(fvr);
				}
				else if (!BlacklistedObjectIDs.Contains(fvr.ItemID) && fvr.OSple && fvr.Category == Category && (Eras.Count <= 0 || Eras.Contains(fvr.TagEra)) && (Sets.Count <= 0 || Sets.Contains(fvr.TagSet)) && (CountriesOfOrigin.Count <= 0 || CountriesOfOrigin.Contains(fvr.TagFirearmCountryOfOrigin)) && (EarliestYear <= -1 || fvr.TagFirearmFirstYear >= EarliestYear) && (LatestYear <= -1 || fvr.TagFirearmFirstYear <= LatestYear) && (Sizes.Count <= 0 || Sizes.Contains(fvr.TagFirearmSize)) && (Actions.Count <= 0 || Actions.Contains(fvr.TagFirearmAction)) && (Modes.Count <= 0 || Modes.Any((OTagFirearmFiringMode o) => fvr.TagFirearmFiringModes.Contains(o))) && (ExcludedModes.Count <= 0 || !ExcludedModes.Any((OTagFirearmFiringMode o) => fvr.TagFirearmFiringModes.Contains(o))) && (FeedOptions.Count <= 0 || FeedOptions.Any((OTagFirearmFeedOption o) => fvr.TagFirearmFeedOption.Contains(o))) && (MountsAvailable.Count <= 0 || MountsAvailable.Any((OTagFirearmMount o) => fvr.TagFirearmMounts.Contains(o))) && (RoundPowers.Count <= 0 || RoundPowers.Contains(fvr.TagFirearmRoundPower)) && (Features.Count <= 0 || Features.Contains(fvr.TagAttachmentFeature)) && (MountTypes.Count <= 0 || MountTypes.Contains(fvr.TagAttachmentMount)) && (MeleeStyles.Count <= 0 || MeleeStyles.Contains(fvr.TagMeleeStyle)) && (MeleeHandedness.Count <= 0 || MeleeHandedness.Contains(fvr.TagMeleeHandedness)) && (ThrownTypes.Count <= 0 || ThrownTypes.Contains(fvr.TagThrownType)) && (ThrownDamageTypes.Count <= 0 || ThrownDamageTypes.Contains(fvr.TagThrownDamageType)) && (PowerupTypes.Count <= 0 || PowerupTypes.Contains(fvr.TagPowerupType)) && (MinAmmoCapacity <= -1 || fvr.MaxCapacityRelated >= MinAmmoCapacity) && (MaxAmmoCapacity <= -1 || fvr.MinCapacityRelated <= MaxAmmoCapacity) && (!OverrideMagType || fvr.MagazineType == MagTypeOverride) && (!OverrideRoundType || fvr.RoundType == RoundTypeOverride))
				{
					generatedObjects.Add(fvr);
				}
			}
		}
	}
	[CreateAssetMenu(fileName = "New Atlas Outfit Config", menuName = "MeatKit/Gamemodes/AtlasOutfitConfig", order = 0)]
	public class AtlasOutfitConfigTemplate : ScriptableObject
	{
		public List<string> Headwear;

		public float Chance_Headwear;

		public List<string> Eyewear;

		public float Chance_Eyewear;

		public List<string> Facewear;

		public float Chance_Facewear;

		public List<string> Torsowear;

		public float Chance_Torsowear;

		public List<string> Pantswear;

		public float Chance_Pantswear;

		public List<string> Pantswear_Lower;

		public float Chance_Pantswear_Lower;

		public List<string> Backpacks;

		public float Chance_Backpacks;

		public SosigOutfitConfig GetOutfitConfig()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			SosigOutfitConfig val = (SosigOutfitConfig)ScriptableObject.CreateInstance(typeof(SosigOutfitConfig));
			val.Chance_Headwear = Chance_Headwear;
			val.Headwear = Headwear.Select((string o) => IM.OD[o]).ToList();
			val.Chance_Eyewear = Chance_Eyewear;
			val.Eyewear = Eyewear.Select((string o) => IM.OD[o]).ToList();
			val.Chance_Facewear = Chance_Facewear;
			val.Facewear = Facewear.Select((string o) => IM.OD[o]).ToList();
			val.Chance_Torsowear = Chance_Torsowear;
			val.Torsowear = Torsowear.Select((string o) => IM.OD[o]).ToList();
			val.Chance_Pantswear = Chance_Pantswear;
			val.Pantswear = Pantswear.Select((string o) => IM.OD[o]).ToList();
			val.Chance_Pantswear_Lower = Chance_Pantswear_Lower;
			val.Pantswear_Lower = Pantswear_Lower.Select((string o) => IM.OD[o]).ToList();
			val.Chance_Backpacks = Chance_Backpacks;
			val.Backpacks = Backpacks.Select((string o) => IM.OD[o]).ToList();
			return val;
		}
	}
	[CreateAssetMenu(fileName = "New Atlas Config", menuName = "MeatKit/Gamemodes/AtlasConfigTemplate", order = 0)]
	public class AtlasSosigConfigTemplate : ScriptableObject
	{
		public float ViewDistance;

		public float HearingDistance;

		public float MaxFOV;

		public float SearchExtentsModifier;

		public bool DoesAggroOnFriendlyFire;

		public bool HasABrain;

		public bool DoesDropWeaponsOnBallistic;

		public bool CanPickupRanged;

		public bool CanPickupMelee;

		public bool CanPickupOther;

		public int TargetCapacity;

		public float TargetTrackingTime;

		public float NoFreshTargetTime;

		public float AssaultPointOverridesSkirmishPointWhenFurtherThan;

		public float RunSpeed;

		public float WalkSpeed;

		public float SneakSpeed;

		public float CrawlSpeed;

		public float TurnSpeed;

		public float MaxJointLimit;

		public float MovementRotMagnitude;

		public float TotalMustard;

		public float BleedDamageMult;

		public float BleedRateMultiplier;

		public float BleedVFXIntensity;

		public float DamMult_Projectile;

		public float DamMult_Explosive;

		public float DamMult_Melee;

		public float DamMult_Piercing;

		public float DamMult_Blunt;

		public float DamMult_Cutting;

		public float DamMult_Thermal;

		public float DamMult_Chilling;

		public float DamMult_EMP;

		public List<float> LinkDamageMultipliers;

		public List<float> LinkStaggerMultipliers;

		public List<Vector2> StartingLinkIntegrity;

		public List<float> StartingChanceBrokenJoint;

		public float ShudderThreshold;

		public float ConfusionThreshold;

		public float ConfusionMultiplier;

		public float ConfusionTimeMax;

		public float StunThreshold;

		public float StunMultiplier;

		public float StunTimeMax;

		public bool CanBeGrabbed;

		public bool CanBeSevered;

		public bool CanBeStabbed;

		public bool CanBeSurpressed;

		public float SuppressionMult;

		public bool DoesJointBreakKill_Head;

		public bool DoesJointBreakKill_Upper;

		public bool DoesJointBreakKill_Lower;

		public bool DoesSeverKill_Head;

		public bool DoesSeverKill_Upper;

		public bool DoesSeverKill_Lower;

		public bool DoesExplodeKill_Head;

		public bool DoesExplodeKill_Upper;

		public bool DoesExplodeKill_Lower;

		public SosigConfigTemplate GetConfigTemplate()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			SosigConfigTemplate val = (SosigConfigTemplate)ScriptableObject.CreateInstance(typeof(SosigConfigTemplate));
			val.ViewDistance = ViewDistance;
			val.HearingDistance = HearingDistance;
			val.MaxFOV = MaxFOV;
			val.SearchExtentsModifier = SearchExtentsModifier;
			val.DoesAggroOnFriendlyFire = DoesAggroOnFriendlyFire;
			val.HasABrain = HasABrain;
			val.DoesDropWeaponsOnBallistic = DoesDropWeaponsOnBallistic;
			val.CanPickup_Ranged = CanPickupRanged;
			val.CanPickup_Melee = CanPickupMelee;
			val.CanPickup_Other = CanPickupOther;
			val.TargetCapacity = TargetCapacity;
			val.TargetTrackingTime = TargetTrackingTime;
			val.NoFreshTargetTime = NoFreshTargetTime;
			val.AssaultPointOverridesSkirmishPointWhenFurtherThan = AssaultPointOverridesSkirmishPointWhenFurtherThan;
			val.RunSpeed = RunSpeed;
			val.WalkSpeed = WalkSpeed;
			val.SneakSpeed = SneakSpeed;
			val.CrawlSpeed = CrawlSpeed;
			val.TurnSpeed = TurnSpeed;
			val.MaxJointLimit = MaxJointLimit;
			val.MovementRotMagnitude = MovementRotMagnitude;
			val.TotalMustard = TotalMustard;
			val.BleedDamageMult = BleedDamageMult;
			val.BleedRateMultiplier = BleedRateMultiplier;
			val.BleedVFXIntensity = BleedVFXIntensity;
			val.DamMult_Projectile = DamMult_Projectile;
			val.DamMult_Explosive = DamMult_Explosive;
			val.DamMult_Melee = DamMult_Melee;
			val.DamMult_Piercing = DamMult_Piercing;
			val.DamMult_Blunt = DamMult_Blunt;
			val.DamMult_Cutting = DamMult_Cutting;
			val.DamMult_Thermal = DamMult_Thermal;
			val.DamMult_Chilling = DamMult_Chilling;
			val.DamMult_EMP = DamMult_EMP;
			val.LinkDamageMultipliers = LinkDamageMultipliers;
			val.LinkStaggerMultipliers = LinkStaggerMultipliers;
			val.StartingLinkIntegrity = StartingLinkIntegrity;
			val.StartingChanceBrokenJoint = StartingChanceBrokenJoint;
			val.ShudderThreshold = ShudderThreshold;
			val.ConfusionThreshold = ConfusionThreshold;
			val.ConfusionMultiplier = ConfusionMultiplier;
			val.ConfusionTimeMax = ConfusionTimeMax;
			val.StunThreshold = StunThreshold;
			val.StunMultiplier = StunMultiplier;
			val.StunTimeMax = StunTimeMax;
			val.CanBeGrabbed = CanBeGrabbed;
			val.CanBeSevered = CanBeSevered;
			val.CanBeStabbed = CanBeStabbed;
			val.CanBeSurpressed = CanBeSurpressed;
			val.SuppressionMult = SuppressionMult;
			val.DoesJointBreakKill_Head = DoesJointBreakKill_Head;
			val.DoesJointBreakKill_Upper = DoesJointBreakKill_Upper;
			val.DoesJointBreakKill_Lower = DoesJointBreakKill_Lower;
			val.DoesSeverKill_Head = DoesSeverKill_Head;
			val.DoesSeverKill_Upper = DoesSeverKill_Upper;
			val.DoesSeverKill_Lower = DoesSeverKill_Lower;
			val.DoesExplodeKill_Head = DoesExplodeKill_Head;
			val.DoesExplodeKill_Upper = DoesExplodeKill_Upper;
			val.DoesExplodeKill_Lower = DoesExplodeKill_Lower;
			val.UsesLinkSpawns = false;
			val.LinkSpawns = new List<FVRObject>();
			val.LinkSpawnChance = new List<float>();
			val.OverrideSpeech = false;
			return val;
		}
	}
	[CreateAssetMenu(fileName = "New Atlas Enemy Template", menuName = "MeatKit/Gamemodes/AtlasEnemyTemplate", order = 0)]
	public class AtlasSosigEnemyTemplate : ScriptableObject
	{
		public string DisplayName;

		public SosigEnemyCategory SosigEnemyCategory;

		public List<string> SosigPrefabs;

		public List<AtlasSosigConfigTemplate> Configs;

		public List<AtlasSosigConfigTemplate> ConfigsEasy;

		public List<AtlasOutfitConfigTemplate> OutfitConfigs;

		public List<string> WeaponOptions;

		public List<string> WeaponOptionsSecondary;

		public List<string> WeaponOptionsTertiary;

		public float SecondaryChance;

		public float TertiaryChance;

		public SosigEnemyTemplate GetSosigEnemyTemplate()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			SosigEnemyTemplate val = (SosigEnemyTemplate)ScriptableObject.CreateInstance(typeof(SosigEnemyTemplate));
			val.DisplayName = DisplayName;
			val.SosigEnemyCategory = SosigEnemyCategory;
			val.SosigPrefabs = SosigPrefabs.Select((string o) => IM.OD[o]).ToList();
			val.ConfigTemplates = Configs.Select((AtlasSosigConfigTemplate o) => o.GetConfigTemplate()).ToList();
			val.ConfigTemplates_Easy = ConfigsEasy.Select((AtlasSosigConfigTemplate o) => o.GetConfigTemplate()).ToList();
			val.OutfitConfig = OutfitConfigs.Select((AtlasOutfitConfigTemplate o) => o.GetOutfitConfig()).ToList();
			val.WeaponOptions = WeaponOptions.Select((string o) => IM.OD[o]).ToList();
			val.WeaponOptions_Secondary = WeaponOptionsSecondary.Select((string o) => IM.OD[o]).ToList();
			val.WeaponOptions_Tertiary = WeaponOptionsTertiary.Select((string o) => IM.OD[o]).ToList();
			val.SecondaryChance = SecondaryChance;
			val.TertiaryChance = TertiaryChance;
			return val;
		}
	}
	public class BuildableCover : MonoBehaviour
	{
		public GameObject coverGeo;

		public MeshRenderer areaMesh;

		public SphereCollider areaCollider;

		public bool built;

		private void OnTriggerEnter(Collider other)
		{
			if (built)
			{
				return;
			}
			Supplies component = ((Component)other).GetComponent<Supplies>();
			if ((Object)(object)component != (Object)null)
			{
				if ((Object)(object)((FVRInteractiveObject)component).m_hand != (Object)null)
				{
					((FVRInteractiveObject)component).ForceBreakInteraction();
				}
				Object.Destroy((Object)(object)((Component)component).gameObject);
				BuildCover();
			}
		}

		public void BuildCover()
		{
			built = true;
			coverGeo.SetActive(true);
			((Collider)areaCollider).enabled = false;
			((Renderer)areaMesh).enabled = false;
		}

		public void ResetCover()
		{
			built = false;
			coverGeo.SetActive(false);
			((Collider)areaCollider).enabled = false;
			((Renderer)areaMesh).enabled = false;
		}
	}
	public class ButtonList : MonoBehaviour
	{
		public SelectableButton buttonPrefab;

		public Transform buttonOrigin;

		public float buttonSpacing;

		[HideInInspector]
		public List<SelectableButton> buttons = new List<SelectableButton>();

		public SelectableButton AddButton(string text, UnityAction onClick, bool selectable)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			SelectableButton buttonComp = Object.Instantiate<SelectableButton>(buttonPrefab, buttonOrigin.position, buttonOrigin.rotation, buttonOrigin);
			Transform transform = ((Component)buttonComp).transform;
			transform.localPosition += Vector3.down * (float)buttons.Count * buttonSpacing;
			buttonComp.text.text = text;
			buttonComp.button.onClick = new ButtonClickedEvent();
			((UnityEvent)buttonComp.button.onClick).AddListener(onClick);
			if (selectable)
			{
				((UnityEvent)buttonComp.button.onClick).AddListener((UnityAction)delegate
				{
					buttonComp.SetSelected();
				});
				buttonComp.otherButtons.AddRange(buttons);
				foreach (SelectableButton button in buttons)
				{
					button.otherButtons.Add(buttonComp);
				}
			}
			buttons.Add(buttonComp);
			return buttonComp;
		}

		public void ClearButtons()
		{
			for (int i = 0; i < buttons.Count; i++)
			{
				Object.Destroy((Object)(object)((Component)buttons[i]).gameObject);
			}
			buttons.Clear();
		}
	}
	[CreateAssetMenu(fileName = "New Loadout Pool", menuName = "Loadout/LoadoutPool", order = 0)]
	public class LoadoutPool : ScriptableObject
	{
		public string poolName;

		public int poolCost;

		public List<AtlasObjectTable> tables;

		public List<string> additionalItems;

		public int minMagCapacity = -1;

		public int maxMagCapacity = -1;

		public int itemsToSpawn = 1;

		[HideInInspector]
		public List<FVRObject> items = new List<FVRObject>();

		private int lastSpawnedIndex = 0;

		public void InitializeTables()
		{
			items.Clear();
			foreach (AtlasObjectTable table in tables)
			{
				table.GenerateTable();
				items.AddRange(table.generatedObjects);
			}
			foreach (string additionalItem in additionalItems)
			{
				if (IM.OD.ContainsKey(additionalItem))
				{
					items.Add(IM.OD[additionalItem]);
				}
			}
			IListExtensions.Shuffle<FVRObject>((IList<FVRObject>)items);
			IListExtensions.Shuffle<FVRObject>((IList<FVRObject>)items);
			lastSpawnedIndex = Random.Range(0, items.Count);
		}

		public FVRObject GetItem()
		{
			lastSpawnedIndex++;
			if (lastSpawnedIndex >= items.Count)
			{
				lastSpawnedIndex = 0;
			}
			return items[lastSpawnedIndex];
		}
	}
	[CreateAssetMenu(fileName = "New Player Loadout", menuName = "Loadout/PlayerLoadout", order = 0)]
	public class PlayerLoadout : ScriptableObject
	{
		public string LoadoutName;

		public LoadoutPool rightHandTable;

		public LoadoutPool leftHandTable;

		public List<LoadoutPool> quickbeltTables;

		public bool magInOtherHand;

		public bool bespokeInOtherHand;
	}
	public enum PlayerState
	{
		waitingToRespawn,
		spectating,
		playing,
		enteringSpectator,
		spawningIn
	}
	public static class PlayerTracker
	{
		public static PlayerState currentPlayerState = PlayerState.spectating;

		public static void EquipPlayer(PlayerLoadout loadout)
		{
			ClearPlayerItems();
			EquipHands(loadout);
			EquipQuickbelt(loadout);
		}

		public static void ClearPlayerItems()
		{
			FVRViveHand component = ((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>();
			FVRInteractiveObject currentInteractable = component.CurrentInteractable;
			if ((Object)(object)currentInteractable != (Object)null)
			{
				currentInteractable.ForceBreakInteraction();
				Object.Destroy((Object)(object)((Component)currentInteractable).gameObject);
			}
			FVRViveHand component2 = ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>();
			FVRInteractiveObject currentInteractable2 = component2.CurrentInteractable;
			if ((Object)(object)currentInteractable2 != (Object)null)
			{
				currentInteractable2.ForceBreakInteraction();
				Object.Destroy((Object)(object)((Component)currentInteractable2).gameObject);
			}
			foreach (FVRQuickBeltSlot quickbeltSlot in GM.CurrentPlayerBody.QuickbeltSlots)
			{
				if ((Object)(object)quickbeltSlot.CurObject != (Object)null)
				{
					FVRPhysicalObject curObject = quickbeltSlot.CurObject;
					curObject.SetQuickBeltSlot((FVRQuickBeltSlot)null);
					Object.Destroy((Object)(object)((Component)curObject).gameObject);
				}
			}
		}

		public static void EquipHands(PlayerLoadout loadout)
		{
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Invalid comparison between Unknown and I4
			bool flag = false;
			bool flag2 = false;
			if ((Object)(object)loadout.rightHandTable != (Object)null)
			{
				FVRObject item = loadout.rightHandTable.GetItem();
				GivePlayerItemRightHand(item.ItemID);
				flag2 = true;
				FVRObject val = null;
				if (item.CompatibleMagazines.Count > 0)
				{
					if (loadout.rightHandTable.maxMagCapacity < 0 && loadout.rightHandTable.minMagCapacity < 0)
					{
						val = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.CompatibleMagazines);
					}
					else
					{
						List<FVRObject> list = item.CompatibleMagazines.Where((FVRObject o) => (loadout.rightHandTable.maxMagCapacity < 0 || o.MagazineCapacity <= loadout.rightHandTable.maxMagCapacity) && (loadout.rightHandTable.minMagCapacity < 0 || o.MagazineCapacity >= loadout.rightHandTable.minMagCapacity)).ToList();
						val = ((list.Count <= 0) ? FirearmAPI.GetSmallestMagazine(item, (Func<FVRObject, bool>)null) : SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)list));
					}
				}
				else if (item.CompatibleClips.Count > 0)
				{
					val = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.CompatibleClips);
				}
				else if (item.CompatibleSpeedLoaders.Count > 0)
				{
					val = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.CompatibleSpeedLoaders);
				}
				else if (item.CompatibleSingleRounds.Count > 0)
				{
					val = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.CompatibleSingleRounds);
				}
				if ((Object)(object)val != (Object)null)
				{
					if (loadout.magInOtherHand && (int)val.Category == 2)
					{
						GivePlayerItemLeftHand(val.ItemID);
						flag = true;
					}
					GivePlayerItemQuickbelt(val.ItemID);
				}
				if (loadout.bespokeInOtherHand && !flag && item.BespokeAttachments.Count > 0)
				{
					GivePlayerItemLeftHand(SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.BespokeAttachments).ItemID);
					flag = true;
				}
			}
			if (!((Object)(object)loadout.leftHandTable != (Object)null) || flag)
			{
				return;
			}
			FVRObject item2 = loadout.leftHandTable.GetItem();
			GivePlayerItemLeftHand(item2.ItemID);
			FVRObject val2 = null;
			if (item2.CompatibleMagazines.Count > 0)
			{
				if (loadout.leftHandTable.maxMagCapacity < 0 && loadout.leftHandTable.minMagCapacity < 0)
				{
					val2 = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item2.CompatibleMagazines);
				}
				else
				{
					List<FVRObject> list2 = item2.CompatibleMagazines.Where((FVRObject o) => (loadout.leftHandTable.maxMagCapacity < 0 || o.MaxCapacityRelated <= loadout.leftHandTable.maxMagCapacity) && (loadout.leftHandTable.minMagCapacity < 0 || o.MinCapacityRelated >= loadout.leftHandTable.minMagCapacity)).ToList();
					val2 = ((list2.Count <= 0) ? FirearmAPI.GetSmallestMagazine(item2, (Func<FVRObject, bool>)null) : SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)list2));
				}
			}
			else if (item2.CompatibleClips.Count > 0)
			{
				val2 = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item2.CompatibleClips);
			}
			else if (item2.CompatibleSpeedLoaders.Count > 0)
			{
				val2 = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item2.CompatibleSpeedLoaders);
			}
			else if (item2.CompatibleSingleRounds.Count > 0)
			{
				val2 = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item2.CompatibleSingleRounds);
			}
			if ((Object)(object)val2 != (Object)null)
			{
				if (loadout.magInOtherHand && !flag2)
				{
					GivePlayerItemRightHand(val2.ItemID);
					flag2 = true;
				}
				GivePlayerItemQuickbelt(val2.ItemID);
			}
			if (loadout.bespokeInOtherHand && !flag2 && item2.BespokeAttachments.Count > 0)
			{
				GivePlayerItemRightHand(SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item2.BespokeAttachments).ItemID);
				flag2 = true;
			}
		}

		public static void EquipQuickbelt(PlayerLoadout loadout)
		{
			foreach (LoadoutPool quickbeltTable in loadout.quickbeltTables)
			{
				if ((Object)(object)quickbeltTable == (Object)null)
				{
					continue;
				}
				for (int i = 0; i < quickbeltTable.itemsToSpawn; i++)
				{
					FVRObject item = quickbeltTable.GetItem();
					GivePlayerItemQuickbelt(item.ItemID);
					if (item.RequiredSecondaryPieces.Count > 0)
					{
						foreach (FVRObject requiredSecondaryPiece in item.RequiredSecondaryPieces)
						{
							GivePlayerItemQuickbelt(requiredSecondaryPiece.ItemID);
						}
					}
					FVRObject val = null;
					if (item.CompatibleMagazines.Count > 0)
					{
						val = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.CompatibleMagazines);
					}
					else if (item.CompatibleClips.Count > 0)
					{
						val = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.CompatibleClips);
					}
					else if (item.CompatibleSpeedLoaders.Count > 0)
					{
						val = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.CompatibleSpeedLoaders);
					}
					else if (item.CompatibleSingleRounds.Count > 0)
					{
						val = SodaliteUtils.GetRandom<FVRObject>((IList<FVRObject>)item.CompatibleSingleRounds);
					}
					if ((Object)(object)val != (Object)null)
					{
						GivePlayerItemQuickbelt(val.ItemID);
					}
				}
			}
		}

		public static FVRPhysicalObject GivePlayerItemQuickbelt(string itemID)
		{
			//IL_0039: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			if (!IM.OD.ContainsKey(itemID))
			{
				return null;
			}
			Transform head = GM.CurrentPlayerBody.Head;
			GameObject val = Object.Instantiate<GameObject>(((AnvilAsset)IM.OD[itemID]).GetGameObject(), ((Component)head).transform.position + ((Component)head).transform.forward / 2f, ((Component)head).transform.rotation);
			if ((Object)(object)val.gameObject.GetComponent<GrappleGun>() != (Object)null)
			{
				Debug.Log((object)"Grapple spawned!");
			}
			FVRPhysicalObject[] components = val.GetComponents<FVRPhysicalObject>();
			FVRPhysicalObject val2 = ((IEnumerable<FVRPhysicalObject>)components).FirstOrDefault((Func<FVRPhysicalObject, bool>)((FVRPhysicalObject o) => ((Behaviour)o).enabled));
			if (components.Length > 1)
			{
				Debug.Log((object)"hey we have two components!");
			}
			foreach (FVRQuickBeltSlot item in GM.CurrentPlayerBody.QuickbeltSlots.OrderBy((FVRQuickBeltSlot o) => o.SizeLimit))
			{
				if ((Object)(object)item.CurObject == (Object)null && item.Type == val2.QBSlotType && item.SizeLimit >= val2.Size)
				{
					val2.ForceObjectIntoInventorySlot(item);
					break;
				}
			}
			if ((Object)(object)val.gameObject.GetComponent<GrappleGun>() != (Object)null)
			{
				Debug.Log((object)("Is it in a quickbelt? " + ((Object)(object)val2.m_quickbeltSlot != (Object)null)));
			}
			return val2;
		}

		public static FVRPhysicalObject GivePlayerItemLeftHand(string itemID)
		{
			//IL_0061: 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)
			if (!IM.OD.ContainsKey(itemID))
			{
				return null;
			}
			FVRViveHand component = ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>();
			if ((Object)(object)component.CurrentInteractable != (Object)null)
			{
				Debug.LogError((object)"Player was holding stuff!");
				return null;
			}
			FVRPhysicalObject component2 = Object.Instantiate<GameObject>(((AnvilAsset)IM.OD[itemID]).GetGameObject(), ((Component)component).transform.position, ((Component)component).transform.rotation).GetComponent<FVRPhysicalObject>();
			component.RetrieveObject(component2);
			return component2;
		}

		public static FVRPhysicalObject GivePlayerItemRightHand(string itemID)
		{
			//IL_0061: 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)
			if (!IM.OD.ContainsKey(itemID))
			{
				return null;
			}
			FVRViveHand component = ((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>();
			if ((Object)(object)component.CurrentInteractable != (Object)null)
			{
				Debug.LogError((object)"Player was holding stuff!");
				return null;
			}
			FVRPhysicalObject component2 = Object.Instantiate<GameObject>(((AnvilAsset)IM.OD[itemID]).GetGameObject(), ((Component)component).transform.position, ((Component)component).transform.rotation).GetComponent<FVRPhysicalObject>();
			component.RetrieveObject(component2);
			return component2;
		}
	}
	public class SelectableButton : MonoBehaviour
	{
		public Color selectedColor;

		public List<SelectableButton> otherButtons;

		public Text text;

		[HideInInspector]
		public FVRPointableButton fvrButton;

		[HideInInspector]
		public Button button;

		[HideInInspector]
		public Color normalColor;

		private void Awake()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			button = ((Component)this).GetComponent<Button>();
			fvrButton = ((Component)this).GetComponent<FVRPointableButton>();
			normalColor = fvrButton.ColorUnselected;
		}

		public void SetSelected()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			fvrButton.ColorUnselected = selectedColor;
			((Graphic)fvrButton.Image).color = selectedColor;
			foreach (SelectableButton otherButton in otherButtons)
			{
				otherButton.SetUnselected();
			}
		}

		public void SetUnselected()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			fvrButton.ColorUnselected = normalColor;
			((Graphic)fvrButton.Image).color = normalColor;
		}
	}
	public class SpawnArea : MonoBehaviour
	{
		public float spawnRadius = 1f;

		public MeshRenderer areaMesh;

		[HideInInspector]
		public int IFF;

		[HideInInspector]
		public bool isPlayerInSpawn;

		[HideInInspector]
		public Color spawnColor;

		public Vector3 GetPositionInArea()
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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)
			Vector3 result = ((Component)this).transform.position + Random.insideUnitSphere * spawnRadius;
			result.y = ((Component)this).transform.position.y;
			return result;
		}

		public Sosig SpawnSosig(SosigEnemyTemplate template, SpawnOptions spawnOptions)
		{
			//IL_0004: 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)
			return SosigAPI.Spawn(template, spawnOptions, GetPositionInArea(), ((Component)this).transform.rotation);
		}

		public void SetTeam(int team, Color teamColor)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			spawnColor = teamColor;
			IFF = team;
			if (!isPlayerInSpawn || IFF == 0)
			{
				((Renderer)areaMesh).material.SetColor("_ScrollColor", teamColor);
			}
			else
			{
				((Renderer)areaMesh).material.SetColor("_ScrollColor", Color.grey);
			}
		}

		public bool CanSosigSpawn(int team)
		{
			return IFF == team && (!isPlayerInSpawn || IFF == 0);
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (PlayerTracker.currentPlayerState != PlayerState.playing)
			{
				return;
			}
			FVRPlayerHitbox component = ((Component)other).GetComponent<FVRPlayerHitbox>();
			if ((Object)(object)component != (Object)null)
			{
				isPlayerInSpawn = true;
				if (IFF != 0)
				{
					((Renderer)areaMesh).material.SetColor("_ScrollColor", Color.grey);
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			FVRPlayerHitbox component = ((Component)other).GetComponent<FVRPlayerHitbox>();
			if ((Object)(object)component != (Object)null)
			{
				isPlayerInSpawn = false;
				((Renderer)areaMesh).material.SetColor("_ScrollColor", spawnColor);
			}
		}

		private void OnDrawGizmos()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			Handles.color = Color.white;
			Handles.DrawWireDisc(((Component)this).transform.position, ((Component)this).transform.up, spawnRadius);
		}
	}
	public delegate void InteractionEvent();
	public class Supplies : FVRPhysicalObject
	{
		public event InteractionEvent ShowBuildableAreas;

		public event InteractionEvent HideBuildableAreas;

		public override void BeginInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).BeginInteraction(hand);
			this.ShowBuildableAreas();
			((MonoBehaviour)this).CancelInvoke();
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).EndInteraction(hand);
			if (!((Object)(object)hand.OtherHand.CurrentInteractable != (Object)null) || !(hand.OtherHand.CurrentInteractable is Supplies))
			{
				((MonoBehaviour)this).Invoke("DelayedHideBuildableAreas", 2f);
			}
		}

		public void DelayedHideBuildableAreas()
		{
			this.HideBuildableAreas();
		}

		public override void OnDestroy()
		{
			((FVRPhysicalObject)this).OnDestroy();
			FVRViveHand component = ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>();
			FVRViveHand component2 = ((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>();
			if (!(component.CurrentInteractable is Supplies) && !(component2.CurrentInteractable is Supplies))
			{
				this.HideBuildableAreas();
			}
		}
	}
	public class WristMapController : MonoBehaviour
	{
		public float mapRadius = 0.05f;

		public Color mapColor = Color.white;

		public float mapScale = 0.001f;

		public WristMapDisplayMode displayMode = WristMapDisplayMode.RightHand;

		[HideInInspector]
		public List<WristMapTarget> targets = new List<WristMapTarget>();

		private Quaternion mapRotation;

		private Vector3 drawPosition;

		private void Awake()
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			mapRotation = Quaternion.LookRotation(Vector3.up);
		}

		private void Update()
		{
			if (!((Object)(object)GM.CurrentPlayerBody == (Object)null) && displayMode != WristMapDisplayMode.Disabled)
			{
				UpdateDrawPosition();
				DrawWristMap();
			}
		}

		public void IncrementMapState(bool reverse)
		{
			if (reverse)
			{
				displayMode = displayMode.Previous();
			}
			else
			{
				displayMode = displayMode.Next();
			}
		}

		private void UpdateDrawPosition()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (displayMode == WristMapDisplayMode.LeftHand)
			{
				drawPosition = GM.CurrentPlayerBody.LeftHand.position + GM.CurrentPlayerBody.LeftHand.forward * -0.2f;
			}
			else
			{
				drawPosition = GM.CurrentPlayerBody.RightHand.position + GM.CurrentPlayerBody.RightHand.forward * -0.2f;
			}
		}

		private void DrawWristMap()
		{
			//IL_0002: 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)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Gizmos.Circle(drawPosition, mapRadius, mapRotation, (Color?)mapColor, false, 16);
			foreach (WristMapTarget target in targets)
			{
				DrawWristTarget(target);
			}
		}

		private void DrawWristTarget(WristMapTarget target)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (target.transform.position - drawPosition) * mapScale;
			val.y = 0f;
			if (((Vector3)(ref val)).magnitude > mapRadius - mapRadius * target.scale)
			{
				val = ((Vector3)(ref val)).normalized * mapRadius - ((Vector3)(ref val)).normalized * (mapRadius * target.scale);
			}
			Gizmos.Circle(drawPosition + val, mapRadius * target.scale, mapRotation, (Color?)target.color, false, 16);
		}
	}
	public static class Enums
	{
		public static T Next<T>(this T v) where T : struct
		{
			return Enum.GetValues(v.GetType()).Cast<T>().Concat(new T[1] { default(T) })
				.SkipWhile((T e) => !v.Equals(e))
				.Skip(1)
				.First();
		}

		public static T Previous<T>(this T v) where T : struct
		{
			return Enum.GetValues(v.GetType()).Cast<T>().Concat(new T[1] { default(T) })
				.Reverse()
				.SkipWhile((T e) => !v.Equals(e))
				.Skip(1)
				.First();
		}
	}
	public class WristMapTarget
	{
		public Color color;

		public float scale;

		public Transform transform;

		public WristMapTarget(Transform target, Color color, float radius)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			transform = target;
			this.color = color;
			scale = radius;
		}
	}
	public enum WristMapDisplayMode
	{
		RightHand,
		LeftHand,
		Disabled
	}
}
public class Rotate : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
		((Component)this).transform.Rotate(0f, 1f, 0f);
	}
}
namespace NotWolfie.Maxwell
{
	public class GameObjectToggleOnInteract : FVRInteractiveObject
	{
		[Header("GameObjectToggleOnInteract Config")]
		public GameObject ToggleGameObject;

		public GameObject InvertedToggleGameObject;

		public GameObject InvertedToggleGameObject2;

		public GameObject InvertedToggleGameObject3;

		private bool _isToggled = false;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).SimpleInteraction(hand);
			_isToggled = !_isToggled;
			ToggleGameObject.SetActive(_isToggled);
			InvertedToggleGameObject.SetActive(!_isToggled);
			InvertedToggleGameObject2.SetActive(!_isToggled);
			InvertedToggleGameObject3.SetActive(!_isToggled);
		}
	}
}
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoStopLoopedEffect : MonoBehaviour
{
	public float effectDuration = 2.5f;

	private float d;

	private void OnEnable()
	{
		d = effectDuration;
	}

	private void Update()
	{
		if (!(d > 0f))
		{
			return;
		}
		d -= Time.deltaTime;
		if (d <= 0f)
		{
			((Component)this).GetComponent<ParticleSystem>().Stop(true);
			CFX_Demo_Translate component = ((Component)this).gameObject.GetComponent<CFX_Demo_Translate>();
			if ((Object)(object)component != (Object)null)
			{
				((Behaviour)component).enabled = false;
			}
		}
	}
}
public class CFX_Demo_RandomDir : MonoBehaviour
{
	public Vector3 min = new Vector3(0f, 0f, 0f);

	public Vector3 max = new Vector3(0f, 360f, 0f);

	private void Awake()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.eulerAngles = new Vector3(Random.Range(min.x, max.x), Random.Range(min.y, max.y), Random.Range(min.z, max.z));
	}
}
public class CFX_Demo_RotateCamera : MonoBehaviour
{
	public static bool rotating = true;

	public float speed = 30f;

	public Transform rotationCenter;

	private void Update()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		if (rotating)
		{
			((Component)this).transform.RotateAround(rotationCenter.position, Vector3.up, speed * Time.deltaTime);
		}
	}
}
public class CFX_Demo_Translate : MonoBehaviour
{
	public float speed = 30f;

	public Vector3 rotation = Vector3.forward;

	public Vector3 axis = Vector3.forward;

	public bool gravity;

	private Vector3 dir;

	private void Start()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		dir = new Vector3(Random.Range(0f, 360f), Random.Range(0f, 360f), Random.Range(0f, 360f));
		((Vector3)(ref dir)).Scale(rotation);
		((Component)this).transform.localEulerAngles = dir;
	}

	private void Update()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.Translate(axis * speed * Time.deltaTime, (Space)1);
	}
}
public class WFX_Demo : MonoBehaviour
{
	public float cameraSpeed = 10f;

	public bool orderedSpawns = true;

	public float step = 1f;

	public float range = 5f;

	private float order = -5f;

	public GameObject walls;

	public GameObject bulletholes;

	public GameObject[] ParticleExamples;

	private int exampleIndex;

	private string randomSpawnsDelay = "0.5";

	private bool randomSpawns;

	private bool slowMo;

	private bool rotateCam = true;

	public Material wood;

	public Material concrete;

	public Material metal;

	public Material checker;

	public Material woodWall;

	public Material concreteWall;

	public Material metalWall;

	public Material checkerWall;

	private string groundTextureStr = "Checker";

	private List<string> groundTextures = new List<string>(new string[4] { "Concrete", "Wood", "Metal", "Checker" });

	public GameObject m4;

	public GameObject m4fps;

	private bool rotate_m4 = true;

	private void OnMouseDown()
	{
		//IL_0003: 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_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		if (((Component)this).GetComponent<Collider>().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f))
		{
			GameObject val2 = spawnParticle();
			if (!((Object)val2).name.StartsWith("WFX_MF"))
			{
				val2.transform.position = ((RaycastHit)(ref val)).point + val2.transform.position;
			}
		}
	}

	public GameObject spawnParticle()
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(ParticleExamples[exampleIndex]);
		if (((Object)val).name.StartsWith("WFX_MF"))
		{
			val.transform.parent = ParticleExamples[exampleIndex].transform.parent;
			val.transform.localPosition = ParticleExamples[exampleIndex].transform.localPosition;
			val.transform.localRotation = ParticleExamples[exampleIndex].transform.localRotation;
		}
		else if (((Object)val).name.Contains("Hole"))
		{
			val.transform.parent = bulletholes.transform;
		}
		SetActiveCrossVersions(val, active: true);
		return val;
	}

	private void SetActiveCrossVersions(GameObject obj, bool active)
	{
		obj.SetActive(active);
		for (int i = 0; i < obj.transform.childCount; i++)
		{
			((Component)obj.transform.GetChild(i)).gameObject.SetActive(active);
		}
	}

	private void OnGUI()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_033a: 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_03e5: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginArea(new Rect(5f, 20f, (float)(Screen.width - 10), 60f));
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("Effect: " + ((Object)ParticleExamples[exampleIndex]).name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
		if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
		{
			prevParticle();
		}
		if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
		{
			nextParticle();
		}
		GUILayout.FlexibleSpace();
		GUILayout.Label("Click on the ground to spawn the selected effect", (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.FlexibleSpace();
		if (GUILayout.Button((!rotateCam) ? "Rotate Camera" : "Pause Camera", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }))
		{
			rotateCam = !rotateCam;
		}
		if (GUILayout.Button((!((Component)this).GetComponent<Renderer>().enabled) ? "Show Ground" : "Hide Ground", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }))
		{
			((Component)this).GetComponent<Renderer>().enabled = !((Component)this).GetComponent<Renderer>().enabled;
		}
		if (GUILayout.Button((!slowMo) ? "Slow Motion" : "Normal Speed", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
		{
			slowMo = !slowMo;
			if (slowMo)
			{
				Time.timeScale = 0.33f;
			}
			else
			{
				Time.timeScale = 1f;
			}
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("Ground texture: " + groundTextureStr, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
		if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
		{
			prevTexture();
		}
		if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
		{
			nextTexture();
		}
		GUILayout.EndHorizontal();
		GUILayout.EndArea();
		if (!m4.GetComponent<Renderer>().enabled)
		{
			return;
		}
		GUILayout.BeginArea(new Rect(5f, (float)(Screen.height - 100), (float)(Screen.width - 10), 90f));
		rotate_m4 = GUILayout.Toggle(rotate_m4, "AutoRotate Weapon", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) });
		GUI.enabled = !rotate_m4;
		float x = m4.transform.localEulerAngles.x;
		x = ((!(x > 90f)) ? x : (x - 180f));
		float y = m4.transform.localEulerAngles.y;
		float z = m4.transform.localEulerAngles.z;
		x = GUILayout.HorizontalSlider(x, 0f, 179f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
		y = GUILayout.HorizontalSlider(y, 0f, 359f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
		z = GUILayout.HorizontalSlider(z, 0f, 359f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
		if (GUI.changed)
		{
			if (x > 90f)
			{
				x += 180f;
			}
			m4.transform.localEulerAngles = new Vector3(x, y, z);
			Debug.Log((object)x);
		}
		GUILayout.EndArea();
	}

	private IEnumerator RandomSpawnsCoroutine()
	{
		while (true)
		{
			GameObject particles = spawnParticle();
			if (orderedSpawns)
			{
				particles.transform.position = ((Component)this).transform.position + new Vector3(order, particles.transform.position.y, 0f);
				order -= step;
				if (order < 0f - range)
				{
					order = range;
				}
			}
			else
			{
				particles.transform.position = ((Component)this).transform.position + new Vector3(Random.Range(0f - range, range), 0f, Random.Range(0f - range, range)) + new Vector3(0f, particles.transform.position.y, 0f);
			}
			yield return (object)new WaitForSeconds(float.Parse(randomSpawnsDelay));
		}
	}

	private void Update()
	{
		//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_008c: 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)
		if (Input.GetKeyDown((KeyCode)276))
		{
			prevParticle();
		}
		else if (Input.GetKeyDown((KeyCode)275))
		{
			nextParticle();
		}
		if (rotateCam)
		{
			((Component)Camera.main).transform.RotateAround(Vector3.zero, Vector3.up, cameraSpeed * Time.deltaTime);
		}
		if (rotate_m4)
		{
			m4.transform.Rotate(new Vector3(0f, 40f, 0f) * Time.deltaTime, (Space)0);
		}
	}

	private void prevTexture()
	{
		int num = groundTextures.IndexOf(groundTextureStr);
		num--;
		if (num < 0)
		{
			num = groundTextures.Count - 1;
		}
		groundTextureStr = groundTextures[num];
		selectMaterial();
	}

	private void nextTexture()
	{
		int num = groundTextures.IndexOf(groundTextureStr);
		num++;
		if (num >= groundTextures.Count)
		{
			num = 0;
		}
		groundTextureStr = groundTextures[num];
		selectMaterial();
	}

	private void selectMaterial()
	{
		switch (groundTextureStr)
		{
		case "Concrete":
			((Component)this).GetComponent<Renderer>().material = concrete;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = concreteWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = concreteWall;
			break;
		case "Wood":
			((Component)this).GetComponent<Renderer>().material = wood;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = woodWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = woodWall;
			break;
		case "Metal":
			((Component)this).GetComponent<Renderer>().material = metal;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = metalWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = metalWall;
			break;
		case "Checker":
			((Component)this).GetComponent<Renderer>().material = checker;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = checkerWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = checkerWall;
			break;
		}
	}

	private void prevParticle()
	{
		exampleIndex--;
		if (exampleIndex < 0)
		{
			exampleIndex = ParticleExamples.Length - 1;
		}
		showHideStuff();
	}

	private void nextParticle()
	{
		exampleIndex++;
		if (exampleIndex >= ParticleExamples.Length)
		{
			exampleIndex = 0;
		}
		showHideStuff();
	}

	private void showHideStuff()
	{
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF Spr"))
		{
			m4.GetComponent<Renderer>().enabled = true;
		}
		else
		{
			m4.GetComponent<Renderer>().enabled = false;
		}
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF FPS"))
		{
			m4fps.GetComponent<Renderer>().enabled = true;
		}
		else
		{
			m4fps.GetComponent<Renderer>().enabled = false;
		}
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_BImpact"))
		{
			SetActiveCrossVersions(walls, active: true);
			Renderer[] componentsInChildren = bulletholes.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				val.enabled = true;
			}
		}
		else
		{
			SetActiveCrossVersions(walls, active: false);
			Renderer[] componentsInChildren2 = bulletholes.GetComponentsInChildren<Renderer>();
			Renderer[] array2 = componentsInChildren2;
			foreach (Renderer val2 in array2)
			{
				val2.enabled = false;
			}
		}
		if (((Object)ParticleExamples[exampleIndex]).name.Contains("Wood"))
		{
			groundTextureStr = "Wood";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Concrete"))
		{
			groundTextureStr = "Concrete";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Metal"))
		{
			groundTextureStr = "Metal";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Dirt") || ((Object)ParticleExamples[exampleIndex]).name.Contains("Sand") || ((Object)ParticleExamples[exampleIndex]).name.Contains("SoftBody"))
		{
			groundTextureStr = "Checker";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name == "WFX_Explosion")
		{
			groundTextureStr = "Checker";
			selectMaterial();
		}
	}
}
public class WFX_Demo_DeleteAfterDelay : MonoBehaviour
{
	public float delay = 1f;

	private void Update()
	{
		delay -= Time.deltaTime;
		if (delay < 0f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class WFX_Demo_New : MonoBehaviour
{
	public Renderer groundRenderer;

	public Collider groundCollider;

	[Space]
	[Space]
	public Image slowMoBtn;

	public Text slowMoLabel;

	public Image camRotBtn;

	public Text camRotLabel;

	public Image groundBtn;

	public Text groundLabel;

	[Space]
	public Text EffectLabel;

	public Text EffectIndexLabel;

	public GameObject[] AdditionalEffects;

	public GameObject ground;

	public GameObject walls;

	public GameObject bulletholes;

	public GameObject m4;

	public GameObject m4fps;

	public Material wood;

	public Material concrete;

	public Material metal;

	public Material checker;

	public Material woodWall;

	public Material concreteWall;

	public Material metalWall;

	public Material checkerWall;

	private string groundTextureStr = "Checker";

	private List<string> groundTextures = new List<string>(new string[4] { "Concrete", "Wood", "Metal", "Checker" });

	private GameObject[] ParticleExamples;

	private int exampleIndex;

	private bool slowMo;

	private Vector3 defaultCamPosition;

	private Quaternion defaultCamRotation;

	private List<GameObject> onScreenParticles = new List<GameObject>();

	private void Awake()
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		List<GameObject> list = new List<GameObject>();
		int childCount = ((Component)this).transform.childCount;
		for (int i = 0; i < childCount; i++)
		{
			GameObject gameObject = ((Component)((Component)this).transform.GetChild(i)).gameObject;
			list.Add(gameObject);
		}
		list.AddRange(AdditionalEffects);
		ParticleExamples = list.ToArray();
		defaultCamPosition = ((Component)Camera.main).transform.position;
		defaultCamRotation = ((Component)Camera.main).transform.rotation;
		((MonoBehaviour)this).StartCoroutine("CheckForDeletedParticles");
		UpdateUI();
	}

	private void Update()
	{
		//IL_005b: 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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown((KeyCode)276))
		{
			prevParticle();
		}
		else if (Input.GetKeyDown((KeyCode)275))
		{
			nextParticle();
		}
		else if (Input.GetKeyDown((KeyCode)127))
		{
			destroyParticles();
		}
		if (Input.GetMouseButtonDown(0))
		{
			RaycastHit val = default(RaycastHit);
			if (groundCollider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f))
			{
				GameObject val2 = spawnParticle();
				if (!((Object)val2).name.StartsWith("WFX_MF"))
				{
					val2.transform.position = ((RaycastHit)(ref val)).point + val2.transform.position;
				}
			}
		}
		float axis = Input.GetAxis("Mouse ScrollWheel");
		if (axis != 0f)
		{
			((Component)Camera.main).transform.Translate(Vector3.forward * ((!(axis < 0f)) ? 1f : (-1f)), (Space)1);
		}
		if (Input.GetMouseButtonDown(2))
		{
			((Component)Camera.main).transform.position = defaultCamPosition;
			((Component)Camera.main).transform.rotation = defaultCamRotation;
		}
	}

	public void OnToggleGround()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		Color white = Color.white;
		groundRenderer.enabled = !groundRenderer.enabled;
		white.a = ((!groundRenderer.enabled) ? 0.33f : 1f);
		((Graphic)groundBtn).color = white;
		((Graphic)groundLabel).color = white;
	}

	public void OnToggleCamera()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		Color white = Color.white;
		CFX_Demo_RotateCamera.rotating = !CFX_Demo_RotateCamera.rotating;
		white.a = ((!CFX_Demo_RotateCamera.rotating) ? 0.33f : 1f);
		((Graphic)camRotBtn).color = white;
		((Graphic)camRotLabel).color = white;
	}

	public void OnToggleSlowMo()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		Color white = Color.white;
		slowMo = !slowMo;
		if (slowMo)
		{
			Time.timeScale = 0.33f;
			white.a = 1f;
		}
		else
		{
			Time.timeScale = 1f;
			white.a = 0.33f;
		}
		((Graphic)slowMoBtn).color = white;
		((Graphic)slowMoLabel).color = white;
	}

	public void OnPreviousEffect()
	{
		prevParticle();
	}

	public void OnNextEffect()
	{
		nextParticle();
	}

	private void UpdateUI()
	{
		EffectLabel.text = ((Object)ParticleExamples[exampleIndex]).name;
		EffectIndexLabel.text = string.Format("{0}/{1}", (exampleIndex + 1).ToString("00"), ParticleExamples.Length.ToString("00"));
	}

	public GameObject spawnParticle()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: 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_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(ParticleExamples[exampleIndex]);
		val.transform.position = new Vector3(0f, val.transform.position.y, 0f);
		val.SetActive(true);
		if (((Object)val).name.StartsWith("WFX_MF"))
		{
			val.transform.parent = ParticleExamples[exampleIndex].transform.parent;
			val.transform.localPosition = ParticleExamples[exampleIndex].transform.localPosition;
			val.transform.localRotation = ParticleExamples[exampleIndex].transform.localRotation;
		}
		else if (((Object)val).name.Contains("Hole"))
		{
			val.transform.parent = bulletholes.transform;
		}
		ParticleSystem component = val.GetComponent<ParticleSystem>();
		if ((Object)(object)component != (Object)null)
		{
			MainModule main = component.main;
			if (((MainModule)(ref main)).loop)
			{
				((Component)component).gameObject.AddComponent<CFX_AutoStopLoopedEffect>();
				((Component)component).gameObject.AddComponent<CFX_AutoDestructShuriken>();
			}
		}
		onScreenParticles.Add(val);
		return val;
	}

	private IEnumerator CheckForDeletedParticles()
	{
		while (true)
		{
			yield return (object)new WaitForSeconds(5f);
			for (int num = onScreenParticles.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)onScreenParticles[num] == (Object)null)
				{
					onScreenParticles.RemoveAt(num);
				}
			}
		}
	}

	private void prevParticle()
	{
		exampleIndex--;
		if (exampleIndex < 0)
		{
			exampleIndex = ParticleExamples.Length - 1;
		}
		UpdateUI();
		showHideStuff();
	}

	private void nextParticle()
	{
		exampleIndex++;
		if (exampleIndex >= ParticleExamples.Length)
		{
			exampleIndex = 0;
		}
		UpdateUI();
		showHideStuff();
	}

	private void destroyParticles()
	{
		for (int num = onScreenParticles.Count - 1; num >= 0; num--)
		{
			if ((Object)(object)onScreenParticles[num] != (Object)null)
			{
				Object.Destroy((Object)(object)onScreenParticles[num]);
			}
			onScreenParticles.RemoveAt(num);
		}
	}

	private void prevTexture()
	{
		int num = groundTextures.IndexOf(groundTextureStr);
		num--;
		if (num < 0)
		{
			num = groundTextures.Count - 1;
		}
		groundTextureStr = groundTextures[num];
		selectMaterial();
	}

	private void nextTexture()
	{
		int num = groundTextures.IndexOf(groundTextureStr);
		num++;
		if (num >= groundTextures.Count)
		{
			num = 0;
		}
		groundTextureStr = groundTextures[num];
		selectMaterial();
	}

	private void selectMaterial()
	{
		switch (groundTextureStr)
		{
		case "Concrete":
			ground.GetComponent<Renderer>().material = concrete;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = concreteWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = concreteWall;
			break;
		case "Wood":
			ground.GetComponent<Renderer>().material = wood;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = woodWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = woodWall;
			break;
		case "Metal":
			ground.GetComponent<Renderer>().material = metal;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = metalWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = metalWall;
			break;
		case "Checker":
			ground.GetComponent<Renderer>().material = checker;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = checkerWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = checkerWall;
			break;
		}
	}

	private void showHideStuff()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF Spr"))
		{
			m4.GetComponent<Renderer>().enabled = true;
			((Component)Camera.main).transform.position = new Vector3(-2.482457f, 3.263842f, -0.004924395f);
			((Component)Camera.main).transform.eulerAngles = new Vector3(20f, 90f, 0f);
		}
		else
		{
			m4.GetComponent<Renderer>().enabled = false;
		}
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF FPS"))
		{
			m4fps.GetComponent<Renderer>().enabled = true;
		}
		else
		{
			m4fps.GetComponent<Renderer>().enabled = false;
		}
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_BImpact"))
		{
			walls.SetActive(true);
			Renderer[] componentsInChildren = bulletholes.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				val.enabled = true;
			}
		}
		else
		{
			walls.SetActive(false);
			Renderer[] componentsInChildren2 = bulletholes.GetComponentsInChildren<Renderer>();
			Renderer[] array2 = componentsInChildren2;
			foreach (Renderer val2 in array2)
			{
				val2.enabled = false;
			}
		}
		if (((Object)ParticleExamples[exampleIndex]).name.Contains("Wood"))
		{
			groundTextureStr = "Wood";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Concrete"))
		{
			groundTextureStr = "Concrete";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Metal"))
		{
			groundTextureStr = "Metal";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Dirt") || ((Object)ParticleExamples[exampleIndex]).name.Contains("Sand") || ((Object)ParticleExamples[exampleIndex]).name.Contains("SoftBody"))
		{
			groundTextureStr = "Checker";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name == "WFX_Explosion")
		{
			groundTextureStr = "Checker";
			selectMaterial();
		}
	}
}
public class WFX_Demo_RandomDir : MonoBehaviour
{
	public Vector3 min = new Vector3(0f, 0f, 0f);

	public Vector3 max = new Vector3(0f, 360f, 0f);

	private void Awake()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.eulerAngles = new Vector3(Random.Range(min.x, max.x), Random.Range(min.y, max.y), Random.Range(min.z, max.z));
	}
}
public class WFX_Demo_Wall : MonoBehaviour
{
	public WFX_Demo_New demo;

	private void OnMouseDown()
	{
		//IL_0003: 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_0019: 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_0054: 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)
		RaycastHit val = default(RaycastHit);
		if (((Component)this).GetComponent<Collider>().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f))
		{
			GameObject val2 = demo.spawnParticle();
			val2.transform.position = ((RaycastHit)(ref val)).point;
			val2.transform.rotation = Quaternion.FromToRotation(Vector3.forward, ((RaycastHit)(ref val)).normal);
		}
	}
}
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
	public bool OnlyDeactivate;

	private void OnEnable()
	{
		((MonoBehaviour)this).StartCoroutine("CheckIfAlive");
	}

	private IEnumerator CheckIfAlive()
	{
		do
		{
			yield return (object)new WaitForSeconds(0.5f);
		}
		while (((Component)this).GetComponent<ParticleSystem>().IsAlive(true));
		if (OnlyDeactivate)
		{
			((Component)this).gameObject.SetActive(false);
		}
		else
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[RequireComponent(typeof(Light))]
public class CFX_LightIntensityFade : MonoBehaviour
{
	public float duration = 1f;

	public float delay = 0f;

	public float finalIntensity = 0f;

	private float baseIntensity;

	public bool autodestruct;

	private float p_lifetime = 0f;

	private float p_delay;

	private void Start()
	{
		baseIntensity = ((Component)this).GetComponent<Light>().intensity;
	}

	private void OnEnable()
	{
		p_lifetime = 0f;
		p_delay = delay;
		if (delay > 0f)
		{
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = false;
		}
	}

	private void Update()
	{
		if (p_delay > 0f)
		{
			p_delay -= Time.deltaTime;
			if (p_delay <= 0f)
			{
				((Behaviour)((Component)this).GetComponent<Light>()).enabled = true;
			}
		}
		else if (p_lifetime / duration < 1f)
		{
			((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration);
			p_lifetime += Time.deltaTime;
		}
		else if (autodestruct)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[RequireComponent(typeof(MeshFilter))]
public class WFX_BulletHoleDecal : MonoBehaviour
{
	private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4]
	{
		new Vector2(0f, 0f),
		new Vector2(0f, 1f),
		new Vector2(1f, 0f),
		new Vector2(1f, 1f)
	};

	public float lifetime = 10f;

	public float fadeoutpercent = 80f;

	public Vector2 frames;

	public bool randomRotation = false;

	public bool deactivate = false;

	private float life;

	private float fadeout;

	private Color color;

	private float orgAlpha;

	private void Awake()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		color = ((Component)this).GetComponent<Renderer>().material.GetColor("_TintColor");
		orgAlpha = color.a;
	}

	private void OnEnable()
	{
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		int num = Random.Range(0, (int)(frames.x * frames.y));
		int num2 = (int)((float)num % frames.x);
		int num3 = (int)((float)num / frames.y);
		Vector2[] array = (Vector2[])(object)new Vector2[4];
		for (int i = 0; i < 4; i++)
		{
			array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x);
			array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y);
		}
		((Component)this).GetComponent<MeshFilter>().mesh.uv = array;
		if (randomRotation)
		{
			((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1);
		}
		life = lifetime;
		fadeout = life * (fadeoutpercent / 100f);
		color.a = orgAlpha;
		((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
		((MonoBehaviour)this).StopAllCoroutines();
		((MonoBehaviour)this).StartCoroutine("holeUpdate");
	}

	private IEnumerator holeUpdate()
	{
		while (life > 0f)
		{
			life -= Time.deltaTime;
			if (life <= fadeout)
			{
				color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout);
				((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
			}
			yield return null;
		}
	}
}
[RequireComponent(typeof(Light))]
public class WFX_LightFlicker : MonoBehaviour
{
	public float time = 0.05f;

	private float timer;

	private void Start()
	{
		timer = time;
		((MonoBehaviour)this).StartCoroutine("Flicker");
	}

	private IEnumerator Flicker()
	{
		while (true)
		{
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = !((Behaviour)((Component)this).GetComponent<Light>()).enabled;
			do
			{
				timer -= Time.deltaTime;
				yield return null;
			}
			while (timer > 0f);
			timer = time;
		}
	}
}
public class CFX_SpawnSystem : MonoBehaviour
{
	private static CFX_SpawnSystem instance;

	public GameObject[] objectsToPreload = (GameObject[])(object)new GameObject[0];

	public int[] objectsToPreloadTimes = new int[0];

	public bool hideObjectsInHierarchy = false;

	public bool spawnAsChildren = true;

	public bool onlyGetInactiveObjects = false;

	public bool instantiateIfNeeded = false;

	private bool allObjectsLoaded;

	private Dictionary<int, List<GameObject>> instantiatedObjects = new Dictionary<int, List<GameObject>>();

	private Dictionary<int, int> poolCursors = new Dictionary<int, int>();

	public static bool AllObjectsLoaded => instance.allObjectsLoaded;

	public static GameObject GetNextObject(GameObject sourceObj, bool activateObject = true)
	{
		int instanceID = ((Object)sourceObj).GetInstanceID();
		if (!instance.poolCursors.ContainsKey(instanceID))
		{
			Debug.LogError((object)("[CFX_SpawnSystem.GetNextObject()] Object hasn't been preloaded: " + ((Object)sourceObj).name + " (ID:" + instanceID + ")\n"), (Object)(object)instance);
			return null;
		}
		int num = instance.poolCursors[instanceID];
		GameObject val = null;
		if (instance.onlyGetInactiveObjects)
		{
			int num2 = num;
			while (true)
			{
				val = instance.instantiatedObjects[instanceID][num];
				instance.increasePoolCursor(instanceID);
				num = instance.poolCursors[instanceID];
				if ((Object)(object)val != (Object)null && !val.activeSelf)
				{
					break;
				}
				if (num == num2)
				{
					if (instance.instantiateIfNeeded)
					{
						Debug.Log((object)("[CFX_SpawnSystem.GetNextObject()] A new instance has been created for \"" + ((Object)sourceObj).name + "\" because no active instance were found in the pool.\n"), (Object)(object)instance);
						PreloadObject(sourceObj);
						List<GameObject> list = instance.instantiatedObjects[instanceID];
						val = list[list.Count - 1];
						break;
					}
					Debug.LogWarning((object)("[CFX_SpawnSystem.GetNextObject()] There are no active instances available in the pool for \"" + ((Object)sourceObj).name + "\"\nYou may need to increase the preloaded object count for this prefab?"), (Object)(object)instance);
					return null;
				}
			}
		}
		else
		{
			val = instance.instantiatedObjects[instanceID][num];
			instance.increasePoolCursor(instanceID);
		}
		if (activateObject && (Object)(object)val != (Object)null)
		{
			val.SetActive(true);
		}
		return val;
	}

	public static void PreloadObject(GameObject sourceObj, int poolSize = 1)
	{
		instance.addObjectToPool(sourceObj, poolSize);
	}

	public static void UnloadObjects(GameObject sourceObj)
	{
		instance.removeObjectsFromPool(sourceObj);
	}

	private void addObjectToPool(GameObject sourceObject, int number)
	{
		int instanceID = ((Object)sourceObject).GetInstanceID();
		if (!instantiatedObjects.ContainsKey(instanceID))
		{
			instantiatedObjects.Add(instanceID, new List<GameObject>());
			poolCursors.Add(instanceID, 0);
		}
		for (int i = 0; i < number; i++)
		{
			GameObject val = Object.Instantiate<GameObject>(sourceObject);
			val.SetActive(false);
			CFX_AutoDestructShuriken[] componentsInChildren = val.GetComponentsInChildren<CFX_AutoDestructShuriken>(true);
			CFX_AutoDestructShuriken[] array = componentsInChildren;
			foreach (CFX_AutoDestructShuriken cFX_AutoDestructShuriken in array)
			{
				cFX_AutoDestructShuriken.OnlyDeactivate = true;
			}
			CFX_LightIntensityFade[] componentsInChildren2 = val.GetComponentsInChildren<CFX_LightIntensityFade>(true);
			CFX_LightIntensityFade[] array2 = componentsInChildren2;
			foreach (CFX_LightIntensityFade cFX_LightIntensityFade in array2)
			{
				cFX_LightIntensityFade.autodestruct = false;
			}
			instantiatedObjects[instanceID].Add(val);
			if (hideObjectsInHierarchy)
			{
				((Object)val).hideFlags = (HideFlags)1;
			}
			if (spawnAsChildren)
			{
				val.transform.parent = ((Component)this).transform;
			}
		}
	}

	private void removeObjectsFromPool(GameObject sourceObject)
	{
		int instanceID = ((Object)sourceObject).GetInstanceID();
		if (!instantiatedObjects.ContainsKey(instanceID))
		{
			Debug.LogWarning((object)("[CFX_SpawnSystem.removeObjectsFromPool()] There aren't any preloaded object for: " + ((Object)sourceObject).name + " (ID:" + instanceID + ")\n"), (Object)(object)((Component)this).gameObject);
			return;
		}
		for (int num = instantiatedObjects[instanceID].Count - 1; num >= 0; num--)
		{
			GameObject val = instantiatedObjects[instanceID][num];
			instantiatedObjects[instanceID].RemoveAt(num);
			Object.Destroy((Object)(object)val);
		}
		instantiatedObjects.Remove(instanceID);
		poolCursors.Remove(instanceID);
	}

	private void increasePoolCursor(int uniqueId)
	{
		instance.poolCursors[uniqueId]++;
		if (instance.poolCursors[uniqueId] >= instance.instantiatedObjects[uniqueId].Count)
		{
			instance.poolCursors[uniqueId] = 0;
		}
	}

	private void Awake()
	{
		if ((Object)(object)instance != (Object)null)
		{
			Debug.LogWarning((object)"CFX_SpawnSystem: There should only be one instance of CFX_SpawnSystem per Scene!\n", (Object)(object)((Component)this).gameObject);
		}
		instance = this;
	}

	private void Start()
	{
		allObjectsLoaded = false;
		for (int i = 0; i < objectsToPreload.Length; i++)
		{
			PreloadObject(objectsToPreload[i], objectsToPreloadTimes[i]);
		}
		allObjectsLoaded = true;
	}
}
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace Billiam_J_McGoonigan.L42A1
{
	[BepInPlugin("Billiam_J_McGoonigan.L42A1", "L42A1", "1.0.2")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class L42A1Plugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Billiam_J_McGoonigan.L42A1");
			OtherLoader.RegisterDirectLoad(BasePath, "Billiam_J_McGoonigan.L42A1", "", "", "l42a1", "");
		}
	}
}
namespace ProBuilder2.Examples
{
	public class CameraControls : MonoBehaviour
	{
		private const string INPUT_MOUSE_SCROLLWHEEL = "Mouse ScrollWheel";

		private const string INPUT_MOUSE_X = "Mouse X";

		private const string INPUT_MOUSE_Y = "Mouse Y";

		private const float MIN_CAM_DISTANCE = 10f;

		private const float MAX_CAM_DISTANCE = 40f;

		[Range(2f, 15f)]
		public float orbitSpeed = 6f;

		[Range(0.3f, 2f)]
		public float zoomSpeed = 0.8f;

		private float distance = 0f;

		public float idleRotation = 1f;

		private Vector2 dir = new Vector2(0.8f, 0.2f);

		private void Start()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			distance = Vector3.Distance(((Component)this).transform.position, Vector3.zero);
		}

		private void LateUpdate()
		{
			//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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			Quaternion localRotation = ((Component)this).transform.localRotation;
			Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles;
			eulerAngles.z = 0f;
			if (Input.GetMouseButton(0))
			{
				float axis = Input.GetAxis("Mouse X");
				float num = 0f - Input.GetAxis("Mouse Y");
				eulerAngles.x += num * orbitSpeed;
				eulerAngles.y += axis * orbitSpeed;
				dir.x = axis;
				dir.y = num;
				((Vector2)(ref dir)).Normalize();
			}
			else
			{
				eulerAngles.y += Time.deltaTime * idleRotation * dir.x;
				eulerAngles.x += Time.deltaTime * Mathf.PerlinNoise(Time.time, 0f) * idleRotation * dir.y;
			}
			((Component)this).transform.localRotation = Quaternion.Euler(eulerAngles);
			((Component)this).transform.position = ((Component)this).transform.localRotation * (Vector3.forward * (0f - distance));
			if (Input.GetAxis("Mouse ScrollWheel") != 0f)
			{
				float axis2 = Input.GetAxis("Mouse ScrollWheel");
				distance -= axis2 * (distance / 40f) * (zoomSpeed * 1000f) * Time.deltaTime;
				distance = Mathf.Clamp(distance, 10f, 40f);
				((Component)this).transform.position = ((Component)this).transform.localRotation * (Vector3.forward * (0f - distance));
			}
		}
	}
	[RequireComponent(typeof(AudioSource))]
	public class IcoBumpin : MonoBehaviour
	{
		private struct FaceRef
		{
			public pb_Face face;

			public Vector3 nrm;

			public int[] indices;

			public FaceRef(pb_Face f, Vector3 n, int[] i)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				face = f;
				nrm = n;
				indices = i;
			}
		}

		private pb_Object ico;

		private Mesh icoMesh;

		private Transform icoTransform;

		private AudioSource audioSource;

		private FaceRef[] outsides;

		private Vector3[] original_vertices;

		private Vector3[] displaced_vertices;

		[Range(1f, 10f)]
		public float icoRadius = 2f;

		[Range(0f, 3f)]
		public int icoSubdivisions = 2;

		[Range(0f, 1f)]
		public float startingExtrusion = 0.1f;

		public Material material;

		[Range(1f, 50f)]
		public float extrusion = 30f;

		[Range(8f, 128f)]
		public int fftBounds = 32;

		[Range(0f, 10f)]
		public float verticalBounce = 4f;

		public AnimationCurve frequencyCurve;

		public LineRenderer waveform;

		public float waveformHeight = 2f;

		public float waveformRadius = 20f;

		public float waveformSpeed = 0.1f;

		public bool rotateWaveformRing = false;

		public bool bounceWaveform = false;

		public GameObject missingClipWarning;

		private Vector3 icoPosition = Vector3.zero;

		private float faces_length;

		private const float TWOPI = 6.283185f;

		private const int WAVEFORM_SAMPLES = 1024;

		private const int FFT_SAMPLES = 4096;

		private float[] fft = new float[4096];

		private float[] fft_history = new float[4096];

		private float[] data = new float[1024];

		private float[] data_history = new float[1024];

		private float rms = 0f;

		private float rms_history = 0f;

		private void Start()
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			audioSource = ((Component)this).GetComponent<AudioSource>();
			if ((Object)(object)audioSource.clip == (Object)null)
			{
				missingClipWarning.SetActive(true);
			}
			ico = pb_ShapeGenerator.IcosahedronGenerator(icoRadius, icoSubdivisions);
			pb_Face[] faces = ico.faces;
			pb_Face[] array = faces;
			foreach (pb_Face val in array)
			{
				val.material = material;
			}
			pb_Extrude.Extrude(ico, faces, (ExtrudeMethod)0, startingExtrusion);
			ico.ToMesh();
			ico.Refresh((RefreshMask)255);
			outsides = new FaceRef[faces.Length];
			Dictionary<int, int> dictionary = pb_IntArrayUtility.ToDictionary(ico.sharedIndices);
			for (int j = 0; j < faces.Length; j++)
			{
				ref FaceRef reference = ref outsides[j];
				reference = new FaceRef(faces[j], pb_Math.Normal(ico, faces[j]), pb_IntArrayUtility.AllIndicesWithValues(ico.sharedIndices, dictionary, (IList<int>)faces[j].distinctIndices).ToArray());
			}
			original_vertices = (Vector3[])(object)new Vector3[ico.vertices.Length];
			Array.Copy(ico.vertices, original_vertices, ico.vertices.Length);
			displaced_vertices = ico.vertices;
			icoMesh = ico.msh;
			icoTransform = ((Component)ico).transform;
			faces_length = outsides.Length;
			icoPosition = icoTransform.position;
			waveform.positionCount = 1024;
			if (bounceWaveform)
			{
				((Component)waveform).transform.parent = icoTransform;
			}
			audioSource.Play();
		}

		private void Update()
		{
			//IL_0061: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			audioSource.GetSpectrumData(fft, 0, (FFTWindow)5);
			audioSource.GetOutputData(data, 0);
			rms = RMS(data);
			for (int i = 0; i < outsides.Length; i++)
			{
				float num = (float)i / faces_length;
				int num2 = (int)(num * (float)fftBounds);
				Vector3 val = outsides[i].nrm * ((fft[num2] + fft_history[num2]) * 0.5f * (frequencyCurve.Evaluate(num) * 0.5f + 0.5f)) * extrusion;
				int[] indices = outsides[i].indices;
				foreach (int num3 in indices)
				{
					ref Vector3 reference = ref displaced_vertices[num3];
					reference = original_vertices[num3] + val;
				}
			}
			Vector3 zero = Vector3.zero;
			for (int k = 0; k < 1024; k++)
			{
				int num4 = ((k < 1023) ? k : 0);
				zero.x = Mathf.Cos((float)num4 / 1024f * 6.283185f) * (waveformRadius + (data[num4] + data_history[num4]) * 0.5f * waveformHeight);
				zero.z = Mathf.Sin((float)num4 / 1024f * 6.283185f) * (waveformRadius + (data[num4] + data_history[num4]) * 0.5f * waveformHeight);
				zero.y = 0f;
				waveform.SetPosition(k, zero);
			}
			if (rotateWaveformRing)
			{
				Quaternion localRotation = ((Component)waveform).transform.localRotation;
				Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles;
				eulerAngles.x = Mathf.PerlinNoise(Time.time * waveformSpeed, 0f) * 360f;
				eulerAngles.y = Mathf.PerlinNoise(0f, Time.time * waveformSpeed) * 360f;
				((Component)waveform).transform.localRotation = Quaternion.Euler(eulerAngles);
			}
			icoPosition.y = 0f - verticalBounce + (rms + rms_history) * verticalBounce;
			icoTransform.position = icoPosition;
			Array.Copy(fft, fft_history, 4096);
			Array.Copy(data, data_history, 1024);
			rms_history = rms;
			icoMesh.vertices = displaced_vertices;
		}

		private float RMS(float[] arr)
		{
			float num = 0f;
			float num2 = arr.Length;
			for (int i = 0; (float)i < num2; i++)
			{
				num += Mathf.Abs(arr[i]);
			}
			return Mathf.Sqrt(num / num2);
		}
	}
	public class HueCube : MonoBehaviour
	{
		private pb_Object pb;

		private void Start()
		{
			//IL_0002: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			pb = pb_ShapeGenerator.CubeGenerator(Vector3.one);
			int num = pb.sharedIndices.Length;
			Color[] array = (Color[])(object)new Color[num];
			for (int i = 0; i < num; i++)
			{
				ref Color reference = ref array[i];
				reference = HSVtoRGB((float)i / (float)num * 360f, 1f, 1f);
			}
			Color[] colors = pb.colors;
			for (int j = 0; j < pb.sharedIndices.Length; j++)
			{
				int[] array2 = pb.sharedIndices[j].array;
				foreach (int num2 in array2)
				{
					ref Color reference2 = ref colors[num2];
					reference2 = array[j];
				}
			}
			pb.SetColors(colors);
			pb.Refresh((RefreshMask)255);
		}

		private static Color HSVtoRGB(float h, float s, float v)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			if (s == 0f)
			{
				return new Color(v, v, v, 1f);
			}
			h /= 60f;
			int num = (int)Mathf.Floor(h);
			float num2 = h - (float)num;
			float num3 = v * (1f - s);
			float num4 = v * (1f - s * num2);
			float num5 = v * (1f - s * (1f - num2));
			float num6;
			float num7;
			float num8;
			switch (num)
			{
			case 0:
				num6 = v;
				num7 = num5;
				num8 = num3;
				break;
			case 1:
				num6 = num4;
				num7 = v;
				num8 = num3;
				break;
			case 2:
				num6 = num3;
				num7 = v;
				num8 = num5;
				break;
			case 3:
				num6 = num3;
				num7 = num4;
				num8 = v;
				break;
			case 4:
				num6 = num5;
				num7 = num3;
				num8 = v;
				break;
			default:
				num6 = v;
				num7 = num3;
				num8 = num4;
				break;
			}
			return new Color(num6, num7, num8, 1f);
		}
	}
}
public class ExtrudeRandomEdges : MonoBehaviour
{
	private pb_Object pb;

	private pb_Face lastExtrudedFace = null;

	public float distance = 1f;

	private void Start()
	{
		pb = pb_ShapeGenerator.PlaneGenerator(1f, 1f, 0, 0, (Axis)2, false);
		pb.SetFaceMaterial(pb.faces, pb_Constant.DefaultMaterial);
		lastExtrudedFace = pb.faces[0];
	}

	private void OnGUI()
	{
		if (GUILayout.Button("Extrude Random Edge", (GUILayoutOption[])(object)new GUILayoutOption[0]))
		{
			ExtrudeEdge();
		}
	}

	private void ExtrudeEdge()
	{
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: 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)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		pb_Face sourceFace = lastExtrudedFace;
		List<pb_WingedEdge> wingedEdges = pb_WingedEdge.GetWingedEdges(pb, false);
		IEnumerable<pb_WingedEdge> source = wingedEdges.Where((pb_WingedEdge x) => x.face == sourceFace);
		List<pb_Edge> list = (from x in source
			where x.opposite == null
			select x into y
			select y.edge.local).ToList();
		int index = Random.Range(0, list.Count);
		pb_Edge val = list[index];
		Vector3 val2 = (pb.vertices[val.x] + pb.vertices[val.y]) * 0.5f - pb_Math.Average<int>((IList<int>)sourceFace.distinctIndices, (Func<int, Vector3>)((int x) => pb.vertices[x]), (IList<int>)null);
		((Vector3)(ref val2)).Normalize();
		pb_Edge[] selectedEdges = default(pb_Edge[]);
		pbMeshOps.Extrude(pb, (pb_Edge[])(object)new pb_Edge[1] { val }, 0f, false, true, ref selectedEdges);
		lastExtrudedFace = pb.faces.Last();
		pb.SetSelectedEdges((IEnumerable<pb_Edge>)selectedEdges);
		pb_Object_Utility.TranslateVertices(pb, pb.SelectedTriangles, val2 * distance);
		pb.ToMesh();
		pb.Refresh((RefreshMask)255);
	}
}
namespace ProBuilder2.Examples
{
	public class RuntimeEdit : MonoBehaviour
	{
		private class pb_Selection
		{
			public pb_Object pb;

			public pb_Face face;

			public pb_Selection(pb_Object _pb, pb_Face _face)
			{
				pb = _pb;
				face = _face;
			}

			public bool HasObject()
			{
				return (Object)(object)pb != (Object)null;
			}

			public bool IsValid()
			{
				return (Object)(object)pb != (Object)null && face != null;
			}

			public bool Equals(pb_Selection sel)
			{
				if (sel != null && sel.IsValid())
				{
					return (Object)(object)pb == (Object)(object)sel.pb && face == sel.face;
				}
				return false;
			}

			public void Destroy()
			{
				if ((Object)(object)pb != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)pb).gameObject);
				}
			}

			public override string ToString()
			{
				return ("pb_Object: " + pb != null) ? (((Object)pb).name + "\npb_Face: " + ((face != null) ? ((object)face).ToString() : "Null")) : "Null";
			}
		}

		private pb_Selection currentSelection;

		private pb_Selection previousSelection;

		private pb_Object preview;

		public Material previewMaterial;

		private Vector2 mousePosition_initial = Vector2.zero;

		private bool dragging = false;

		public float rotateSpeed = 100f;

		private void Awake()
		{
			SpawnCube();
		}

		private void OnGUI()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (GUI.Button(new Rect(5f, (float)(Screen.height - 25), 80f, 20f), "Reset"))
			{
				currentSelection.Destroy();
				Object.Destroy((Object)(object)((Component)preview).gameObject);
				SpawnCube();
			}
		}

		private void SpawnCube()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			pb_Object val = pb_ShapeGenerator.CubeGenerator(Vector3.one);
			((Component)val).gameObject.AddComponent<MeshCollider>().convex = false;
			currentSelection = new pb_Selection(val, null);
		}

		public void LateUpdate()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			if (!currentSelection.HasObject())
			{
				return;
			}
			if (Input.GetMouseButtonDown(1) || (Input.GetMouseButtonDown(0) && Input.GetKey((KeyCode)308)))
			{
				mousePosition_initial = Vector2.op_Implicit(Input.mousePosition);
				dragging = true;
			}
			if (dragging)
			{
				Vector2 val = Vector2.op_Implicit(Vector2.op_Implicit(mousePosition_initial) - Input.mousePosition);
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(val.y, val.x, 0f);
				((Component)currentSelection.pb).gameObject.transform.RotateAround(Vector3.zero, val2, rotateSpeed * Time.deltaTime);
				if (currentSelection.IsValid())
				{
					Ref