Decompiled source of UFoxLib v1.3.0

Terren-UFoxLib.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using TFBGames;
using TMPro;
using UFoxLib.Classes;
using UFoxLib.Localization;
using UFoxLib.SecretManagement;
using UnityEditor;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Terren")]
[assembly: AssemblyTitle("Collection of Terren mod's classes")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace UFoxLib.Classes
{
	public class BlendShapeStateAnimator : MonoBehaviour
	{
		public SkinnedMeshRenderer mesh;

		public int shapeID;

		public AnimationCurve curveIn;

		public AnimationCurve curveOut;

		public float multiiplier = 1f;

		private bool animatingIn;

		private bool animatingOut;

		private float counter;

		private void Update()
		{
			if (animatingIn && !animatingOut)
			{
				counter += Time.deltaTime;
				mesh.SetBlendShapeWeight(shapeID, curveIn.Evaluate(counter * multiiplier));
			}
			if (animatingOut && !animatingIn)
			{
				counter += Time.deltaTime;
				mesh.SetBlendShapeWeight(shapeID, curveOut.Evaluate(counter * multiiplier));
			}
		}

		public void ResetCounter()
		{
			if (counter > 0f)
			{
				counter = 0f;
			}
		}

		public void SetAnimateIn(int index)
		{
			if (!animatingIn)
			{
				ResetCounter();
				shapeID = index;
				animatingIn = true;
				if (animatingOut)
				{
					animatingOut = false;
				}
			}
		}

		public void SetAnimateOut(int index)
		{
			if (!animatingIn)
			{
				ResetCounter();
				shapeID = index;
				animatingOut = true;
				if (animatingIn)
				{
					animatingIn = false;
				}
			}
		}
	}
	public class DissarmByCombatMove : MonoBehaviour
	{
		private Unit unit;

		private WeaponHandler weaponHandler;

		private HoldingHandler hold;

		private void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			hold = unit.holdingHandler;
			weaponHandler = unit.WeaponHandler;
		}

		public void DropAll()
		{
			if (Object.op_Implicit((Object)(object)hold))
			{
				hold.LetGoOfAll();
			}
		}

		public void DropRightWeapon()
		{
			if (Object.op_Implicit((Object)(object)hold) && Object.op_Implicit((Object)(object)weaponHandler) && Object.op_Implicit((Object)(object)unit.WeaponHandler.rightWeapon))
			{
				hold.LetGoOfWeapon(((Component)unit.WeaponHandler.rightWeapon).gameObject);
			}
		}

		public void DropLeftWeapon()
		{
			if (Object.op_Implicit((Object)(object)hold) && Object.op_Implicit((Object)(object)weaponHandler) && Object.op_Implicit((Object)(object)unit.WeaponHandler.leftWeapon))
			{
				hold.LetGoOfWeapon(((Component)unit.WeaponHandler.leftWeapon).gameObject);
			}
		}
	}
	public class EventByChance : MonoBehaviour
	{
		public enum ChanceType
		{
			byFloat,
			byInt
		}

		public ChanceType chanceType;

		[Tooltip("If random number is greater/equal than this > Event happen")]
		public float numberToHit;

		public bool onStart;

		public float maxChance;

		public float delay;

		public UnityEvent chanceEvent;

		private float chanceDigit;

		private void DecideChance(ChanceType type)
		{
			if (type == ChanceType.byInt)
			{
				int num = (int)maxChance;
				int num2 = (int)numberToHit;
				chanceDigit = Random.Range(0f, (float)num);
				if (chanceDigit >= (float)num2)
				{
					ChanceTrigger();
				}
			}
			if (type == ChanceType.byFloat)
			{
				chanceDigit = Random.Range(0f, maxChance);
				if (chanceDigit >= numberToHit)
				{
					ChanceTrigger();
				}
			}
		}

		private void ChanceTrigger()
		{
			chanceEvent.Invoke();
		}

		public void Go()
		{
			DecideChance(chanceType);
		}

		private void Start()
		{
			if (onStart)
			{
				Go();
			}
		}
	}
	public class EventOnHoldable : MonoBehaviour
	{
		private Holdable holdable;

		private HoldingHandler holdingHandler;

		private GameObject thisWeapon;

		public UnityEvent eventLeftHand;

		public UnityEvent eventRightHand;

		private void Start()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			holdable = ((Component)this).GetComponentInParent<Holdable>();
			holdingHandler = holdable.holdingHandler;
			thisWeapon = ((Component)((Component)((Component)this).transform).GetComponentInParent<Weapon>()).gameObject;
			if (((int)holdingHandler.leftHandActivity == 2 || (int)holdingHandler.leftHandActivity == 0) && ((int)holdingHandler.rightHandActivity == 1 || (int)holdingHandler.leftHandActivity == 0))
			{
				if (Object.op_Implicit((Object)(object)holdingHandler.leftObject) && (Object)(object)thisWeapon == (Object)(object)((Component)holdingHandler.leftObject).gameObject)
				{
					eventLeftHand.Invoke();
				}
				if (Object.op_Implicit((Object)(object)holdingHandler.rightObject) && (Object)(object)thisWeapon == (Object)(object)((Component)holdingHandler.rightObject).gameObject)
				{
					eventRightHand.Invoke();
				}
			}
		}
	}
	public class ExplosionUpwardsEdition : MonoBehaviour
	{
		[HideInInspector]
		public List<Rigidbody> protectedRigs = new List<Rigidbody>();

		public Color editorGizmosColor;

		public LayerMask layerMask;

		public float damage = 60f;

		public float percentDamage;

		public float radius = 4f;

		public float force;

		public float minMassCap = 25f;

		public float stopAttacksFor;

		public bool automatic;

		public bool deltaTime;

		public bool randomForce;

		public bool ignoreTeamMates;

		public bool onlyTeamMates;

		public bool ignoreRoot = true;

		public bool onlyRoot;

		public bool forceOnlyOncePerRig;

		public UnityEvent hitEvent;

		private ExplosionEffect[] effects;

		private ObjectException[] exceptions;

		private TeamHolder teamHolder;

		private bool eventsInvoked;

		private Team team;

		private bool inited;

		private Unit ownUnit;

		public bool addEffectFromParent;

		private AddExplosionEffectToChild explosionEffectToAdd;

		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)
			Gizmos.color = editorGizmosColor;
			Gizmos.DrawWireSphere(((Component)this).transform.position, radius);
		}

		public void Start()
		{
			if (inited)
			{
				return;
			}
			Level componentInParent = ((Component)this).GetComponentInParent<Level>();
			if (Object.op_Implicit((Object)(object)componentInParent))
			{
				damage *= componentInParent.levelMultiplier;
				force *= componentInParent.levelMultiplier;
				minMassCap *= componentInParent.levelMultiplier;
				if (componentInParent.ignoreTeam)
				{
					ignoreTeamMates = true;
				}
			}
			inited = true;
			exceptions = ((Component)this).GetComponents<ObjectException>();
			effects = ((Component)this).GetComponents<ExplosionEffect>();
			teamHolder = ((Component)this).GetComponentInParent<TeamHolder>();
			if (addEffectFromParent)
			{
				explosionEffectToAdd = ((Component)this).GetComponentInParent<AddExplosionEffectToChild>();
			}
			if (randomForce)
			{
				force *= Random.Range(0.8f, 1.2f);
			}
			if (automatic)
			{
				Explode();
			}
		}

		public void AddProtectedRig(Rigidbody rigToProtect)
		{
			protectedRigs.Add(rigToProtect);
		}

		public void Explode()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			Start();
			float num = (deltaTime ? (Time.deltaTime * 100f) : 1f);
			if (Object.op_Implicit((Object)(object)teamHolder))
			{
				team = teamHolder.team;
			}
			else
			{
				Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
				if (Object.op_Implicit((Object)(object)component))
				{
					team = component.Team;
				}
			}
			List<Rigidbody> list = new List<Rigidbody>();
			List<Damagable> list2 = new List<Damagable>();
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, radius, LayerMask.op_Implicit(layerMask));
			for (int i = 0; i < array.Length; i++)
			{
				Rigidbody attachedRigidbody = array[i].attachedRigidbody;
				if (!((Object)(object)attachedRigidbody != (Object)null) || ((Object)(object)((Component)attachedRigidbody).transform.root == (Object)(object)((Component)this).transform.root && ignoreRoot) || ((Object)(object)((Component)attachedRigidbody).transform.root != (Object)(object)((Component)this).transform.root && onlyRoot))
				{
					continue;
				}
				if (forceOnlyOncePerRig)
				{
					if (list.Contains(attachedRigidbody))
					{
						continue;
					}
					list.Add(attachedRigidbody);
				}
				bool flag = true;
				if (exceptions != null)
				{
					for (int j = 0; j < exceptions.Length; j++)
					{
						flag = exceptions[j].TestException(((Component)attachedRigidbody).gameObject);
					}
				}
				if (!flag || protectedRigs.Contains(attachedRigidbody))
				{
					continue;
				}
				if (ignoreTeamMates || onlyTeamMates)
				{
					Unit component2 = ((Component)((Component)attachedRigidbody).transform.root).GetComponent<Unit>();
					if (Object.op_Implicit((Object)(object)component2) && ((ignoreTeamMates && component2.Team == team) || (onlyTeamMates && component2.Team != team)))
					{
						continue;
					}
				}
				DataHandler componentInChildren = ((Component)((Component)attachedRigidbody).transform.root).GetComponentInChildren<DataHandler>();
				if (Object.op_Implicit((Object)(object)componentInChildren) && !componentInChildren.Dead && !eventsInvoked)
				{
					hitEvent.Invoke();
					eventsInvoked = true;
				}
				if (addEffectFromParent)
				{
					if ((Object)(object)explosionEffectToAdd != (Object)null)
					{
						explosionEffectToAdd.DoExplosionEffect(((Component)attachedRigidbody).gameObject);
					}
				}
				else if (!addEffectFromParent && effects != null)
				{
					for (int k = 0; k < effects.Length; k++)
					{
						effects[k].DoEffect(((Component)attachedRigidbody).gameObject);
					}
				}
				float num2 = Mathf.Clamp(attachedRigidbody.drag / 3f, 0.1f, 1f);
				WilhelmPhysicsFunctions.AddForceWithMinWeight(attachedRigidbody, num * force * num2 * ((Component)this).transform.up, (ForceMode)1, minMassCap);
				attachedRigidbody.velocity *= 0.9f;
				Damagable componentInParent = ((Component)attachedRigidbody).GetComponentInParent<Damagable>();
				if (Object.op_Implicit((Object)(object)componentInParent))
				{
					if (!((Component)componentInParent).GetComponent<DataHandler>().Dead && !list2.Contains(componentInParent))
					{
						list2.Add(componentInParent);
					}
					if (!Object.op_Implicit((Object)(object)ownUnit) && Object.op_Implicit((Object)(object)teamHolder) && Object.op_Implicit((Object)(object)teamHolder.spawner))
					{
						ownUnit = teamHolder.spawner.GetComponentInParent<Unit>();
					}
					if (!Object.op_Implicit((Object)(object)ownUnit))
					{
						ownUnit = ((Component)this).GetComponentInParent<Unit>();
					}
					componentInParent.TakeDamage(num * damage * Mathf.Clamp(1f - Vector3.Distance(((Component)this).transform.position, array[i].ClosestPoint(((Component)this).transform.position)) / radius, 0f, 1f), ((Component)array[i]).transform.position - ((Component)this).transform.position, ownUnit, (DamageType)0);
					if (percentDamage > 0f)
					{
						componentInParent.TakeDamage(num * (componentInChildren.maxHealth * percentDamage) * Mathf.Clamp(1f - Vector3.Distance(((Component)this).transform.position, array[i].ClosestPoint(((Component)this).transform.position)) / radius, 0f, 1f), ((Component)array[i]).transform.position - ((Component)this).transform.position, ownUnit, (DamageType)0);
					}
				}
				if (!(stopAttacksFor > 0f))
				{
					continue;
				}
				WeaponHandler componentInChildren2 = ((Component)((Component)attachedRigidbody).transform.root).GetComponentInChildren<WeaponHandler>();
				if (Object.op_Implicit((Object)(object)componentInChildren2))
				{
					componentInChildren2.StopAttacksFor(stopAttacksFor);
					continue;
				}
				MultipleWeaponHandler componentInChildren3 = ((Component)((Component)attachedRigidbody).transform.root).GetComponentInChildren<MultipleWeaponHandler>();
				if (Object.op_Implicit((Object)(object)componentInChildren3))
				{
					componentInChildren3.StopAttacksFor(stopAttacksFor);
				}
			}
			eventsInvoked = false;
		}
	}
}
namespace UFoxLib
{
	public class TerrenModAssetDatabase : MonoBehaviour
	{
		public List<UnitBlueprint> m_units = new List<UnitBlueprint>();

		public List<Faction> m_factions = new List<Faction>();

		public List<GameObject> m_unitBases = new List<GameObject>();

		public List<GameObject> m_weapons = new List<GameObject>();

		public List<GameObject> m_projectiles = new List<GameObject>();

		public List<GameObject> m_props = new List<GameObject>();

		public List<GameObject> m_combatMoves = new List<GameObject>();

		public List<VoiceBundle> m_voiceBundles = new List<VoiceBundle>();

		public List<FactionIcon> m_factionIcons = new List<FactionIcon>();

		public List<MapAsset> m_maps = new List<MapAsset>();

		public List<TABSCampaignLevelAsset> m_campaignLevels = new List<TABSCampaignLevelAsset>();

		public List<TABSCampaignAsset> m_campaign = new List<TABSCampaignAsset>();

		public ModLocalizationCollection m_localizationEntries;

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

		public string modName = "Rename Me";

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

		public List<SubFactionEntry> m_subFactions = new List<SubFactionEntry>();
	}
}
namespace UFoxLib.Classes
{
	public class HoldingAnimationEvent : MonoBehaviour
	{
		public HoldableDataInstance newHoldingData;

		private HoldableDataInstance defaultHoldingData;

		private Weapon weapon;

		private Holdable holdable;

		public bool animateRotation;

		public bool animatePosition;

		public float delay = 0.1f;

		private Unit unit;

		private void Start()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			weapon = ((Component)this).GetComponent<Weapon>();
			holdable = ((Component)this).GetComponent<Holdable>();
			defaultHoldingData = holdable.holdableData;
			if (!animateRotation)
			{
				newHoldingData.forwardRotation = holdable.holdableData.forwardRotation;
				newHoldingData.upRotation = holdable.holdableData.upRotation;
			}
			if (!animatePosition)
			{
				newHoldingData.relativePosition = holdable.holdableData.relativePosition;
			}
			newHoldingData.leftHand = holdable.holdableData.leftHand;
			newHoldingData.rightHand = holdable.holdableData.rightHand;
		}

		private IEnumerator AnimateIn()
		{
			yield return (object)new WaitForSeconds(delay);
			holdable.holdableData = newHoldingData;
		}

		private IEnumerator AnimateOut()
		{
			yield return (object)new WaitForSeconds(delay);
			holdable.holdableData = defaultHoldingData;
		}

		public void AnimIn()
		{
			((MonoBehaviour)this).StartCoroutine(AnimateIn());
		}

		public void AnimOut()
		{
			((MonoBehaviour)this).StartCoroutine(AnimateOut());
		}

		private void Update()
		{
		}
	}
	public class ImPlacementLeftover : GameStateListener
	{
		private bool flag_suitableToClean;

		public bool SetSuitable
		{
			get
			{
				return flag_suitableToClean;
			}
			set
			{
				flag_suitableToClean = value;
			}
		}

		public override void OnEnterBattleState()
		{
		}

		public override void OnEnterPlacementState()
		{
			if (flag_suitableToClean)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class LockUpSwitch : MonoBehaviour
	{
		public bool lookUp = true;

		public bool LockUnlockFunc
		{
			get
			{
				return lookUp;
			}
			set
			{
				lookUp = value;
			}
		}

		private void Update()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (lookUp)
			{
				((Component)this).transform.up = Vector3.up;
			}
		}
	}
	public class MeleeEffectForWeight : CollisionWeaponEffect
	{
		public UnitEffectBase EffectPrefab;

		public bool ignoreTeamMates;

		public float targetMass = 18f;

		public override void DoEffect(Transform hitTransform, Collision hit)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00a3: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			Unit component2 = ((Component)hitTransform.root).GetComponent<Unit>();
			if (component2.unitBlueprint.massMultiplier <= targetMass && (!ignoreTeamMates || !Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2) || component.Team != component2.Team))
			{
				Type type = ((object)EffectPrefab).GetType();
				UnitEffectBase val = (UnitEffectBase)((Component)hitTransform.root).GetComponentInChildren(type);
				if ((Object)(object)val == (Object)null)
				{
					GameObject obj = Object.Instantiate<GameObject>(((Component)EffectPrefab).gameObject, hitTransform.root);
					obj.transform.position = hitTransform.root.position;
					obj.GetComponent<UnitEffectBase>().DoEffect();
				}
				else
				{
					val.Ping();
				}
			}
		}
	}
}
namespace UFoxLib.Localization
{
	public class ModLocalizationEntry : MonoBehaviour
	{
		public List<string> m_key;

		public List<string> m_value;
	}
	public class ModLocalizationCollection : MonoBehaviour
	{
		public ModLocalizationEntry m_english;

		public ModLocalizationEntry m_russian;

		public ModLocalizationEntry m_chinese;

		public ModLocalizationEntry m_deutsch;

		public ModLocalizationEntry m_french;

		public ModLocalizationEntry m_japanese;

		public ModLocalizationEntry m_spanish;

		public ModLocalizationEntry m_italian;

		public ModLocalizationEntry m_portuguese;

		[Tooltip("Joke localization entry, can be enabled by replacing it with one of normal entries through code")]
		public ModLocalizationEntry m_exsecrabilis_eng;
	}
}
namespace UFoxLib.Classes
{
	public class MoveToGroundAlways : MonoBehaviour
	{
		private bool canDo;

		public Transform groundDudes;

		public LayerMask mask;

		public bool onAwake;

		public bool isItReallyCanDo
		{
			get
			{
				return canDo;
			}
			set
			{
				canDo = value;
			}
		}

		private void Awake()
		{
			if (onAwake)
			{
				canDo = true;
			}
		}

		private void GoTo()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			Physics.Raycast(new Ray(((Component)this).transform.position, Vector3.down), ref val, 150f, LayerMask.op_Implicit(mask));
			if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).transform))
			{
				((Component)groundDudes).transform.position = ((RaycastHit)(ref val)).point;
			}
		}

		private void Update()
		{
			if (canDo && (Object)(object)groundDudes != (Object)null)
			{
				GoTo();
			}
		}
	}
	public class MoveTransformHomingProjectile : MonoBehaviour
	{
		private SpellTarget target;

		private MoveTransform move;

		public float dragMultiplier;

		public float force;

		public AnimationCurve dragOverTime;

		public AnimationCurve forceOverTime;

		public float velocityPreditction;

		private float counter;

		public bool retargIfDead;

		private void Start()
		{
			target = ((Component)this).GetComponent<SpellTarget>();
			move = ((Component)this).GetComponent<MoveTransform>();
		}

		private void Update()
		{
			//IL_002d: 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_004f: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			counter += Time.deltaTime;
			if (Object.op_Implicit((Object)(object)target.rig))
			{
				Vector3.Distance(((Component)this).transform.position, target.rig.position);
				MoveTransform obj = move;
				Vector3 velocity = obj.velocity;
				Vector3 val = target.rig.position + target.rig.velocity * velocityPreditction - ((Component)this).transform.position;
				obj.velocity = velocity + ((Vector3)(ref val)).normalized * force * Time.deltaTime * forceOverTime.Evaluate(counter);
				MoveTransform obj2 = move;
				obj2.velocity -= move.velocity * Time.deltaTime * dragMultiplier * dragOverTime.Evaluate(counter);
			}
		}
	}
	public class PhysicsFollowTransform : MonoBehaviour
	{
		public Transform target;

		public float force;

		public float angularForce;

		public float drag = 0.8f;

		public Vector3 offset;

		public bool playOnStart;

		public bool setRotation;

		public bool useCenterOfMass;

		private bool done;

		private Rigidbody rig;

		private Vector3 startPos;

		private Vector3 startUp;

		public bool followRotation;

		public bool SetFollowRotation
		{
			get
			{
				return followRotation;
			}
			set
			{
				followRotation = value;
			}
		}

		public void Start()
		{
			//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)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			rig = ((Component)this).GetComponent<Rigidbody>();
			startPos += offset;
			if (playOnStart)
			{
				GoToPart();
			}
		}

		public void GoToPart()
		{
			//IL_0041: 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)
			if (done || !Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>()))
			{
				return;
			}
			done = true;
			if (Object.op_Implicit((Object)(object)target))
			{
				((Component)this).transform.position = target.position;
				if (setRotation)
				{
					((Component)this).transform.rotation = target.rotation;
				}
			}
		}

		private void FixedUpdate()
		{
			//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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_005a: 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_0076: 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_0097: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)target))
			{
				rig.AddForce((target.TransformPoint(startPos) - ((Component)this).transform.position) * force, (ForceMode)5);
				Rigidbody obj = rig;
				obj.velocity *= drag;
				Rigidbody obj2 = rig;
				obj2.angularVelocity *= drag;
				Rigidbody obj3 = rig;
				Vector3 val = Vector3.Cross(((Component)this).transform.forward, target.forward);
				obj3.AddTorque(((Vector3)(ref val)).normalized * Vector3.Angle(((Component)this).transform.forward, target.forward) * angularForce, (ForceMode)5);
				Rigidbody obj4 = rig;
				val = Vector3.Cross(((Component)this).transform.up, Vector3.up);
				obj4.AddTorque(((Vector3)(ref val)).normalized * Vector3.Angle(((Component)this).transform.up, Vector3.up) * angularForce * 0.2f, (ForceMode)5);
				if (followRotation)
				{
					((Component)this).transform.rotation = target.rotation;
				}
			}
		}
	}
	public class SphereCastUnitsTarget : MonoBehaviour
	{
		public float maxRange;

		public string maskName;

		public Unit target;

		public Color editorGizmosColor;

		public List<Unit> nearbyTargets = new List<Unit>();

		public void SetTarget()
		{
			//IL_0006: 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_0041: 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)
			RaycastHit[] array = Physics.SphereCastAll(((Component)this).transform.position, maxRange, Vector3.up, 0.1f, LayerMask.GetMask(new string[1] { maskName }));
			List<Unit> list = new List<Unit>();
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val = array2[i];
				if (Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).transform.root).GetComponent<Unit>()) && !list.Contains(((Component)((RaycastHit)(ref val)).transform.root).GetComponent<Unit>()))
				{
					list.Add(((Component)((Component)((RaycastHit)(ref val)).rigidbody).transform.root).GetComponent<Unit>());
				}
			}
			Unit[] array3 = (from Unit unit in list
				where Object.op_Implicit((Object)(object)((Component)this).GetComponent<TeamHolder>()) && !unit.data.Dead && unit.Team != ((Component)this).GetComponent<TeamHolder>().team
				select unit).OrderBy(delegate(Unit unit)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val2 = ((Component)unit.data.mainRig).transform.position - ((Component)this).transform.position;
				return ((Vector3)(ref val2)).magnitude;
			}).ToArray();
			if (array3.Length != 0)
			{
				target = array3[0];
			}
		}

		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)
			Gizmos.color = editorGizmosColor;
			Gizmos.DrawWireSphere(((Component)this).transform.position, maxRange);
		}

		public void SetTargetRandom()
		{
			//IL_0006: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit[] array = Physics.SphereCastAll(((Component)this).transform.position, maxRange, Vector3.up, 0.1f, LayerMask.GetMask(new string[1] { maskName }));
			List<Unit> list = new List<Unit>();
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val = array2[i];
				if (Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).transform.root).GetComponent<Unit>()) && !list.Contains(((Component)((RaycastHit)(ref val)).transform.root).GetComponent<Unit>()))
				{
					list.Add(((Component)((Component)((RaycastHit)(ref val)).rigidbody).transform.root).GetComponent<Unit>());
				}
			}
			Unit[] array3 = (from Unit unit in list
				where Object.op_Implicit((Object)(object)((Component)this).GetComponent<TeamHolder>()) && !unit.data.Dead && unit.Team != ((Component)this).GetComponent<TeamHolder>().team
				select unit).OrderBy(delegate(Unit unit)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val2 = ((Component)unit.data.mainRig).transform.position - ((Component)this).transform.position;
				return ((Vector3)(ref val2)).magnitude;
			}).ToArray();
			if (array3.Length != 0)
			{
				nearbyTargets = array3.ToList();
			}
			int index = Random.Range(0, nearbyTargets.Count);
			if ((Object)(object)nearbyTargets[index] != (Object)null && (Object)(object)nearbyTargets[index].data != (Object)null && !nearbyTargets[index].data.Dead)
			{
				target = nearbyTargets[index];
			}
		}

		public Unit GetUnitTarget()
		{
			//IL_0006: 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)
			Unit[] array = (from x in Physics.SphereCastAll(((Component)this).transform.position, maxRange, Vector3.up, 0.1f, LayerMask.GetMask(new string[1] { "MainRig" })).Select(delegate(RaycastHit hit)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					RaycastHit val2 = hit;
					return ((Component)((RaycastHit)(ref val2)).transform.root).GetComponent<Unit>();
				})
				where Object.op_Implicit((Object)(object)x) && !x.data.Dead && x.Team != ((Component)this).GetComponent<TeamHolder>().team
				select x).OrderBy(delegate(Unit x)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = ((Component)x.data.mainRig).transform.position - ((Component)this).transform.position;
				return ((Vector3)(ref val)).magnitude;
			}).Distinct().ToArray();
			if (array.Length != 0)
			{
				return array[Random.Range(0, array.Length - 1)];
			}
			return null;
		}
	}
	public class ProjectileVolley : MonoBehaviour
	{
		public bool onStart;

		public float spawnHeight = 10f;

		public float radius = 3f;

		public float spawnCooldown = 0.05f;

		public int totalSpawns = 25;

		public int projectilePerSpawn = 2;

		private SphereCastUnitsTarget sphereCast;

		private SpawnObject spawn;

		public float startSpawnDelay = 0.3f;

		private List<Unit> m_NearbyUnits = new List<Unit>();

		private void Start()
		{
			spawn = ((Component)this).GetComponent<SpawnObject>();
			sphereCast = ((Component)this).GetComponent<SphereCastUnitsTarget>();
			if (onStart)
			{
				((MonoBehaviour)this).StartCoroutine(SpawnArrows());
			}
		}

		public void Go()
		{
			((MonoBehaviour)this).StartCoroutine(SpawnArrows());
		}

		private IEnumerator SpawnArrows()
		{
			yield return (object)new WaitForSeconds(startSpawnDelay);
			for (int i = 0; i < totalSpawns; i++)
			{
				SetTarget();
				for (int j = 0; j < projectilePerSpawn; j++)
				{
					Vector3 val = ((Component)this).transform.position + Vector3.up * spawnHeight + Random.insideUnitSphere * radius;
					Vector3 val2 = ((Component)this).transform.position - val + Random.insideUnitSphere * 1f;
					if (Random.value > 0.1f && m_NearbyUnits.Count > 0)
					{
						int index = Random.Range(0, m_NearbyUnits.Count);
						if ((Object)(object)m_NearbyUnits[index] != (Object)null && (Object)(object)m_NearbyUnits[index].data != (Object)null && (Object)(object)m_NearbyUnits[index].data.mainRig != (Object)null)
						{
							val2 = m_NearbyUnits[index].data.mainRig.position + m_NearbyUnits[index].data.mainRig.velocity * 0.25f - val;
						}
					}
					spawn.Spawn(val, val2);
				}
				yield return (object)new WaitForSeconds(spawnCooldown);
			}
		}

		public void SetTarget()
		{
			if (Object.op_Implicit((Object)(object)sphereCast))
			{
				sphereCast.SetTargetRandom();
				m_NearbyUnits = sphereCast.nearbyTargets;
			}
		}
	}
	public class RandomSelectableRotation : MonoBehaviour
	{
		public enum VectorType
		{
			X,
			Y,
			Z
		}

		public VectorType vectorToRotate;

		public float min;

		public float max = 360f;

		private void Start()
		{
			RandomizeRotation(vectorToRotate);
		}

		public void RandomizeRotation(VectorType vectorType)
		{
			//IL_0032: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(min, max);
			switch (vectorType)
			{
			case VectorType.X:
				((Component)this).transform.localEulerAngles = new Vector3(num, ((Component)this).transform.localEulerAngles.y, ((Component)this).transform.localEulerAngles.z);
				break;
			case VectorType.Y:
				((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, num, ((Component)this).transform.localEulerAngles.z);
				break;
			case VectorType.Z:
				((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, ((Component)this).transform.localEulerAngles.y, num);
				break;
			}
		}
	}
	public class ParentUnitColor : MonoBehaviour
	{
		public enum colorType
		{
			gradient,
			normal
		}

		private UnitColorHandler colorHandler;

		public Gradient gradient;

		[Tooltip("If gradient is being used, normal color does not matter therefore")]
		public Color normalColor;

		public AnimationCurve curve;

		public UnitColorInstance color;

		public float multiplier = 3f;

		private float amount;

		public colorType type;

		private void Start()
		{
			colorHandler = ((Component)((Component)this).transform.root).GetComponentInChildren<UnitColorHandler>();
		}

		private void Update()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			amount -= Time.deltaTime * multiplier;
			if (amount >= 0f && Object.op_Implicit((Object)(object)colorHandler))
			{
				if (type == colorType.gradient)
				{
					color.color = gradient.Evaluate(1f - amount);
				}
				if (type == colorType.normal)
				{
					color.color = normalColor;
				}
				colorHandler.SetColor(color, curve.Evaluate(1f - amount));
			}
		}

		public void Do(float amount)
		{
			this.amount = amount;
		}
	}
	public class SwapWeaponByEvent : MonoBehaviour
	{
		private Unit unit;

		public Weapon rightWeapon;

		public Weapon leftWeapon;

		public float swapDelay = 0.5f;

		public bool m_isDualWield;

		private Weapon self;

		private void Start()
		{
			unit = ((Component)((Component)this).transform).GetComponentInParent<Unit>();
			self = ((Component)this).GetComponent<Weapon>();
			if (unit.unitBlueprint.holdinigWithTwoHands && !m_isDualWield)
			{
				m_isDualWield = true;
			}
		}

		public void Do()
		{
			if (!unit.dead)
			{
				((MonoBehaviour)this).StartCoroutine(GiveWeapons());
			}
		}

		private IEnumerator GiveWeapons()
		{
			yield return (object)new WaitForSeconds(swapDelay);
			if (Object.op_Implicit((Object)(object)unit.WeaponHandler))
			{
				unit.WeaponHandler.fistRefernce = null;
			}
			if ((int)unit.holdingHandler.rightHandActivity == 0)
			{
				unit.unitBlueprint.SetWeapon(unit, unit.Team, ((Component)rightWeapon).gameObject, new PropItemData(), (HandType)0, unit.data.mainRig.rotation, new List<GameObject>(), false);
			}
			if ((int)unit.holdingHandler.leftHandActivity == 0 && !m_isDualWield)
			{
				unit.unitBlueprint.SetWeapon(unit, unit.Team, ((Component)leftWeapon).gameObject, new PropItemData(), (HandType)1, unit.data.mainRig.rotation, new List<GameObject>(), false);
			}
			if ((int)unit.holdingHandler.leftHandActivity == 1 && m_isDualWield)
			{
				ConfigurableJoint component = ((Component)self).GetComponent<ConfigurableJoint>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Object.Destroy((Object)(object)component);
				}
				unit.unitBlueprint.SetWeapon(unit, unit.Team, ((Component)leftWeapon).gameObject, new PropItemData(), (HandType)1, unit.data.mainRig.rotation, new List<GameObject>(), false);
				unit.holdingHandler.leftHandActivity = (HandActivity)2;
				if (!Object.op_Implicit((Object)(object)unit.holdingHandler.leftObject.holderData))
				{
					unit.holdingHandler.leftObject.holderData = ((Component)unit).GetComponentInChildren<DataHandler>();
				}
			}
		}
	}
	public class LookEvent : GameStateListener
	{
		public string m_progressSavedKey = "";

		public float m_distanceToUnlock = 5f;

		public UnityEvent bigEvent;

		public UnityEvent hideEvent;

		public Color glowColor;

		public Renderer[] glowObjects;

		public Rigidbody m_shakenRig;

		private AudioSource loopSource;

		private RotationShake m_rotationShake;

		private float m_lookValue;

		private float m_unlockValue;

		private Transform m_mainCamTransform;

		private bool done;

		protected override void Awake()
		{
			((GameStateListener)this).Awake();
			if ((Object)(object)m_mainCamTransform == (Object)null)
			{
				((GameStateListener)this).OnEnterNewScene();
			}
		}

		private void UnlockProgressFeedback()
		{
			//IL_0051: 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_0066: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)m_rotationShake))
			{
				if (m_unlockValue <= 0f)
				{
					m_rotationShake.AddForce(Random.onUnitSphere * 2f);
					m_unlockValue = 0f;
				}
				((Behaviour)m_rotationShake).enabled = true;
				m_rotationShake.AddForce(Random.onUnitSphere * m_unlockValue * Time.deltaTime * 50f);
			}
		}

		private void SetColor()
		{
			//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_006b: Unknown result type (might be due to invalid IL or missing references)
			m_unlockValue = Mathf.Clamp(m_unlockValue, 0f, float.PositiveInfinity);
			for (int i = 0; i < glowObjects.Length; i++)
			{
				Material[] materials = glowObjects[i].materials;
				for (int j = 0; j < materials.Length; j++)
				{
					if (materials[j].HasProperty("_EmissionColor"))
					{
						materials[j].EnableKeyword("_EMISSION");
						materials[j].SetColor("_EmissionColor", glowColor * m_unlockValue * 2f);
					}
				}
				glowObjects[i].materials = materials;
			}
		}

		private void Update()
		{
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)m_mainCamTransform != (Object)null) || !Object.op_Implicit((Object)(object)m_shakenRig) || done)
			{
				return;
			}
			loopSource.volume = ((m_unlockValue <= 0f) ? 0f : Mathf.Pow(m_unlockValue * 0.25f, 1.3f));
			if (float.IsNaN(loopSource.volume))
			{
				loopSource.volume = 0f;
			}
			float num = 1f + 1f * m_unlockValue;
			loopSource.pitch = ((num >= 0f) ? num : 0f);
			if (m_unlockValue > 0f || m_lookValue > 10f)
			{
				SetColor();
			}
			float num2 = Vector3.Distance(m_shakenRig.worldCenterOfMass, m_mainCamTransform.position);
			if (num2 > m_distanceToUnlock)
			{
				m_unlockValue -= Time.unscaledDeltaTime * 0.2f;
				return;
			}
			float num3 = Vector3.Angle(m_mainCamTransform.forward, m_shakenRig.worldCenterOfMass - m_mainCamTransform.position);
			m_lookValue = 1000f / (num2 * num3);
			if (m_lookValue > 8f)
			{
				float num4 = 0.2f;
				m_unlockValue += num4 * Time.unscaledDeltaTime;
				UnlockProgressFeedback();
				if (m_unlockValue > 1f)
				{
					KeyEvent();
				}
			}
			else
			{
				m_unlockValue -= Time.unscaledDeltaTime * 0.2f;
			}
		}

		private void KeyEvent()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (((Behaviour)this).enabled && !string.IsNullOrWhiteSpace(m_progressSavedKey) && !ServiceLocator.GetService<ISaveLoaderService>().HasUnlockedSecret(m_progressSavedKey))
			{
				if (Object.op_Implicit((Object)(object)ScreenShake.Instance))
				{
					ScreenShake.Instance.AddForce(Vector3.up * 8f, ((Component)m_shakenRig).transform.position);
				}
				UnityEvent val = bigEvent;
				if (val != null)
				{
					val.Invoke();
				}
				loopSource.Stop();
				loopSource.volume = 1f;
				done = true;
				if (!string.IsNullOrWhiteSpace(m_progressSavedKey))
				{
					ServiceLocator.GetService<ISaveLoaderService>().UnlockSecret(m_progressSavedKey);
				}
			}
		}

		public override void OnEnterNewScene()
		{
			((GameStateListener)this).OnEnterNewScene();
			loopSource = ((Component)this).GetComponent<AudioSource>();
			if (Object.op_Implicit((Object)(object)loopSource))
			{
				loopSource.volume = 0f;
			}
			m_rotationShake = ((Component)this).GetComponentInChildren<RotationShake>();
			if (!Object.op_Implicit((Object)(object)m_shakenRig))
			{
				m_shakenRig = ((Component)this).GetComponentInChildren<Rigidbody>();
			}
			if (!string.IsNullOrWhiteSpace(m_progressSavedKey) && ServiceLocator.GetService<ISaveLoaderService>().HasUnlockedSecret(m_progressSavedKey))
			{
				if (Object.op_Implicit((Object)(object)m_shakenRig))
				{
					((Component)m_shakenRig).gameObject.SetActive(false);
				}
				((Behaviour)this).enabled = false;
				UnityEvent val = hideEvent;
				if (val != null)
				{
					val.Invoke();
				}
			}
			PlayerCamerasManager service = ServiceLocator.GetService<PlayerCamerasManager>();
			MainCam val2 = ((service != null) ? service.GetMainCam((Player)0) : null);
			m_mainCamTransform = (((Object)(object)val2 != (Object)null) ? ((Component)val2).transform : null);
		}

		public override void OnEnterBattleState()
		{
		}

		public override void OnEnterPlacementState()
		{
		}
	}
	public class UnitEffectWithEvent : UnitEffectBase
	{
		public UnityEvent pingEvent;

		public override void DoEffect()
		{
			((UnitEffectBase)this).Ping();
		}

		public override void Ping()
		{
			pingEvent.Invoke();
		}
	}
	public class UnitHalfHealhtEvent : MonoBehaviour
	{
		public UnityEvent halfLifeEvent;

		public UnityEvent opposingForceEvent;

		private DataHandler data;

		private bool onceChecker;

		private void Start()
		{
			data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)data) && !data.Dead)
			{
				float num = data.maxHealth / 2f;
				if (!onceChecker && data.health <= num)
				{
					halfLifeEvent.Invoke();
					onceChecker = true;
				}
				if (onceChecker && data.health > num)
				{
					opposingForceEvent.Invoke();
					onceChecker = false;
				}
			}
		}

		public void ForceResetChecker()
		{
			if (onceChecker)
			{
				onceChecker = false;
			}
		}
	}
}
namespace UFoxLib.Utilities.Editor
{
	public class UCiconEditorScene : MonoBehaviour
	{
		public enum CameraAngles
		{
			Default = 0,
			Head = 1,
			Torso = 2,
			Shoulders = 3,
			Hip = 5,
			Legs = 6,
			Feet = 7,
			Weapon = 8,
			Projectile = 9,
			Bracelets = 4
		}

		public enum SaveDirectory
		{
			PropItems,
			Weapons,
			Projectiles
		}

		[Tooltip("I won't make this as auto-set, because why i'm even need to? Who cares lol lmao I'll manually setup entire scene")]
		public GameObject photoCamera;

		public CameraAngles moveCameraTo;

		[Header("Clothing camera angles")]
		public Transform angle_Head;

		public Transform angle_Torso;

		public Transform angle_Shoulders;

		public Transform angle_Hip;

		public Transform angle_Legs;

		public Transform angle_Feet;

		[Header("Weaponry camera angles")]
		public Transform angle_Weapon;

		public Transform angle_Projectile;

		private Camera mainCam;

		[Header("Save information")]
		public string propDirectory;

		public string weaponDirectory;

		public string projectileDirectory;

		public SaveDirectory currentIconFileDirectory;

		[HideInInspector]
		public int iconSize = 256;

		public string iconName = "Item";

		public Transform angle_Bracelets;

		[Header("Automatization")]
		public string modPrefix = "Mod_";

		public GameObject eyes;

		public List<GameObject> props = new List<GameObject>();

		public List<GameObject> hideDuringGeneration = new List<GameObject>();

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

		public Transform root;

		public Transform b_head;

		public Transform b_torso;

		public Transform b_hip;

		public Transform b_armL;

		public Transform b_elbowL;

		public Transform b_armR;

		public Transform b_elbowR;

		public Transform b_legL;

		public Transform b_legR;

		public Transform b_kneeL;

		public Transform b_kneeR;

		private static UCiconEditorScene instance;

		public Transform b_armature;

		public Transform b_otherBones;

		public List<GameObject> weapons = new List<GameObject>();

		public List<GameObject> projectiles = new List<GameObject>();

		public void CameraVector(CameraAngles values)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_0107: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			switch (values)
			{
			case CameraAngles.Default:
				iconSize = 256;
				mainCam.fieldOfView = 34f;
				photoCamera.transform.position = Vector3.zero;
				photoCamera.transform.rotation = new Quaternion(0f, 0f, 0f, 0f);
				break;
			case CameraAngles.Head:
				iconSize = 256;
				mainCam.fieldOfView = 34f;
				photoCamera.transform.position = angle_Head.position;
				photoCamera.transform.rotation = angle_Head.rotation;
				break;
			case CameraAngles.Torso:
				iconSize = 256;
				mainCam.fieldOfView = 34f;
				photoCamera.transform.position = angle_Torso.position;
				photoCamera.transform.rotation = angle_Torso.rotation;
				break;
			case CameraAngles.Shoulders:
				iconSize = 256;
				mainCam.fieldOfView = 34f;
				photoCamera.transform.position = angle_Shoulders.position;
				photoCamera.transform.rotation = angle_Shoulders.rotation;
				break;
			case CameraAngles.Bracelets:
				iconSize = 256;
				mainCam.fieldOfView = 34f;
				photoCamera.transform.position = angle_Bracelets.position;
				photoCamera.transform.rotation = angle_Bracelets.rotation;
				break;
			case CameraAngles.Hip:
				iconSize = 256;
				mainCam.fieldOfView = 34f;
				photoCamera.transform.position = angle_Hip.position;
				photoCamera.transform.rotation = angle_Hip.rotation;
				break;
			case CameraAngles.Legs:
				iconSize = 256;
				mainCam.fieldOfView = 34f;
				photoCamera.transform.position = angle_Legs.position;
				photoCamera.transform.rotation = angle_Legs.rotation;
				break;
			case CameraAngles.Feet:
				iconSize = 256;
				mainCam.fieldOfView = 34f;
				photoCamera.transform.position = angle_Feet.position;
				photoCamera.transform.rotation = angle_Feet.rotation;
				break;
			case CameraAngles.Weapon:
				iconSize = 512;
				mainCam.fieldOfView = 24f;
				photoCamera.transform.position = angle_Weapon.position;
				photoCamera.transform.rotation = angle_Weapon.rotation;
				break;
			case CameraAngles.Projectile:
				iconSize = 512;
				mainCam.fieldOfView = 24f;
				photoCamera.transform.position = angle_Projectile.position;
				photoCamera.transform.rotation = angle_Projectile.rotation;
				break;
			}
		}

		public UCiconEditorScene()
		{
			propDirectory = "/like this/folder/finalFolder";
			weaponDirectory = "/like this/folder/finalFolder";
			projectileDirectory = "/like this/folder/finalFolder";
		}

		private void Start()
		{
			mainCam = photoCamera.GetComponent<Camera>();
			instance = this;
		}

		public void Button_TakeIcon()
		{
			string name = iconName;
			if (iconName == null)
			{
				name = Random.Range(100000000, 999999999).ToString();
			}
			TakePhotoFinalSteps(name, currentIconFileDirectory);
		}

		protected void TakePhotoFinalSteps(string name, SaveDirectory dir)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			RenderTexture val = new RenderTexture(iconSize, iconSize, 24);
			val.format = (RenderTextureFormat)0;
			val.Create();
			mainCam.targetTexture = val;
			mainCam.Render();
			SaveIcon(val, name + ".png", dir);
			mainCam.targetTexture = null;
			val.Release();
			Object.DestroyImmediate((Object)(object)val);
		}

		private void EncodeRenderTexture(RenderTexture rt, TextureFormat textureF, string fileName, SaveDirectory dir)
		{
			//IL_0052: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00b7: Expected O, but got Unknown
			string text = Application.dataPath;
			switch (dir)
			{
			case SaveDirectory.PropItems:
				text += propDirectory;
				break;
			case SaveDirectory.Weapons:
				text += weaponDirectory;
				break;
			case SaveDirectory.Projectiles:
				text += projectileDirectory;
				break;
			}
			Texture2D val = new Texture2D(((Texture)rt).width, ((Texture)rt).height, textureF, true);
			RenderTexture.active = rt;
			val.ReadPixels(new Rect(0f, 0f, (float)((Texture)rt).width, (float)((Texture)rt).height), 0, 0);
			val.Apply();
			byte[] bytes = ImageConversion.EncodeToPNG(val);
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			File.WriteAllBytes(text + "/" + fileName, bytes);
			Object.DestroyImmediate((Object)val);
		}

		private void SaveIcon(RenderTexture rt, string name, SaveDirectory dir)
		{
			EncodeRenderTexture(rt, (TextureFormat)5, name, dir);
		}

		public void Button_UpdateCamAngle()
		{
			CameraVector(moveCameraTo);
		}

		public void Button_GenerateIcons()
		{
			((MonoBehaviour)this).StartCoroutine(AutoGeneratePropIcons());
		}

		private IEnumerator AutoGeneratePropIcons()
		{
			for (int j = 0; j < hideDuringGeneration.Count; j++)
			{
				if (hideDuringGeneration[j].activeInHierarchy)
				{
					hideDuringGeneration[j].SetActive(false);
				}
			}
			currentIconFileDirectory = SaveDirectory.PropItems;
			int i = 0;
			for (int max = props.Count; i < max; i++)
			{
				PropItem component = props[i].GetComponent<PropItem>();
				if (Object.op_Implicit((Object)(object)component))
				{
					if (component.disableGooglyEyesOfParent && eyes.activeInHierarchy)
					{
						eyes.SetActive(false);
					}
					SkinnedMeshRenderer componentInChildren = ((Component)component).GetComponentInChildren<SkinnedMeshRenderer>();
					InstantiateAtBodypart(props[i], ((CharacterItem)component).GearT, (Object)(object)componentInChildren != (Object)null);
					yield return (object)new WaitForSeconds(0.1f);
					TakePhotoFinalSteps(modPrefix.ToString() + ((Object)props[i]).name.ToString(), currentIconFileDirectory);
					for (int k = 0; k < toFlush.Count; k++)
					{
						Object.Destroy((Object)(object)toFlush[k]);
					}
					toFlush.Clear();
					if (!eyes.activeInHierarchy)
					{
						eyes.SetActive(true);
					}
					FlushLogEditor();
				}
				else
				{
					Debug.LogError((object)"FAILED TO GET PROP ITEM! Be sure that every object in 'props' list does have Prop Item!");
				}
			}
			for (int l = 0; l < hideDuringGeneration.Count; l++)
			{
				if (!hideDuringGeneration[l].activeInHierarchy)
				{
					hideDuringGeneration[l].SetActive(true);
				}
			}
		}

		private void InstantiateAtBodypart(GameObject gobj, GearType gearT, bool isSkinned)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected I4, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: 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_00fc: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> list = new List<GameObject>();
			GameObject val;
			switch ((int)gearT)
			{
			case 0:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_head, false);
				CameraVector(CameraAngles.Head);
				val.transform.localPosition = Vector3.zero;
				break;
			case 1:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_head, false);
				CameraVector(CameraAngles.Shoulders);
				val.transform.localPosition = Vector3.zero;
				break;
			case 2:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_armL, false);
				if (!isSkinned)
				{
					GameObject val3 = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_armR);
					val3.transform.localScale = new Vector3(val3.transform.localScale.x * -1f, val3.transform.localScale.y, val3.transform.localScale.z);
					toFlush.Add(val3);
					list.Add(val3);
					val3.transform.localPosition = Vector3.zero;
				}
				val.transform.localPosition = Vector3.zero;
				CameraVector(CameraAngles.Shoulders);
				break;
			case 3:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_torso, false);
				val.transform.localPosition = Vector3.zero;
				CameraVector(CameraAngles.Torso);
				break;
			case 4:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_armL, false);
				if (!isSkinned)
				{
					GameObject val5 = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_armR, false);
					val5.transform.localScale = new Vector3(val5.transform.localScale.x * -1f, val5.transform.localScale.y, val5.transform.localScale.z);
					toFlush.Add(val5);
					list.Add(val5);
					val5.transform.localPosition = Vector3.zero;
				}
				val.transform.localPosition = Vector3.zero;
				CameraVector(CameraAngles.Torso);
				break;
			case 5:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_elbowL, false);
				if (!isSkinned)
				{
					GameObject val6 = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_elbowR, false);
					val6.transform.localScale = new Vector3(val6.transform.localScale.x * -1f, val6.transform.localScale.y, val6.transform.localScale.z);
					toFlush.Add(val6);
					list.Add(val6);
					val6.transform.localPosition = Vector3.zero;
				}
				val.transform.localPosition = Vector3.zero;
				CameraVector(CameraAngles.Bracelets);
				break;
			case 7:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_hip, false);
				val.transform.localPosition = Vector3.zero;
				CameraVector(CameraAngles.Hip);
				break;
			case 8:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_legL, false);
				if (!isSkinned)
				{
					GameObject val4 = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_legR, false);
					val4.transform.localScale = new Vector3(val4.transform.localScale.x * -1f, val4.transform.localScale.y, val4.transform.localScale.z);
					toFlush.Add(val4);
					list.Add(val4);
					val4.transform.localPosition = Vector3.zero;
				}
				val.transform.localPosition = Vector3.zero;
				CameraVector(CameraAngles.Legs);
				break;
			case 9:
				val = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_kneeL, false);
				if (!isSkinned)
				{
					GameObject val2 = Object.Instantiate<GameObject>(gobj, isSkinned ? root : b_kneeR, false);
					val2.transform.localScale = new Vector3(val2.transform.localScale.x * -1f, val2.transform.localScale.y, val2.transform.localScale.z);
					toFlush.Add(val2);
					list.Add(val2);
					val2.transform.localPosition = Vector3.zero;
				}
				val.transform.localPosition = Vector3.zero;
				CameraVector(CameraAngles.Feet);
				break;
			default:
				val = null;
				break;
			}
			for (int i = 0; i < list.Count; i++)
			{
				Object.Destroy((Object)(object)list[i].GetComponent<PropItem>());
				TeamColor[] components = list[i].GetComponents<TeamColor>();
				for (int j = 0; j < components.Length; j++)
				{
					Object.Destroy((Object)(object)components[j]);
				}
				components = list[i].GetComponentsInChildren<TeamColor>();
				for (int k = 0; k < components.Length; k++)
				{
					Object.Destroy((Object)(object)components[k]);
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				list.Add(val);
			}
			if (isSkinned)
			{
				StitchArmature(val);
			}
			if ((Object)(object)val != (Object)null)
			{
				toFlush.Add(val);
			}
		}

		public void StitchArmature(GameObject mesh)
		{
			SkinnedMeshRenderer componentInChildren = mesh.GetComponentInChildren<SkinnedMeshRenderer>();
			componentInChildren.rootBone = b_armature;
			Transform[] array = (Transform[])(object)new Transform[componentInChildren.bones.Length];
			for (int i = 0; i < componentInChildren.bones.Length; i++)
			{
				Transform[] componentsInChildren = ((Component)b_otherBones).GetComponentsInChildren<Transform>();
				foreach (Transform val in componentsInChildren)
				{
					if (((Object)val).name == ((Object)componentInChildren.bones[i]).name)
					{
						array[i] = val;
					}
				}
			}
			componentInChildren.bones = array;
		}

		public void FlushLogEditor()
		{
			if (Application.isEditor)
			{
				Assembly.GetAssembly(typeof(Editor)).GetType("UnityEditor.LogEntries").GetMethod("Clear")
					.Invoke(new object(), null);
			}
		}

		public void Button_GenerateWeaponIcons()
		{
			((MonoBehaviour)this).StartCoroutine(AutoGenerateWeaponIcons());
		}

		private IEnumerator AutoGenerateWeaponIcons()
		{
			for (int k = 0; k < hideDuringGeneration.Count; k++)
			{
				if (hideDuringGeneration[k].activeInHierarchy)
				{
					hideDuringGeneration[k].SetActive(false);
				}
			}
			if (weapons != null)
			{
				currentIconFileDirectory = SaveDirectory.Weapons;
				CameraVector(CameraAngles.Weapon);
				int j = 0;
				int max2 = weapons.Count;
				while (j < max2)
				{
					GameObject currentW2 = weapons[j];
					if (Object.op_Implicit((Object)(object)currentW2))
					{
						if (!currentW2.activeInHierarchy)
						{
							currentW2.SetActive(true);
						}
						yield return (object)new WaitForSeconds(0.1f);
						TakePhotoFinalSteps(modPrefix.ToString() + ((Object)weapons[j]).name.ToString(), currentIconFileDirectory);
						if (currentW2.activeInHierarchy)
						{
							currentW2.SetActive(false);
						}
						j++;
					}
				}
			}
			if (projectiles != null)
			{
				currentIconFileDirectory = SaveDirectory.Projectiles;
				CameraVector(CameraAngles.Projectile);
				int j = 0;
				int max2 = projectiles.Count;
				while (j < max2)
				{
					GameObject currentW2 = projectiles[j];
					if (Object.op_Implicit((Object)(object)currentW2))
					{
						if (!currentW2.activeInHierarchy)
						{
							currentW2.SetActive(true);
						}
						yield return (object)new WaitForSeconds(0.1f);
						TakePhotoFinalSteps(modPrefix.ToString() + ((Object)projectiles[j]).name.ToString(), currentIconFileDirectory);
						if (currentW2.activeInHierarchy)
						{
							currentW2.SetActive(false);
						}
						j++;
					}
				}
			}
			for (int l = 0; l < hideDuringGeneration.Count; l++)
			{
				if (!hideDuringGeneration[l].activeInHierarchy)
				{
					hideDuringGeneration[l].SetActive(true);
				}
			}
		}
	}
}
namespace UFoxLib.Classes
{
	public class GameStatePlacementEvents : GameStateListener
	{
		public UnityEvent placementEvent;

		public UnityEvent battleEvent;

		public override void OnEnterBattleState()
		{
			battleEvent.Invoke();
		}

		public override void OnEnterPlacementState()
		{
			placementEvent.Invoke();
		}
	}
	public class PlayAnimationByEvent : MonoBehaviour
	{
		[Tooltip("For when needed to play animation to single object")]
		public Animation anim;

		[Tooltip("For when needed to play same animation to multiple objects")]
		public List<Animation> anims = new List<Animation>();

		private void Start()
		{
			if (!Object.op_Implicit((Object)(object)anim))
			{
				anim = ((Component)this).GetComponentInChildren<Animation>();
			}
		}

		public void PlayThe(string animation)
		{
			if (Object.op_Implicit((Object)(object)anim))
			{
				anim.Play(animation);
			}
		}

		public void PlayForAll(string animation)
		{
			for (int i = 0; i < anims.Count; i++)
			{
				anims[i].Play(animation);
			}
		}
	}
	public class InvertModelAxis : MonoBehaviour
	{
		public enum AxisType
		{
			X,
			Y,
			Z
		}

		public bool onStart;

		public AxisType vectorToInvert;

		private void Start()
		{
			if (onStart)
			{
				Invert(vectorToInvert);
			}
		}

		public void Do()
		{
			Invert(vectorToInvert);
		}

		private void Invert(AxisType vectorType)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0066: 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_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)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			switch (vectorType)
			{
			case AxisType.X:
				((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x * -1f, ((Component)this).transform.localScale.y, ((Component)this).transform.localScale.z);
				break;
			case AxisType.Y:
				((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x, ((Component)this).transform.localScale.y * -1f, ((Component)this).transform.localScale.z);
				break;
			case AxisType.Z:
				((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x, ((Component)this).transform.localScale.y, ((Component)this).transform.localScale.z * -1f);
				break;
			}
		}
	}
}
namespace UFoxLib.SecretManagement
{
	[Serializable]
	public class SecretPropEntry : MonoBehaviour
	{
		public string sceneName;

		public GameObject[] objectsToSpawnInScene;
	}
	public class SecretPropCollection : MonoBehaviour
	{
		public string collectionName = "---Name for object in scene---";

		public SecretPropEntry[] entries;
	}
}
namespace UFoxLib.Classes
{
	public class CooldownEvent : MonoBehaviour
	{
		private bool isOnCD;

		public float cooldown;

		public float randomMinMax;

		public bool randomCd;

		public UnityEvent mainEvent;

		public UnityEvent endEvent;

		public void Go()
		{
			if (!isOnCD)
			{
				((MonoBehaviour)this).StartCoroutine(InvokeEvents());
			}
		}

		private IEnumerator InvokeEvents()
		{
			if (!isOnCD)
			{
				isOnCD = true;
			}
			float num = 0f;
			if (randomCd)
			{
				float num2 = Random.Range(0f - randomMinMax, randomMinMax);
				num = cooldown + num2;
			}
			if (!randomCd)
			{
				num = cooldown;
			}
			mainEvent.Invoke();
			yield return (object)new WaitForSeconds(num);
			if (endEvent != null)
			{
				endEvent.Invoke();
			}
			if (!isOnCD)
			{
				isOnCD = false;
			}
		}
	}
	public class ShakeObject : MonoBehaviour
	{
		private RotationShake m_shake;

		public float decayTime;

		public float multiplier = 50f;

		[SerializeField]
		private bool shakeConstant;

		public bool SetShakeable
		{
			get
			{
				return shakeConstant;
			}
			set
			{
				shakeConstant = value;
			}
		}

		private void Start()
		{
			m_shake = ((Component)this).GetComponent<RotationShake>();
		}

		private void Update()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (shakeConstant)
			{
				m_shake.AddForce(Random.onUnitSphere);
			}
		}

		public void DoOnce(float m)
		{
			//IL_0006: 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)
			m_shake.ShakeOverTime(Vector3.up * m, ((Component)this).transform.position, decayTime, 0f);
		}
	}
	public class DieByEvent : MonoBehaviour
	{
		private Unit unit;

		private void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
		}

		public void Die(float m_delay)
		{
			((MonoBehaviour)this).StartCoroutine(DelayedDie(m_delay));
		}

		private IEnumerator DelayedDie(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if (Object.op_Implicit((Object)(object)unit))
			{
				unit.data.healthHandler.Die((Unit)null);
			}
		}
	}
}
namespace UFoxLib.Localization
{
	public class ModLocalizationReader : MonoBehaviour
	{
		public ModLocalizationCollection languanes;

		public void Start()
		{
			Dictionary<Language, Dictionary<string, string>> dictionary = (Dictionary<Language, Dictionary<string, string>>)typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			try
			{
				for (int i = 0; i < languanes.m_english.m_key.Count; i++)
				{
					dictionary[(Language)0].Add(languanes.m_english.m_key[i], languanes.m_english.m_value[i]);
				}
				for (int j = 0; j < languanes.m_russian.m_key.Count; j++)
				{
					dictionary[(Language)6].Add(languanes.m_russian.m_key[j], languanes.m_russian.m_value[j]);
				}
				for (int k = 0; k < languanes.m_chinese.m_key.Count; k++)
				{
					dictionary[(Language)7].Add(languanes.m_chinese.m_key[k], languanes.m_chinese.m_value[k]);
				}
				for (int l = 0; l < languanes.m_french.m_key.Count; l++)
				{
					dictionary[(Language)1].Add(languanes.m_french.m_key[l], languanes.m_french.m_value[l]);
				}
				for (int m = 0; m < languanes.m_spanish.m_key.Count; m++)
				{
					dictionary[(Language)4].Add(languanes.m_spanish.m_key[m], languanes.m_spanish.m_value[m]);
				}
				for (int n = 0; n < languanes.m_japanese.m_key.Count; n++)
				{
					dictionary[(Language)8].Add(languanes.m_japanese.m_key[n], languanes.m_japanese.m_value[n]);
				}
				for (int num = 0; num < languanes.m_deutsch.m_key.Count; num++)
				{
					dictionary[(Language)3].Add(languanes.m_deutsch.m_key[num], languanes.m_deutsch.m_value[num]);
				}
				for (int num2 = 0; num2 < languanes.m_italian.m_key.Count; num2++)
				{
					dictionary[(Language)2].Add(languanes.m_italian.m_key[num2], languanes.m_italian.m_value[num2]);
				}
				for (int num3 = 0; num3 < languanes.m_portuguese.m_key.Count; num3++)
				{
					dictionary[(Language)5].Add(languanes.m_portuguese.m_key[num3], languanes.m_portuguese.m_value[num3]);
				}
			}
			catch
			{
			}
		}
	}
}
namespace UFoxLib
{
	[BepInPlugin("terren.ufoxlib", "UFoxLib", "1.3.0")]
	public class UFoxLibInit : BaseUnityPlugin
	{
		private static readonly string dependency;

		public static AssetBundle bundle;

		public UFoxLibInit()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("UFoxPatcher").PatchAll();
			SceneManager.sceneLoaded += ModSceneLoadManagerGlobal.SceneLoaded;
		}

		static UFoxLibInit()
		{
			dependency = "to use this lib in your mod, above BepInPlugin add this - [BepInDependency(''terren.ufoxlib'', BepInDependency.DependencyFlags.HardDependency)] - your mod won't load if UFoxLib will be missing from mod list";
			bundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("ufoxlib"));
		}

		private void Awake()
		{
			TerrenModUtilities.AddTeamColorPalette(bundle.LoadAsset<UnitEditorColorPalette>("UFoxColorPalette"));
		}
	}
}
namespace UFoxLib.Classes
{
	public class MeleeWeaponOnSwingEnd : MonoBehaviour
	{
		public UnityEvent m_event;
	}
}
namespace UFoxLib.Patches
{
	[HarmonyPatch(typeof(MeleeWeapon), "StopSwing")]
	internal class Patch_MeleeWeaponSwingEndEvent
	{
		public static bool Prefix(MeleeWeapon __instance)
		{
			MeleeWeaponOnSwingEnd component = ((Component)__instance).gameObject.GetComponent<MeleeWeaponOnSwingEnd>();
			if ((Object)(object)component != (Object)null)
			{
				component.m_event.Invoke();
			}
			return true;
		}
	}
}
namespace UFoxLib.Classes
{
	public class BetterPlayLoopWhenActive : MonoBehaviour
	{
		public GameObject target;

		public float lerpSpeed = 2f;

		public float fullVolume = 1f;

		private AudioSource source;

		private void Start()
		{
			source = ((Component)this).GetComponent<AudioSource>();
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)target))
			{
				if (target.activeInHierarchy)
				{
					source.volume = Mathf.Lerp(source.volume, fullVolume, lerpSpeed * Time.deltaTime);
				}
				else
				{
					source.volume = Mathf.Lerp(source.volume, 0f, lerpSpeed * Time.deltaTime);
				}
			}
		}
	}
}
namespace UFoxLib.Patches
{
	[HarmonyPatch(typeof(TeamColor), "Awake")]
	internal class Patch_TeamColorIndexFixer
	{
		[HarmonyPrefix]
		public static bool Prefix(TeamColor __instance)
		{
			TeamColorPaletteData[] teamColors = ContentDatabase.Instance().GetUnitEditorColorPalette().TeamColors;
			for (int i = 0; i < teamColors.Length; i++)
			{
				if ((Object)(object)__instance.redMaterial != (Object)null && ((Object)teamColors[i].m_materialRed).name == ((Object)__instance.redMaterial).name)
				{
					__instance.m_teamColorIndex = i;
					break;
				}
			}
			return true;
		}
	}
}
namespace UFoxLib.Classes
{
	public class EmptyEffect : UnitEffectBase
	{
		private bool m_inited;

		public UnityEvent onceEvent;

		public override void DoEffect()
		{
			DoTheThing();
		}

		public override void Ping()
		{
			((UnitEffectBase)this).DoEffect();
		}

		private void DoTheThing()
		{
			if (!m_inited)
			{
				m_inited = true;
				onceEvent.Invoke();
			}
		}
	}
}
namespace UFoxLib
{
	public static class TerrenModUtilities
	{
		private const BindingFlags allFlags = (BindingFlags)(-1);

		public static List<SubFactionEntry> subFactions;

		public static void AddFactions(ContentDatabase database, TerrenModAssetDatabase modDatabase)
		{
			//IL_00a6: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<DatabaseID, Object> dictionary = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
			LandfallContentDatabase landfallContentDatabase = database.LandfallContentDatabase;
			Dictionary<DatabaseID, Faction> factions = (Dictionary<DatabaseID, Faction>)typeof(LandfallContentDatabase).GetField("m_factions", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			List<DatabaseID> list = (List<DatabaseID>)typeof(LandfallContentDatabase).GetField("m_defaultHotbarFactionIds", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (Faction faction in modDatabase.m_factions)
			{
				factions.Add(faction.Entity.GUID, faction);
				dictionary.Add(faction.Entity.GUID, (Object)(object)faction);
				if (faction.m_displayFaction)
				{
					list.Add(faction.Entity.GUID);
				}
			}
			typeof(LandfallContentDatabase).GetField("m_factions", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, factions);
			typeof(LandfallContentDatabase).GetField("m_defaultHotbarFactionIds", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, list.OrderBy((DatabaseID x) => factions[x].index).ToList());
		}

		public static void AddUnitBlueprints(ContentDatabase database, TerrenModAssetDatabase modDatabase)
		{
			//IL_0160: 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)
			Dictionary<DatabaseID, Object> dictionary = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
			LandfallContentDatabase landfallContentDatabase = database.LandfallContentDatabase;
			Dictionary<DatabaseID, UnitBlueprint> dictionary2 = (Dictionary<DatabaseID, UnitBlueprint>)typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (UnitBlueprint unit in modDatabase.m_units)
			{
				if (((Object)unit.UnitBase).name == "HOLDER_STIFFY")
				{
					unit.UnitBase = landfallContentDatabase.GetUnitBases().ToList().Find((GameObject x) => ((Object)x).name == "Stiffy_1 Prefabs_VB");
				}
				if (((Object)unit.UnitBase).name == "HOLDER_HUMANOID")
				{
					unit.UnitBase = landfallContentDatabase.GetUnitBases().ToList().Find((GameObject x) => ((Object)x).name == "Humanoid_1 Prefabs_VB");
				}
				if (((Object)unit.UnitBase).name == "HOLDER_HALFLING")
				{
					unit.UnitBase = landfallContentDatabase.GetUnitBases().ToList().Find((GameObject x) => ((Object)x).name == "Halfling_1 Prefabs_VB");
				}
				dictionary2.Add(unit.Entity.GUID, unit);
				dictionary.Add(unit.Entity.GUID, (Object)(object)unit);
			}
			typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary2);
		}

		public static void AddUnitCreatorPass(ContentDatabase database, TerrenModAssetDatabase modDatabase)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<DatabaseID, Object> dictionary = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
			LandfallContentDatabase landfallContentDatabase = database.LandfallContentDatabase;
			Dictionary<DatabaseID, GameObject> dictionary2 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_unitBases", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (GameObject unitBasis in modDatabase.m_unitBases)
			{
				dictionary2.Add(unitBasis.GetComponent<Unit>().Entity.GUID, unitBasis);
				dictionary.Add(unitBasis.GetComponent<Unit>().Entity.GUID, (Object)(object)unitBasis);
			}
			typeof(LandfallContentDatabase).GetField("m_unitBases", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary2);
			Dictionary<DatabaseID, GameObject> dictionary3 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_characterProps", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (GameObject prop in modDatabase.m_props)
			{
				dictionary3.Add(((CharacterItem)prop.GetComponent<PropItem>()).Entity.GUID, prop);
				dictionary.Add(((CharacterItem)prop.GetComponent<PropItem>()).Entity.GUID, (Object)(object)prop);
			}
			typeof(LandfallContentDatabase).GetField("m_characterProps", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary3);
			Dictionary<DatabaseID, GameObject> dictionary4 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_combatMoves", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (GameObject combatMove in modDatabase.m_combatMoves)
			{
				dictionary4.Add(((CharacterItem)combatMove.GetComponent<SpecialAbility>()).Entity.GUID, combatMove);
				dictionary.Add(((CharacterItem)combatMove.GetComponent<SpecialAbility>()).Entity.GUID, (Object)(object)combatMove);
			}
			typeof(LandfallContentDatabase).GetField("m_combatMoves", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary4);
			Dictionary<DatabaseID, GameObject> dictionary5 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_weapons", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (GameObject weapon in modDatabase.m_weapons)
			{
				dictionary5.Add(((CharacterItem)weapon.GetComponent<WeaponItem>()).Entity.GUID, weapon);
				dictionary.Add(((CharacterItem)weapon.GetComponent<WeaponItem>()).Entity.GUID, (Object)(object)weapon);
			}
			typeof(LandfallContentDatabase).GetField("m_weapons", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary5);
			Dictionary<DatabaseID, GameObject> dictionary6 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_projectiles", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (GameObject projectile in modDatabase.m_projectiles)
			{
				dictionary6.Add(projectile.GetComponent<ProjectileEntity>().Entity.GUID, projectile);
				dictionary.Add(projectile.GetComponent<ProjectileEntity>().Entity.GUID, (Object)(object)projectile);
			}
			typeof(LandfallContentDatabase).GetField("m_projectiles", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary6);
			Dictionary<DatabaseID, VoiceBundle> dictionary7 = (Dictionary<DatabaseID, VoiceBundle>)typeof(LandfallContentDatabase).GetField("m_voiceBundles", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (VoiceBundle voiceBundle in modDatabase.m_voiceBundles)
			{
				dictionary7.Add(voiceBundle.Entity.GUID, voiceBundle);
				dictionary.Add(voiceBundle.Entity.GUID, (Object)(object)voiceBundle);
			}
			typeof(LandfallContentDatabase).GetField("m_voiceBundles", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary7);
			List<DatabaseID> list = (List<DatabaseID>)typeof(LandfallContentDatabase).GetField("m_factionIconIds", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (FactionIcon factionIcon in modDatabase.m_factionIcons)
			{
				list.Add(factionIcon.Entity.GUID);
				dictionary.Add(factionIcon.Entity.GUID, (Object)(object)factionIcon);
			}
			typeof(LandfallContentDatabase).GetField("m_factionIconIds", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, list);
		}

		public static void DeactivateBonusUnit(AssetBundle bundle, TerrenModAssetDatabase db, string unitName, string faction)
		{
			UnitBlueprint val = db.m_units.ToList().Find((UnitBlueprint x) => x.Entity.Name == unitName);
			bundle.LoadAsset<Faction>(faction).RemoveUnit(val);
			GameObject[] props = val.m_props;
			for (int i = 0; i < props.Length; i++)
			{
				CharacterItem component = props[i].GetComponent<CharacterItem>();
				if (Object.op_Implicit((Object)(object)component) && component.ShowInEditor)
				{
					component.SetVariable("m_showInEditor", value: false);
				}
			}
			List<WeaponItem> list = new List<WeaponItem>();
			list.Add(val.RightWeapon.GetComponent<WeaponItem>());
			list.Add(val.LeftWeapon.GetComponent<WeaponItem>());
			if (list != null)
			{
				foreach (WeaponItem item in list)
				{
					if (((CharacterItem)item).ShowInEditor)
					{
						item.SetVariable("m_showInEditor", value: false);
					}
				}
			}
			List<SpecialAbility> list2 = new List<SpecialAbility>();
			GameObject[] objectsToSpawnAsChildren = val.objectsToSpawnAsChildren;
			for (int j = 0; j < objectsToSpawnAsChildren.Length; j++)
			{
				SpecialAbility component2 = objectsToSpawnAsChildren[j].GetComponent<SpecialAbility>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					list2.Add(component2);
				}
			}
			foreach (SpecialAbility item2 in list2)
			{
				if (((CharacterItem)item2).ShowInEditor)
				{
					item2.SetVariable("m_showInEditor", value: false);
				}
			}
		}

		public static T GetVariable<T>(this object me, string name)
		{
			Type type = me.GetType();
			FieldInfo field;
			while ((field = type.GetField(name, (BindingFlags)(-1))) == null && (type = type.BaseType) != null)
			{
			}
			object obj = ((field != null) ? field.GetValue(me) : null);
			if (obj is T)
			{
				return (T)obj;
			}
			Debug.LogError((object)("Couldn't find the variable '" + name + "' in '" + typeof(T).Name + "'"));
			return default(T);
		}

		public static T SetVariable<T>(this object me, string name, T value)
		{
			Type type = me.GetType();
			FieldInfo field;
			while ((field = type.GetField(name, (BindingFlags)(-1))) == null && (type = type.BaseType) != null)
			{
			}
			if (field == null)
			{
				Debug.LogError((object)("Couldn't find the variable '" + name + "' in '" + me.GetType().Name + "'"));
				return value;
			}
			try
			{
				field.SetValue(me, value);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Couldn't set the value of '{name}' in '{me.GetType().Name}: {arg}'");
			}
			return value;
		}

		public static SettingsInstance CreateSetting(bool useLocalization, SettingsType type, string key, string name, string tooltip, string category, float defaultValue, float currentValue, string[] options = null, float min = 0f, float max = 1f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0064: Expected O, but got Unknown
			SettingsInstance val = new SettingsInstance
			{
				localizeOptions = useLocalization,
				settingsType = type,
				m_settingsKey = key,
				settingName = name,
				toolTip = tooltip,
				options = options,
				defaultValue = (int)defaultValue,
				currentValue = (int)currentValue,
				defaultSliderValue = defaultValue,
				currentSliderValue = currentValue,
				min = min,
				max = max
			};
			GlobalSettingsHandler service = ServiceLocator.GetService<GlobalSettingsHandler>();
			SettingsInstance[] source = (SettingsInstance[])(object)new SettingsInstance[0];
			switch (category)
			{
			case "BUG":
				source = service.BugsSettings;
				break;
			case "VIDEO":
				source = service.VideoSettings;
				break;
			case "AUDIO":
				source = service.AudioSettings;
				break;
			case "CONTROLS":
				source = service.ControlSettings;
				break;
			case "GAMEPLAY":
				source = service.GameplaySettings;
				break;
			}
			List<SettingsInstance> list = source.ToList();
			list.Add(val);
			if (category == "BUG")
			{
				typeof(GlobalSettingsHandler).GetField("m_bugsSettings", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(service, list.ToArray());
			}
			if (category == "VIDEO")
			{
				typeof(GlobalSettingsHandler).GetField("m_videoSettings", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(service, list.ToArray());
			}
			if (category == "AUDIO")
			{
				typeof(GlobalSettingsHandler).GetField("m_audioSettings", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(service, list.ToArray());
			}
			if (category == "CONTROLS")
			{
				typeof(GlobalSettingsHandler).GetField("m_controlSettings", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(service, list.ToArray());
			}
			if (category == "GAMEPLAY")
			{
				typeof(GlobalSettingsHandler).GetField("m_gameplaySettings", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(service, list.ToArray());
			}
			return val;
		}

		static TerrenModUtilities()
		{
			subFactions = new List<SubFactionEntry>();
		}

		public static void AddSubFactions(TerrenModAssetDatabase db)
		{
			subFactions.AddRange(db.m_subFactions);
		}

		public static void AddLocalization(ModLocalizationCollection languanes)
		{
			Dictionary<Language, Dictionary<string, string>> dictionary = (Dictionary<Language, Dictionary<string, string>>)typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			try
			{
				for (int i = 0; i < languanes.m_english.m_key.Count; i++)
				{
					dictionary[(Language)0].Add(languanes.m_english.m_key[i], languanes.m_english.m_value[i]);
				}
				for (int j = 0; j < languanes.m_russian.m_key.Count; j++)
				{
					dictionary[(Language)6].Add(languanes.m_russian.m_key[j], languanes.m_russian.m_value[j]);
				}
				for (int k = 0; k < languanes.m_chinese.m_key.Count; k++)
				{
					dictionary[(Language)7].Add(languanes.m_chinese.m_key[k], languanes.m_chinese.m_value[k]);
				}
				for (int l = 0; l < languanes.m_french.m_key.Count; l++)
				{
					dictionary[(Language)1].Add(languanes.m_french.m_key[l], languanes.m_french.m_value[l]);
				}
				for (int m = 0; m < languanes.m_spanish.m_key.Count; m++)
				{
					dictionary[(Language)4].Add(languanes.m_spanish.m_key[m], languanes.m_spanish.m_value[m]);
				}
				for (int n = 0; n < languanes.m_japanese.m_key.Count; n++)
				{
					dictionary[(Language)8].Add(languanes.m_japanese.m_key[n], languanes.m_japanese.m_value[n]);
				}
				for (int num = 0; num < languanes.m_deutsch.m_key.Count; num++)
				{
					dictionary[(Language)3].Add(languanes.m_deutsch.m_key[num], languanes.m_deutsch.m_value[num]);
				}
				for (int num2 = 0; num2 < languanes.m_italian.m_key.Count; num2++)
				{
					dictionary[(Language)2].Add(languanes.m_italian.m_key[num2], languanes.m_italian.m_value[num2]);
				}
				for (int num3 = 0; num3 < languanes.m_portuguese.m_key.Count; num3++)
				{
					dictionary[(Language)5].Add(languanes.m_portuguese.m_key[num3], languanes.m_portuguese.m_value[num3]);
				}
			}
			catch
			{
			}
		}

		public static T SetField<T>(this T self, string name, object value) where T : class
		{
			FieldInfo field = typeof(T).GetField(name, (BindingFlags)(-1));
			if (field != null)
			{
				field.SetValue(self, value);
			}
			return self;
		}

		public static void AddTeamColorPalette(UnitEditorColorPalette newdata)
		{
			UnitEditorColorPalette unitEditorColorPalette = ContentDatabase.Instance().LandfallContentDatabase.GetUnitEditorColorPalette();
			List<TeamColorPaletteData> list = unitEditorColorPalette.m_ColorPalleteParentCatagories[1].colorPaletteCatagories[0].TeamColors.ToList();
			list.AddRange(newdata.m_teamColors.ToList());
			unitEditorColorPalette.m_ColorPalleteParentCatagories[1].colorPaletteCatagories[0].TeamColors = Enumerable.ToArray(list);
			unitEditorColorPalette.Initialize();
		}
	}
}
namespace UFoxLib.Classes
{
	public class PreciseCodeAnimation : MonoBehaviour
	{
		public bool useDeltaTime;

		public float speedM = 1f;

		[Header("In")]
		public AnimationCurve curveIn;

		public float delayIn;

		public Quaternion goalRotation;

		public UnityEvent eventIn;

		public UnityEvent eventInEnd;

		[Header("Out")]
		public AnimationCurve curveOut;

		public float delayOut;

		public UnityEvent eventOut;

		public UnityEvent eventOutEnd;

		private Quaternion originalRotation;

		private void Awake()
		{
			//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)
			originalRotation = ((Component)this).transform.localRotation;
		}

		private IEnumerator PlayInCoro()
		{
			yield retu