Decompiled source of Minecraft Village v1.0.7

Village.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Venture_Fearless")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Village")]
[assembly: AssemblyTitle("Village")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Village
{
	[BepInPlugin("Venture_Fearless.Village", "Village", "1.0")]
	public class Village : BaseUnityPlugin
	{
		internal static Village Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}
namespace Minecraft_Village
{
	public class Cheat : MonoBehaviour
	{
		public GameObject initspawn;

		[Space]
		[Space]
		public GameObject CheatBook;

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

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

		public GameObject upgrades;

		private int order = 0;

		private void OnTriggerEnter(Collider col)
		{
			if (order != 3 || !((Object)(object)((Component)col).gameObject.GetComponent<Item_ID>() != (Object)null))
			{
				return;
			}
			switch (((Component)col).gameObject.GetComponent<Item_ID>().id)
			{
			case Item_ID.id_value.Book:
				CheatBook.SetActive(true);
				break;
			case Item_ID.id_value.Redstone:
			{
				for (int j = 0; j < destroy.Count; j++)
				{
					if ((Object)(object)destroy[j] != (Object)null)
					{
						Object.Destroy((Object)(object)destroy[j]);
					}
				}
				break;
			}
			case Item_ID.id_value.Coal:
			{
				for (int k = 0; k < door.Count; k++)
				{
					if ((Object)(object)door[k] != (Object)null)
					{
						Object.Destroy((Object)(object)door[k]);
					}
				}
				break;
			}
			case Item_ID.id_value.Flint:
			{
				for (int i = 0; i < upgrades.transform.childCount; i++)
				{
					((Component)upgrades.transform.GetChild(i)).gameObject.SetActive(true);
				}
				break;
			}
			case Item_ID.id_value.Gold_Ingot:
				RunManager.instance.levelsCompleted = 10000;
				break;
			}
			Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
		}

		private void RemoveChunk()
		{
			Object.Destroy((Object)(object)((Component)((Component)this).transform.parent).gameObject);
		}

		public void Toggle(int value)
		{
			if (value == order + 1)
			{
				order++;
			}
			else
			{
				order -= 10000;
			}
			if (order == 3)
			{
				for (int i = 0; i < initspawn.transform.childCount; i++)
				{
					((Component)initspawn.transform.GetChild(i)).gameObject.SetActive(true);
				}
			}
		}
	}
	public class CheatToggle : MonoBehaviour
	{
		public int order = 1;

		public GameObject cheat;

		private void OnTriggerEnter(Collider col)
		{
			if ((Object)(object)((Component)col).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
			{
				cheat.GetComponent<Cheat>().Toggle(order);
			}
		}
	}
	public class ChunkManager : MonoBehaviour
	{
		public enum level
		{
			lvl1,
			lvl2,
			lvl3
		}

		public level lvl = level.lvl1;

		public bool connected_lvl2 = false;

		public bool connected_lvl3 = false;

		[Space]
		[Space]
		public int redstone_needed = 0;

		public int book_needed = 0;

		public int minecart_needed = 0;

		public int fire_needed = 0;

		[Space]
		[Space]
		public List<GameObject> mine = new List<GameObject>();

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

		[Space]
		[Space]
		public List<GameObject> city = new List<GameObject>();

		public List<GameObject> door_lvl3 = new List<GameObject>();
	}
	public class Crafting : MonoBehaviour
	{
		private List<GameObject> currentCollisions = new List<GameObject>();

		private float delay = 0f;

		private void Update()
		{
			if (delay > 0f)
			{
				delay -= Time.deltaTime;
			}
		}

		private void OnTriggerExit(Collider col)
		{
			currentCollisions.Remove(((Component)col).gameObject);
			if (delay <= 0f)
			{
				Craft();
			}
		}

		private void OnTriggerEnter(Collider col)
		{
			currentCollisions.Add(((Component)col).gameObject);
			if (delay <= 0f)
			{
				Craft();
			}
		}

		private void Craft()
		{
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			foreach (GameObject currentCollision in currentCollisions)
			{
				if ((Object)(object)currentCollision.GetComponent<Item_ID>() != (Object)null)
				{
					switch (currentCollision.GetComponent<Item_ID>().id)
					{
					case Item_ID.id_value.Iron_Ingot:
						num++;
						break;
					case Item_ID.id_value.Redstone:
						num2++;
						break;
					case Item_ID.id_value.Flint:
						num3++;
						break;
					case Item_ID.id_value.Coal:
						num5++;
						break;
					case Item_ID.id_value.Echo_Shard:
						num4++;
						break;
					}
				}
			}
			if (currentCollisions.Count == 2 && num == 1 && num3 == 1)
			{
				ActivateItem(8, ((Component)this).gameObject);
				foreach (GameObject currentCollision2 in currentCollisions)
				{
					Object.Destroy((Object)(object)((Component)currentCollision2.transform.parent.parent).gameObject);
				}
				currentCollisions.Clear();
			}
			if (currentCollisions.Count == 9 && num4 == 8 && num5 == 1)
			{
				ActivateItem(9, ((Component)this).gameObject);
				foreach (GameObject currentCollision3 in currentCollisions)
				{
					Object.Destroy((Object)(object)((Component)currentCollision3.transform.parent.parent).gameObject);
				}
				currentCollisions.Clear();
			}
			if (currentCollisions.Count == 5 && num == 4 && num2 == 1)
			{
				ActivateItem(10, ((Component)this).gameObject);
				foreach (GameObject currentCollision4 in currentCollisions)
				{
					Object.Destroy((Object)(object)((Component)currentCollision4.transform.parent.parent).gameObject);
				}
				currentCollisions.Clear();
			}
			delay = 3f;
		}

		private void ActivateItem(int i, GameObject s)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)this).transform;
			while ((Object)(object)((Component)val).gameObject.GetComponent<ChunkManager>() == (Object)null)
			{
				val = val.parent;
			}
			val = val.parent.GetChild(0).GetChild(9).GetChild(i);
			if (val.childCount > 0)
			{
				GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
				gameObject.SetActive(true);
				gameObject.transform.position = s.transform.position;
				gameObject.transform.rotation = s.transform.rotation;
				gameObject.transform.parent = gameObject.transform.parent.parent;
			}
			else
			{
				Debug.LogError((object)("Crafting Prefab Limit Exceeded: " + i));
			}
		}
	}
	public class Furnace : MonoBehaviour
	{
		private bool turned_on = false;

		private bool smelting = false;

		public Material on;

		public Material off;

		private void Update()
		{
			((Component)((Component)this).gameObject.transform.parent.GetChild(1)).gameObject.SetActive(turned_on);
		}

		private void OnTriggerEnter(Collider col)
		{
			if ((Object)(object)((Component)col).gameObject.GetComponent<Item_ID>() != (Object)null && !smelting)
			{
				if (!turned_on && ((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Coal)
				{
					Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
					turned_on = true;
					UpdateMaterial();
				}
				else if (turned_on && ((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Iron_Ore)
				{
					Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
					smelting = true;
					((MonoBehaviour)this).Invoke("Smelt", 8f);
				}
			}
		}

		private void Smelt()
		{
			ActivateItem(7, ((Component)this).gameObject);
			turned_on = false;
			UpdateMaterial();
			smelting = false;
		}

		private void UpdateMaterial()
		{
			Material[] array = (Material[])(object)new Material[3]
			{
				((Renderer)((Component)((Component)this).gameObject.transform.parent).gameObject.GetComponent<MeshRenderer>()).materials[0],
				default(Material),
				default(Material)
			};
			if (turned_on)
			{
				array[1] = on;
			}
			else
			{
				array[1] = off;
			}
			array[2] = ((Renderer)((Component)((Component)this).gameObject.transform.parent).gameObject.GetComponent<MeshRenderer>()).materials[2];
			((Renderer)((Component)((Component)this).gameObject.transform.parent).gameObject.GetComponent<MeshRenderer>()).materials = array;
		}

		private void ActivateItem(int i, GameObject s)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)this).transform;
			while ((Object)(object)((Component)val).gameObject.GetComponent<ChunkManager>() == (Object)null)
			{
				val = val.parent;
			}
			val = val.parent.GetChild(0).GetChild(9).GetChild(i);
			if (val.childCount > 0)
			{
				GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
				gameObject.SetActive(true);
				gameObject.transform.position = s.transform.position;
				gameObject.transform.rotation = s.transform.rotation;
				gameObject.transform.parent = gameObject.transform.parent.parent;
			}
			else
			{
				Debug.LogError((object)"Furnace Prefab Limit Exceeded");
			}
		}
	}
	public class Item_ID : MonoBehaviour
	{
		public enum id_value
		{
			Redstone,
			Book,
			Minecart,
			Coal,
			Flint,
			Iron_Ore,
			Iron_Ingot,
			Flint_and_Steel,
			Compass,
			Echo_Shard,
			Echo_Compass,
			Gold_Ingot
		}

		public id_value id;
	}
	public class MinecraftManager : MonoBehaviour
	{
		public GameObject em_ore;

		public GameObject em_flint;

		public GameObject em_coal;

		[Space]
		[Space]
		[Space]
		public bool debug = false;

		public float tptime = 210f;

		public float new_tptime = 40f;

		public float short_accept = 40f;

		public float long_accept = 70f;

		public float height_diff_max = 6f;

		public float short_check = 20f;

		public float long_check = 40f;

		private float loadtime = 0f;

		private bool loaded = false;

		private bool open = false;

		private int door_progress = 0;

		private int tpcount = 0;

		private void Update()
		{
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			if (!loaded)
			{
				loadtime += Time.deltaTime;
				if (loadtime > 7f)
				{
					loaded = true;
					Load();
				}
				return;
			}
			TPEnemies();
			int num = 0;
			for (int i = 0; i < ((Component)this).gameObject.transform.GetChild(11).childCount; i++)
			{
				if ((Object)(object)((Component)((Component)this).gameObject.transform.GetChild(11).GetChild(i)).gameObject.GetComponent<RedstoneDevice>() != (Object)null && ((Component)((Component)this).gameObject.transform.GetChild(11).GetChild(i)).gameObject.GetComponent<RedstoneDevice>().GetCurrent())
				{
					num++;
				}
			}
			open = num == 8;
			if (open && door_progress < 100)
			{
				door_progress++;
			}
			else if (!open && door_progress > 0)
			{
				door_progress--;
			}
			if (door_progress > 1 && door_progress < 100)
			{
				((Component)this).gameObject.transform.GetChild(12).position = new Vector3(((Component)this).gameObject.transform.GetChild(12).position.x, -40f + (float)door_progress * 0.1f, ((Component)this).gameObject.transform.GetChild(12).position.z);
			}
		}

		private void OnTriggerEnter(Collider col)
		{
			if (!loaded && (Object)(object)((Component)col).gameObject.GetComponent<PlayerCollisionStand>() != (Object)null)
			{
				loaded = true;
				Load();
			}
		}

		private void Load()
		{
			int num = RunManager.instance.levelsCompleted + 1;
			int num2 = 1;
			if (num >= 4)
			{
				num2 = 2;
			}
			if (num >= 7)
			{
				num2 = 3;
			}
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			bool flag4 = false;
			bool flag5 = false;
			bool flag6 = false;
			bool flag7 = false;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			int num7 = 0;
			int num8 = 5;
			List<GameObject> list = new List<GameObject>();
			List<GameObject> list2 = new List<GameObject>();
			for (int i = 0; i < ((Component)this).gameObject.transform.GetChild(7).childCount; i++)
			{
				list2.Add(((Component)((Component)this).gameObject.transform.GetChild(7).GetChild(i)).gameObject);
				((Component)((Component)this).gameObject.transform.GetChild(7).GetChild(i)).gameObject.SetActive(false);
			}
			List<GameObject> list3 = new List<GameObject>();
			List<GameObject> list4 = new List<GameObject>();
			List<GameObject> list5 = new List<GameObject>();
			List<GameObject> list6 = new List<GameObject>();
			List<GameObject> list7 = new List<GameObject>();
			List<GameObject> list8 = new List<GameObject>();
			List<GameObject> list9 = new List<GameObject>();
			Transform parent = ((Component)this).gameObject.transform.parent;
			for (int j = 0; j < parent.childCount; j++)
			{
				GameObject gameObject = ((Component)parent.GetChild(j)).gameObject;
				if ((Object)(object)gameObject.GetComponent<ChunkManager>() != (Object)null)
				{
					num3 += gameObject.GetComponent<ChunkManager>().redstone_needed;
					num4 += gameObject.GetComponent<ChunkManager>().book_needed;
					num5 += gameObject.GetComponent<ChunkManager>().minecart_needed;
					num6 += gameObject.GetComponent<ChunkManager>().fire_needed;
					if (gameObject.GetComponent<ChunkManager>().connected_lvl2)
					{
						flag3 = true;
					}
					if (gameObject.GetComponent<ChunkManager>().connected_lvl3)
					{
						flag4 = true;
					}
					if (gameObject.GetComponent<ChunkManager>().lvl == ChunkManager.level.lvl2)
					{
						flag = true;
					}
					if (gameObject.GetComponent<ChunkManager>().lvl == ChunkManager.level.lvl3)
					{
						flag2 = true;
					}
				}
				num7 += parent.GetChild(j).GetChild(0).childCount + 7;
				for (int k = 0; k < parent.GetChild(j).GetChild(0).childCount; k++)
				{
					GameObject gameObject2 = ((Component)parent.GetChild(j).GetChild(0).GetChild(k)).gameObject;
					gameObject2.SetActive(false);
					if (!((Object)(object)gameObject2.GetComponent<SpawnLocation>() != (Object)null))
					{
						continue;
					}
					SpawnLocation.found_lvl found = gameObject2.GetComponent<SpawnLocation>().found;
					if (found == SpawnLocation.found_lvl.lvl1 || (found == SpawnLocation.found_lvl.lvl2 && num2 >= 2) || (found == SpawnLocation.found_lvl.lvl3 && num2 >= 3))
					{
						switch (gameObject2.GetComponent<SpawnLocation>().id)
						{
						case SpawnLocation.id_value.Special_Lever:
							list.Add(gameObject2);
							break;
						case SpawnLocation.id_value.Redstone:
							list3.Add(gameObject2);
							break;
						case SpawnLocation.id_value.Book:
							list4.Add(gameObject2);
							break;
						case SpawnLocation.id_value.Minecart:
							list5.Add(gameObject2);
							break;
						case SpawnLocation.id_value.Coal:
							list6.Add(gameObject2);
							break;
						case SpawnLocation.id_value.Flint:
							list7.Add(gameObject2);
							break;
						case SpawnLocation.id_value.Iron_Ore:
							list8.Add(gameObject2);
							break;
						case SpawnLocation.id_value.Echo_Shard:
							list9.Add(gameObject2);
							break;
						}
					}
				}
			}
			num8 = num3 * 53 + num5 * 1117 + num6 * 378 + num4 * 99;
			Log("Planned Spawns: " + num3 + ", " + num5 + ", " + num6 + ", " + num4);
			for (int l = -1; l <= 6; l++)
			{
				List<GameObject> list10 = new List<GameObject>();
				int num9 = 0;
				switch (l)
				{
				case 0:
					list10 = list3;
					num9 = num3;
					break;
				case 1:
					list10 = list4;
					num9 = num4;
					break;
				case 2:
					list10 = list5;
					num9 = num5;
					if (num9 > 2)
					{
						num9 = 2;
					}
					break;
				case 3:
					list10 = list6;
					num9 = num6;
					break;
				case 4:
					list10 = list7;
					num9 = num6;
					break;
				case 5:
					list10 = list8;
					num9 = num6;
					break;
				case 6:
					list10 = list9;
					if (num2 >= 3)
					{
						num9 = 8;
					}
					break;
				}
				if (l == -1)
				{
					if (num2 >= 3)
					{
						if (list.Count >= 7)
						{
							while (list.Count > 7)
							{
								int index = num8 % list.Count;
								num8 += 1902;
								list[index].SetActive(false);
								list.RemoveAt(index);
							}
						}
					}
					else
					{
						while (list.Count > 0)
						{
							list[list.Count - 1].SetActive(false);
							list.RemoveAt(list.Count - 1);
						}
					}
					continue;
				}
				if (list10.Count < num9)
				{
					if (l != 2)
					{
						for (int m = 0; m < num9 - list10.Count; m++)
						{
							if (list2.Count <= 0)
							{
								break;
							}
							int index2 = num8 % list2.Count;
							num8 += 989;
							ActivateItem(l, list2[index2]);
							list2.RemoveAt(index2);
						}
					}
					num9 = list10.Count;
				}
				for (int n = 0; n < num9; n++)
				{
					int index3 = num8 % list10.Count;
					num8 += 1001;
					ActivateItem(l, list10[index3]);
					if (l == 3 && list10[index3].GetComponent<SpawnLocation>().found != SpawnLocation.found_lvl.lvl3)
					{
						flag7 = true;
					}
					if (l == 4 && list10[index3].GetComponent<SpawnLocation>().found != SpawnLocation.found_lvl.lvl3)
					{
						flag5 = true;
					}
					if (l == 5 && list10[index3].GetComponent<SpawnLocation>().found != SpawnLocation.found_lvl.lvl3)
					{
						flag6 = true;
					}
					list10.RemoveAt(index3);
				}
			}
			bool flag8 = num2 >= 2 && flag;
			bool flag9 = num2 >= 3 && flag2;
			bool flag10 = flag9 && !flag4;
			if (!flag10 || flag7)
			{
				em_coal.SetActive(false);
			}
			if (!flag10 || flag5)
			{
				em_flint.SetActive(false);
			}
			if (!flag10 || flag6)
			{
				em_ore.SetActive(false);
			}
			if (flag8)
			{
				Object.Destroy((Object)(object)((Component)((Component)this).gameObject.transform.GetChild(5)).gameObject);
			}
			if (flag9)
			{
				Object.Destroy((Object)(object)((Component)((Component)this).gameObject.transform.GetChild(6)).gameObject);
			}
			if (num2 >= 3)
			{
				Object.Destroy((Object)(object)((Component)((Component)this).gameObject.transform.GetChild(13)).gameObject);
				for (int num10 = 0; num10 < ((Component)this).transform.GetChild(4).childCount; num10++)
				{
					((Component)((Component)this).transform.GetChild(4).GetChild(num10)).gameObject.SetActive(true);
				}
			}
			if (flag8 && num2 >= 2)
			{
				for (int num11 = 0; num11 < ((Component)this).transform.GetChild(10).childCount; num11++)
				{
					((Component)((Component)this).transform.GetChild(10).GetChild(num11)).gameObject.SetActive(true);
				}
			}
			ManageLowerLevels(num2);
		}

		private void ActivateItem(int i, GameObject s)
		{
			//IL_0067: 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)
			Transform val = ((Component)this).transform;
			while ((Object)(object)((Component)val).gameObject.GetComponent<ChunkManager>() == (Object)null)
			{
				val = val.parent;
			}
			val = val.parent.GetChild(0).GetChild(9).GetChild(i);
			if (val.childCount > 0)
			{
				GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
				gameObject.transform.Translate(s.transform.position);
				gameObject.transform.rotation = s.transform.rotation;
				gameObject.transform.parent = gameObject.transform.parent.parent;
				gameObject.SetActive(true);
			}
			else
			{
				Log("Spawn Prefab Limit Exceeded: " + i);
			}
		}

		private void ManageLowerLevels(int stage)
		{
			List<LevelPoint> levelPathPoints = ((Component)((Component)this).transform.parent.parent.GetChild(0)).gameObject.GetComponent<LevelGenerator>().LevelPathPoints;
			Log("LoadPoints start:" + levelPathPoints.Count);
			List<LevelPoint> list = new List<LevelPoint>();
			List<LevelPoint> list2 = new List<LevelPoint>();
			if (stage < 2)
			{
				for (int i = 0; i < ((Component)this).transform.parent.childCount; i++)
				{
					if (((Component)this).transform.parent.GetChild(i).childCount <= 2 || ((Component)this).transform.parent.GetChild(i).GetChild(2).childCount <= 0)
					{
						continue;
					}
					if (((Component)this).transform.parent.GetChild(i).GetChild(2).GetChild(0)
						.childCount > 1)
					{
						Transform child = ((Component)this).transform.parent.GetChild(i).GetChild(2).GetChild(0);
						for (int j = 0; j < child.GetChild(0).childCount; j++)
						{
							if ((Object)(object)((Component)child.GetChild(0).GetChild(j)).GetComponent<LevelPoint>() != (Object)null)
							{
								list.Add(((Component)child.GetChild(0).GetChild(j)).GetComponent<LevelPoint>());
							}
						}
						for (int k = 0; k < child.GetChild(1).childCount; k++)
						{
							if ((Object)(object)((Component)child.GetChild(1).GetChild(k)).GetComponent<LevelPoint>() != (Object)null)
							{
								list.Add(((Component)child.GetChild(1).GetChild(k)).GetComponent<LevelPoint>());
							}
						}
					}
					else
					{
						Log("DID NOT Get Module PointTree");
					}
				}
				Log("L2 LevelPoints found:" + list.Count);
				for (int l = 0; l < levelPathPoints.Count; l++)
				{
					LevelPoint val = levelPathPoints[l];
					for (int num = val.ConnectedPoints.Count - 1; num >= 0; num--)
					{
						for (int m = 0; m < list.Count; m++)
						{
							if ((Object)(object)val.ConnectedPoints[num] == (Object)(object)list[m])
							{
								levelPathPoints.RemoveAt(num);
							}
						}
					}
				}
				Log("LevelPoints after culling:" + levelPathPoints.Count);
			}
			Transform parent = ((Component)this).gameObject.transform.parent;
			for (int n = 0; n < parent.childCount; n++)
			{
				GameObject gameObject = ((Component)parent.GetChild(n)).gameObject;
				if (!((Object)(object)gameObject.GetComponent<ChunkManager>() != (Object)null))
				{
					continue;
				}
				if (stage >= 2)
				{
					for (int num2 = 0; num2 < gameObject.GetComponent<ChunkManager>().door_lvl2.Count; num2++)
					{
						Object.Destroy((Object)(object)gameObject.GetComponent<ChunkManager>().door_lvl2[num2]);
					}
				}
				else
				{
					for (int num3 = 0; num3 < gameObject.GetComponent<ChunkManager>().mine.Count; num3++)
					{
						gameObject.GetComponent<ChunkManager>().mine[num3].SetActive(false);
					}
				}
				if (stage >= 3)
				{
					for (int num4 = 0; num4 < gameObject.GetComponent<ChunkManager>().door_lvl3.Count; num4++)
					{
						Object.Destroy((Object)(object)gameObject.GetComponent<ChunkManager>().door_lvl3[num4]);
					}
				}
				else
				{
					for (int num5 = 0; num5 < gameObject.GetComponent<ChunkManager>().city.Count; num5++)
					{
						gameObject.GetComponent<ChunkManager>().city[num5].SetActive(false);
					}
				}
			}
		}

		private void TPEnemies()
		{
			//IL_01f0: 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_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: 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_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			tptime -= Time.deltaTime;
			if (!(tptime < 0f))
			{
				return;
			}
			Log("TP Check Start");
			tptime = new_tptime;
			List<Transform> list = new List<Transform>();
			List<Transform> list2 = new List<Transform>();
			List<GameObject> list3 = new List<GameObject>();
			for (int i = 0; i < GameDirector.instance.PlayerList.Count; i++)
			{
				list2.Add(((Component)GameDirector.instance.PlayerList[i]).transform);
			}
			for (int j = 0; j < ((Component)this).gameObject.transform.parent.parent.GetChild(3).childCount; j++)
			{
				GameObject gameObject = ((Component)((Component)this).gameObject.transform.parent.parent.GetChild(3).GetChild(j)).gameObject;
				if ((Object)(object)gameObject.GetComponentInChildren<EnemyCeilingEye>() == (Object)null && (Object)(object)gameObject.GetComponentInChildren<Enemy>() != (Object)null)
				{
					list3.Add(((Component)gameObject.GetComponentInChildren<Enemy>()).gameObject);
				}
			}
			Log("Enemies Count:" + list3.Count);
			Log("Players Count:" + list2.Count);
			List<LevelPoint> levelPathPoints = ((Component)((Component)this).transform.parent.parent.GetChild(0)).gameObject.GetComponent<LevelGenerator>().LevelPathPoints;
			Log("Pointlist size:" + levelPathPoints.Count);
			for (int k = 0; k < levelPathPoints.Count; k++)
			{
				bool flag = false;
				for (int l = 0; l < list2.Count; l++)
				{
					if (flag)
					{
						break;
					}
					if (short_accept < Vector3.Distance(((Component)levelPathPoints[k]).transform.position, list2[l].position) && Vector3.Distance(((Component)levelPathPoints[k]).transform.position, list2[l].position) < long_accept && Mathf.Abs(((Component)levelPathPoints[k]).transform.position.y - list2[l].position.y) < height_diff_max)
					{
						flag = true;
					}
				}
				if (flag)
				{
					list.Add(((Component)levelPathPoints[k]).transform);
				}
			}
			Log("Pointlist after selection:" + list.Count);
			for (int m = 0; m < list3.Count; m++)
			{
				bool flag2 = true;
				for (int n = 0; n < list2.Count && flag2; n++)
				{
					if (Vector3.Distance(list3[m].transform.position, list2[n].position) < short_check)
					{
						flag2 = false;
					}
					if (!flag2)
					{
						Log("Enemy: " + m + " to Player: " + n + "Spared by short distance check");
					}
					if (flag2)
					{
						if (Mathf.Abs(list3[m].transform.position.y - list2[n].position.y) < height_diff_max && Vector3.Distance(list3[m].transform.position, list2[n].position) < long_check)
						{
							flag2 = false;
						}
						if (!flag2)
						{
							Log("Enemy: " + m + " to Player: " + n + "Spared by long distance and y-level check");
						}
					}
				}
				if (flag2 && list.Count > 0)
				{
					tpcount++;
					Log("Selected for Teleport: enemy " + m);
					Transform val = list[(int)((double)((float)list.Count * 0.232f * (float)tpcount) + (double)list.Count * 0.673) % list.Count];
					Vector3 position = val.position;
					Log("Attempted teleport to " + ((object)(Vector3)(ref position)).ToString());
					list3[m].GetComponent<Enemy>().EnemyTeleported(val.position);
				}
			}
		}

		private void Log(string s)
		{
			if (debug)
			{
				Debug.Log((object)s);
			}
		}
	}
	public class Piston : MonoBehaviour
	{
		public List<GameObject> input = new List<GameObject>();

		[Space]
		[Space]
		public List<GameObject> target = new List<GameObject>();

		private bool current = false;

		private void Start()
		{
			for (int i = 0; i < target.Count; i++)
			{
				target[i].SetActive(!current);
			}
		}

		public void Tick()
		{
			bool flag = true;
			for (int i = 0; i < input.Count; i++)
			{
				if ((Object)(object)input[i].GetComponent<PowerSource>() != (Object)null && !input[i].GetComponent<PowerSource>().GetCurrent())
				{
					flag = false;
				}
				if ((Object)(object)input[i].GetComponent<Redstone>() != (Object)null && !input[i].GetComponent<Redstone>().GetCurrent())
				{
					flag = false;
				}
			}
			if (flag != current)
			{
				current = flag;
				((Component)this).GetComponent<AudioSource>().Play();
				for (int j = 0; j < target.Count; j++)
				{
					target[j].SetActive(!current);
				}
			}
		}
	}
	public class PowerSource : MonoBehaviour
	{
		public enum type_value
		{
			Redstone_Torch,
			Lever,
			Lectern,
			Wooden_Pressure_Plate,
			Stone_Pressure_Plate,
			Activator_Rail,
			Special_Lever
		}

		public type_value type = type_value.Redstone_Torch;

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

		private bool current = false;

		private int value = 0;

		private void Start()
		{
			if (type == type_value.Redstone_Torch)
			{
				Switch(b: true);
			}
		}

		private void Update()
		{
			if (type == type_value.Lever)
			{
				((Component)((Component)this).gameObject.transform.GetChild(1)).gameObject.GetComponent<Rigidbody>().useGravity = false;
			}
		}

		private void OnTriggerEnter(Collider c)
		{
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			if (type == type_value.Activator_Rail && (Object)(object)((Component)c).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)c).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Minecart)
			{
				Switch(b: true);
				((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
				((Component)((Component)this).transform.GetChild(1)).gameObject.SetActive(true);
				((Component)((Component)this).transform.GetChild(2)).gameObject.SetActive(true);
			}
			if (type == type_value.Wooden_Pressure_Plate)
			{
				int num = value;
				if ((Object)(object)((Component)c).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
				{
					num++;
				}
				if ((Object)(object)((Component)c).gameObject.GetComponent<PhysGrabObjectCollider>() != (Object)null)
				{
					num++;
				}
				if (num != value)
				{
					if (value == 0)
					{
						Switch(b: true);
						((Component)this).GetComponent<AudioSource>().Play();
						((Component)this).transform.GetChild(0).position = new Vector3(((Component)this).transform.GetChild(0).position.x, ((Component)this).transform.GetChild(0).position.y - 0.05f, ((Component)this).transform.GetChild(0).position.z);
					}
					value = num;
				}
			}
			if (type == type_value.Stone_Pressure_Plate)
			{
				int num2 = value;
				if ((Object)(object)((Component)c).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
				{
					num2++;
				}
				if (num2 != value)
				{
					if (value == 0)
					{
						Switch(b: true);
						((Component)this).GetComponent<AudioSource>().Play();
						((Component)this).transform.GetChild(0).position = new Vector3(((Component)this).transform.GetChild(0).position.x, ((Component)this).transform.GetChild(0).position.y - 0.05f, ((Component)this).transform.GetChild(0).position.z);
					}
					value = num2;
				}
			}
			if (type == type_value.Lever && ((Object)((Component)c).gameObject).name.Equals("Handle"))
			{
				Switch(b: true);
			}
			if (type == type_value.Lectern && !current && (Object)(object)((Component)c).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)c).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Book)
			{
				Object.Destroy((Object)(object)((Component)((Component)c).transform.parent.parent).gameObject);
				((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.SetActive(true);
				Switch(b: true);
			}
		}

		private void OnTriggerExit(Collider c)
		{
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			if (type == type_value.Activator_Rail && (Object)(object)((Component)c).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)c).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Minecart)
			{
				Switch(b: false);
				((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true);
				((Component)((Component)this).transform.GetChild(1)).gameObject.SetActive(false);
				((Component)((Component)this).transform.GetChild(2)).gameObject.SetActive(false);
			}
			if (type == type_value.Wooden_Pressure_Plate)
			{
				int num = value;
				if ((Object)(object)((Component)c).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
				{
					num--;
				}
				if ((Object)(object)((Component)c).gameObject.GetComponent<PhysGrabObjectCollider>() != (Object)null)
				{
					num--;
				}
				if (num != value)
				{
					if (num == 0)
					{
						Switch(b: false);
						((Component)this).GetComponent<AudioSource>().Play();
						((Component)this).transform.GetChild(0).position = new Vector3(((Component)this).transform.GetChild(0).position.x, ((Component)this).transform.GetChild(0).position.y + 0.05f, ((Component)this).transform.GetChild(0).position.z);
					}
					value = num;
				}
			}
			if (type == type_value.Stone_Pressure_Plate)
			{
				int num2 = value;
				if ((Object)(object)((Component)c).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
				{
					num2--;
				}
				if (num2 != value)
				{
					if (num2 == 0)
					{
						Switch(b: false);
						((Component)this).GetComponent<AudioSource>().Play();
						((Component)this).transform.GetChild(0).position = new Vector3(((Component)this).transform.GetChild(0).position.x, ((Component)this).transform.GetChild(0).position.y + 0.05f, ((Component)this).transform.GetChild(0).position.z);
					}
					value = num2;
				}
			}
			if (type == type_value.Lever && ((Object)((Component)c).gameObject).name.Equals("Handle"))
			{
				Switch(b: false);
			}
		}

		public bool GetCurrent()
		{
			return current;
		}

		private void Switch(bool b)
		{
			current = b;
			for (int i = 0; i < output.Count; i++)
			{
				if ((Object)(object)output[i].GetComponent<RedstoneDevice>() != (Object)null)
				{
					output[i].GetComponent<RedstoneDevice>().Tick();
				}
				if ((Object)(object)output[i].GetComponent<Redstone>() != (Object)null)
				{
					output[i].GetComponent<Redstone>().Tick();
				}
				if ((Object)(object)output[i].GetComponent<TNT>() != (Object)null)
				{
					output[i].GetComponent<TNT>().Activate();
				}
				if ((Object)(object)output[i].GetComponent<Piston>() != (Object)null)
				{
					output[i].GetComponent<Piston>().Tick();
				}
			}
		}
	}
	public class Redstone : MonoBehaviour
	{
		public enum logic_value
		{
			OR_GATE,
			AND_GATE
		}

		public logic_value logic = logic_value.OR_GATE;

		public bool active = true;

		[Space]
		[Space]
		public List<GameObject> input = new List<GameObject>();

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

		[Space]
		[Space]
		public Material off;

		[Space]
		[Space]
		public Material on;

		private bool current = false;

		private void Start()
		{
			if (!active)
			{
				((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.SetActive(false);
				((Component)((Component)this).gameObject.transform.GetChild(2)).gameObject.SetActive(true);
			}
		}

		private void OnTriggerEnter(Collider col)
		{
			if (!active && (Object)(object)((Component)col).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Redstone)
			{
				Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
				((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.SetActive(true);
				((Component)((Component)this).gameObject.transform.GetChild(2)).gameObject.SetActive(false);
				active = true;
				Tick();
			}
		}

		public bool GetCurrent()
		{
			return current;
		}

		public void Tick()
		{
			bool flag = true;
			if (logic == logic_value.OR_GATE)
			{
				flag = false;
				for (int i = 0; i < input.Count; i++)
				{
					if ((Object)(object)input[i].GetComponent<PowerSource>() != (Object)null && input[i].GetComponent<PowerSource>().GetCurrent())
					{
						flag = true;
					}
					if ((Object)(object)input[i].GetComponent<Redstone>() != (Object)null && input[i].GetComponent<Redstone>().GetCurrent())
					{
						flag = true;
					}
				}
			}
			if (logic == logic_value.AND_GATE)
			{
				flag = true;
				for (int j = 0; j < input.Count; j++)
				{
					if ((Object)(object)input[j].GetComponent<PowerSource>() != (Object)null && !input[j].GetComponent<PowerSource>().GetCurrent())
					{
						flag = false;
					}
					if ((Object)(object)input[j].GetComponent<Redstone>() != (Object)null && !input[j].GetComponent<Redstone>().GetCurrent())
					{
						flag = false;
					}
				}
			}
			if (!active || flag == current)
			{
				return;
			}
			current = flag;
			Material material = off;
			if (current)
			{
				material = on;
			}
			((Renderer)((Component)((Component)this).gameObject.transform.GetChild(0)).GetComponent<MeshRenderer>()).material = material;
			((Component)((Component)this).gameObject.transform.GetChild(1)).gameObject.SetActive(current);
			for (int k = 0; k < output.Count; k++)
			{
				if ((Object)(object)output[k].GetComponent<RedstoneDevice>() != (Object)null)
				{
					output[k].GetComponent<RedstoneDevice>().Tick();
				}
				if ((Object)(object)output[k].GetComponent<Redstone>() != (Object)null)
				{
					output[k].GetComponent<Redstone>().Tick();
				}
				if ((Object)(object)output[k].GetComponent<TNT>() != (Object)null)
				{
					output[k].GetComponent<TNT>().Activate();
				}
				if ((Object)(object)output[k].GetComponent<Piston>() != (Object)null)
				{
					output[k].GetComponent<Piston>().Tick();
				}
			}
		}
	}
	public class RedstoneDevice : MonoBehaviour
	{
		public enum type_value
		{
			Iron_Door,
			Redstone_Lamp,
			Piston,
			Dispenser
		}

		public type_value type;

		private bool current = false;

		[Space]
		[Space]
		public List<GameObject> input = new List<GameObject>();

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

		public bool GetCurrent()
		{
			return current;
		}

		public void Tick()
		{
			bool flag = false;
			for (int i = 0; i < input.Count; i++)
			{
				if ((Object)(object)input[i].GetComponent<PowerSource>() != (Object)null && input[i].GetComponent<PowerSource>().GetCurrent())
				{
					flag = true;
				}
				if ((Object)(object)input[i].GetComponent<Redstone>() != (Object)null && input[i].GetComponent<Redstone>().GetCurrent())
				{
					flag = true;
				}
			}
			if (flag == current)
			{
				return;
			}
			current = flag;
			if (type == type_value.Iron_Door)
			{
				if (current)
				{
					((Component)this).transform.Rotate(0f, 0f, -90f, (Space)1);
				}
				else
				{
					((Component)this).transform.Rotate(0f, 0f, 90f, (Space)1);
				}
				((Component)this).GetComponent<AudioSource>().Play();
			}
			if (type == type_value.Piston)
			{
				for (int j = 0; j < targets.Count; j++)
				{
					targets[j].SetActive(!current);
				}
				((Component)this).GetComponent<AudioSource>().Play();
			}
		}
	}
	public class SetInvisible : MonoBehaviour
	{
		public void Start()
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
	public class SpawnLocation : MonoBehaviour
	{
		public enum id_value
		{
			Special_Lever = -1,
			Redstone,
			Book,
			Minecart,
			Coal,
			Flint,
			Iron_Ore,
			Iron_Ingot,
			Echo_Shard
		}

		public enum found_lvl
		{
			lvl1 = 1,
			lvl2,
			lvl3
		}

		public id_value id = id_value.Redstone;

		public found_lvl found = found_lvl.lvl1;
	}
	public class Test : MonoBehaviour
	{
		public enum id_value
		{
			Default
		}

		public int id;
	}
	public class TNT : MonoBehaviour
	{
		public List<GameObject> target = new List<GameObject>();

		private float charge = -1f;

		private void Update()
		{
			if (charge < -4f && charge > -10f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				charge = -20f;
				for (int i = 0; i < 5; i++)
				{
					((Component)((Component)this).gameObject.transform.GetChild(i)).gameObject.SetActive(false);
				}
			}
			else if (charge < -2f)
			{
				charge = -5f;
			}
			if (!(charge >= 0f))
			{
				return;
			}
			charge += Time.deltaTime;
			bool flag = charge % 1f < 0.5f;
			((Component)((Component)this).gameObject.transform.GetChild(3)).gameObject.SetActive(flag);
			((Component)((Component)this).gameObject.transform.GetChild(2)).gameObject.SetActive(!flag);
			if (charge >= 4.7f)
			{
				charge = -3f;
				((Component)((Component)this).gameObject.transform.GetChild(4)).gameObject.SetActive(true);
				((Component)((Component)this).gameObject.transform.GetChild(3)).gameObject.SetActive(false);
				((Component)((Component)this).gameObject.transform.GetChild(2)).gameObject.SetActive(false);
				((Component)((Component)this).gameObject.transform.GetChild(1)).gameObject.SetActive(false);
				for (int j = 0; j < target.Count; j++)
				{
					Object.Destroy((Object)(object)target[j]);
				}
			}
		}

		private void OnTriggerEnter(Collider c)
		{
			if ((int)charge == -1 && (Object)(object)((Component)c).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)c).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Flint_and_Steel)
			{
				Object.Destroy((Object)(object)((Component)((Component)c).transform.parent.parent).gameObject);
				Activate();
			}
		}

		public void Activate()
		{
			if ((int)charge == -1)
			{
				((Component)this).GetComponent<AudioSource>().Play();
				((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
				((Component)((Component)this).transform.GetChild(1)).gameObject.SetActive(true);
				charge = 0f;
			}
		}
	}
}