Decompiled source of EnemySpawn v1.0.2

REPO_SpawnEnemy.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("REPO_SpawnEnemy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("微软中国")]
[assembly: AssemblyProduct("REPO_SpawnEnemy")]
[assembly: AssemblyCopyright("Copyright © 微软中国 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c038dc80-bc91-45d6-b69e-9249855b8806")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace REPO_SpawnEnemy;

[BepInPlugin("com.XiaohaiMod.REPO.SpawnEnemy", "SpawnEnemy", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	internal static ManualLogSource logger;

	public void Awake()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		logger = ((BaseUnityPlugin)this).Logger;
		logger.LogInfo((object)"SpawnEnemy插件加载成功!");
		new Harmony("XiaohaiMod.REPO.SpawnEnemy").PatchAll();
	}
}
public class Patch
{
	[HarmonyPatch(typeof(PlayerController))]
	public static class StatsManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		public static void UpdataPatch(PlayerController __instance)
		{
			if (SpawnEnemyGUI.isDebugMode)
			{
				__instance.EnergyCurrent = 1000f;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		public static void AwakePatch()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if ((Object)(object)Object.FindObjectOfType<SpawnEnemyGUI>() == (Object)null)
			{
				GameObject val = new GameObject("SpawnEnemyGUI");
				val.SetActive(true);
				val.AddComponent<SpawnEnemyGUI>();
			}
		}
	}
}
public class SpawnEnemyGUI : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <UpdateEnemiesCoroutine>d__14 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public float interval;

		public SpawnEnemyGUI <>4__this;

		private PlayerController[] <players>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <UpdateEnemiesCoroutine>d__14(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<players>5__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				if (!((Object)(object)LevelGenerator.Instance == (Object)null))
				{
					<players>5__1 = Object.FindObjectsOfType<PlayerController>();
					<>4__this.localPlayer = ((IEnumerable<PlayerController>)<players>5__1).FirstOrDefault((Func<PlayerController, bool>)((PlayerController p) => (Object)(object)p.cameraGameObjectLocal != (Object)null && ((Behaviour)p).isActiveAndEnabled));
					if (!((Object)(object)<>4__this.localPlayer == (Object)null))
					{
						<>4__this.cachedEnemies = Object.FindObjectsOfType<EnemyHealth>().ToList();
						<>4__this.debugText = "可以正常使用了,编号每把都不一样哦,have fun!";
						<players>5__1 = null;
					}
				}
				break;
			}
			<>2__current = (object)new WaitForSeconds(interval);
			<>1__state = 1;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private GUIStyle customLabelStyle;

	private GUIStyle customButtonStyle;

	private GUIStyle customTextFieldStyle;

	private int fontSize = 12;

	private bool ShowGUI = false;

	private Vector2 enemyScrollPosition = Vector2.zero;

	private string textFieldValue = "";

	private bool isInitialized = false;

	private string debugText = "等待游戏进行...waiting for start game...";

	public static bool isDebugMode;

	private Rect windowRect = new Rect((float)(Screen.width - 610), 10f, 600f, 464f);

	private List<EnemyHealth> cachedEnemies = new List<EnemyHealth>();

	private PlayerController localPlayer;

	private bool SpwanRandomPos = false;

	private int selected = 0;

	[IteratorStateMachine(typeof(<UpdateEnemiesCoroutine>d__14))]
	private IEnumerator UpdateEnemiesCoroutine(float interval)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <UpdateEnemiesCoroutine>d__14(0)
		{
			<>4__this = this,
			interval = interval
		};
	}

	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(UpdateEnemiesCoroutine(0.5f));
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)277))
		{
			ShowGUI = !ShowGUI;
		}
	}

	private void OnGUI()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		if (!isInitialized)
		{
			InitializeGUIStyles();
			isInitialized = true;
		}
		if (ShowGUI)
		{
			windowRect = GUI.Window(1, windowRect, new WindowFunction(WindowsFunc), "");
		}
	}

	private void InitializeGUIStyles()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		customLabelStyle = new GUIStyle(GUI.skin.label);
		customLabelStyle.fontSize = fontSize;
		customButtonStyle = new GUIStyle(GUI.skin.button);
		customButtonStyle.fontSize = fontSize;
		customTextFieldStyle = new GUIStyle(GUI.skin.textField);
		customTextFieldStyle.fontSize = fontSize;
	}

	private void WindowsFunc(int id)
	{
		//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_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		//IL_005b: 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)
		GUIStyle val = new GUIStyle(GUI.skin.label)
		{
			alignment = (TextAnchor)4,
			fontSize = fontSize + 2,
			fontStyle = (FontStyle)1
		};
		val.normal.textColor = Color.yellow;
		GUIStyle val2 = val;
		GUI.Label(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 25f), "怪物生成SpawnEnemy V1.0.1 by傀鹏(KuiPeng)&小海(Xiaohai)", val2);
		GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 25f));
		GUILayout.Space(10f);
		selected = GUILayout.SelectionGrid(selected, new string[3] { "中文菜单", "ENG Menu", "说明/Info" }, 3, Array.Empty<GUILayoutOption>());
		customLabelStyle.fontSize = fontSize;
		customButtonStyle.fontSize = fontSize;
		customTextFieldStyle.fontSize = fontSize;
		if (GameManager.instance.gameMode == 1 && !PhotonNetwork.IsMasterClient)
		{
			GUILayout.Label("仅主机可用!", customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			return;
		}
		switch (selected)
		{
		case 0:
			WindowsFunc_CN();
			break;
		case 1:
			WindowsFunc_ENG();
			break;
		case 2:
			WindowsFunc_ENEMY();
			break;
		}
	}

	private void WindowsFunc_CN()
	{
		//IL_0080: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("怪物名", customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
		GUILayout.Label("HP", customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
		GUILayout.Label("操作", customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
		GUILayout.EndHorizontal();
		enemyScrollPosition = GUILayout.BeginScrollView(enemyScrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
		{
			GUILayout.Width(500f),
			GUILayout.Height(200f)
		});
		if (cachedEnemies != null && cachedEnemies.Count > 0)
		{
			foreach (EnemyHealth cachedEnemy in cachedEnemies)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(cachedEnemy.enemy.EnemyParent.enemyName, customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
				GUILayout.Label(cachedEnemy.healthCurrent + "/" + cachedEnemy.health, customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
				if (GUILayout.Button("死", customButtonStyle, Array.Empty<GUILayoutOption>()))
				{
					cachedEnemy.Hurt(cachedEnemy.healthCurrent, cachedEnemy.enemy.CenterTransform.forward);
				}
				if (GUILayout.Button("来", customButtonStyle, Array.Empty<GUILayoutOption>()))
				{
					cachedEnemy.enemy.EnemyTeleported(((Component)Camera.main).transform.position + ((Component)Camera.main).transform.forward * 2f);
				}
				GUILayout.EndHorizontal();
			}
		}
		GUILayout.EndScrollView();
		GUILayout.Space(10f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("输入怪物编号:", customLabelStyle, Array.Empty<GUILayoutOption>());
		textFieldValue = GUILayout.TextField(textFieldValue, customTextFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
		{
			GUILayout.Width(200f),
			GUILayout.Height(30f)
		});
		SpwanRandomPos = GUILayout.Toggle(SpwanRandomPos, "√:面前生成 ×:随机位置", Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("生成敌人", customButtonStyle, Array.Empty<GUILayoutOption>()))
		{
			if (!int.TryParse(textFieldValue, out var result))
			{
				debugText = "输入内容不是有效的整数!自动提交0!";
				result = 0;
			}
			TrySpawnEnemy(result);
			if (!isDebugMode)
			{
				DebugMode();
			}
		}
		GUILayout.EndHorizontal();
		GUILayout.Space(10f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("字体大小+", customButtonStyle, Array.Empty<GUILayoutOption>()))
		{
			fontSize += 2;
		}
		if (GUILayout.Button("字体大小-", customButtonStyle, Array.Empty<GUILayoutOption>()))
		{
			fontSize -= 2;
			if (fontSize <= 0)
			{
				fontSize = 1;
				debugText = "无法再缩小字体大小";
			}
		}
		if (GUILayout.Button(isDebugMode ? "关闭调试模式" : "打开调试模式", customButtonStyle, Array.Empty<GUILayoutOption>()))
		{
			isDebugMode = !isDebugMode;
			DebugMode();
		}
		GUILayout.EndHorizontal();
		GUILayout.Space(10f);
		if ((Object)(object)localPlayer != (Object)null)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("力量+", customButtonStyle, Array.Empty<GUILayoutOption>()))
			{
				PhysGrabber physGrabber = localPlayer.playerAvatarScript.physGrabber;
				physGrabber.grabStrength += 0.1f;
				localPlayer.playerAvatarScript.physGrabber.grabStrength = (float)Math.Round(localPlayer.playerAvatarScript.physGrabber.grabStrength, 2);
			}
			if (GUILayout.Button("力量-", customButtonStyle, Array.Empty<GUILayoutOption>()))
			{
				PhysGrabber physGrabber2 = localPlayer.playerAvatarScript.physGrabber;
				physGrabber2.grabStrength -= 0.1f;
				localPlayer.playerAvatarScript.physGrabber.grabStrength = (float)Math.Round(localPlayer.playerAvatarScript.physGrabber.grabStrength, 2);
			}
			GUILayout.Label("当前力量:" + localPlayer.playerAvatarScript.physGrabber.grabStrength + " (默认为1,升一级+0.2)", customLabelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
		}
		GUILayout.Space(30f);
		GUILayout.Label("提示" + debugText, customLabelStyle, Array.Empty<GUILayoutOption>());
	}

	private void WindowsFunc_ENG()
	{
		//IL_0080: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("Name", customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
		GUILayout.Label("HP", customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
		GUILayout.Label("Func", customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
		GUILayout.EndHorizontal();
		enemyScrollPosition = GUILayout.BeginScrollView(enemyScrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
		{
			GUILayout.Width(500f),
			GUILayout.Height(200f)
		});
		if (cachedEnemies.Count > 0 && cachedEnemies != null)
		{
			foreach (EnemyHealth cachedEnemy in cachedEnemies)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(cachedEnemy.enemy.EnemyParent.enemyName, customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
				GUILayout.Label(cachedEnemy.healthCurrent + "/" + cachedEnemy.health, customLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
				if (GUILayout.Button("Kill", customButtonStyle, Array.Empty<GUILayoutOption>()))
				{
					cachedEnemy.Hurt(cachedEnemy.healthCurrent, cachedEnemy.enemy.CenterTransform.forward);
				}
				if (GUILayout.Button("TP here", customButtonStyle, Array.Empty<GUILayoutOption>()))
				{
					cachedEnemy.enemy.EnemyTeleported(((Component)Camera.main).transform.position + ((Component)Camera.main).transform.forward * 2f);
				}
				GUILayout.EndHorizontal();
			}
		}
		GUILayout.EndScrollView();
		GUILayout.Space(10f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("Enter the enemy number:", customLabelStyle, Array.Empty<GUILayoutOption>());
		textFieldValue = GUILayout.TextField(textFieldValue, customTextFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
		{
			GUILayout.Width(200f),
			GUILayout.Height(30f)
		});
		SpwanRandomPos = GUILayout.Toggle(SpwanRandomPos, "√:Spawn in front ×:Spawn Random Pos", Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("Spawn enemy", customButtonStyle, Array.Empty<GUILayoutOption>()))
		{
			if (!int.TryParse(textFieldValue, out var result))
			{
				result = 0;
			}
			TrySpawnEnemy(result);
			if (!isDebugMode)
			{
				DebugMode();
			}
		}
		GUILayout.EndHorizontal();
		GUILayout.Space(10f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("FontSize+", customButtonStyle, Array.Empty<GUILayoutOption>()))
		{
			fontSize += 2;
		}
		if (GUILayout.Button("FontSize-", customButtonStyle, Array.Empty<GUILayoutOption>()))
		{
			fontSize -= 2;
			if (fontSize <= 0)
			{
				fontSize = 1;
				debugText = "Can't reduce font size anymore";
			}
		}
		if (GUILayout.Button(isDebugMode ? "DebugModeOff" : "DebugModeOn", customButtonStyle, Array.Empty<GUILayoutOption>()))
		{
			isDebugMode = !isDebugMode;
			DebugMode();
		}
		GUILayout.EndHorizontal();
		GUILayout.Space(10f);
		if ((Object)(object)localPlayer != (Object)null)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("strength+", customButtonStyle, Array.Empty<GUILayoutOption>()))
			{
				PhysGrabber physGrabber = localPlayer.playerAvatarScript.physGrabber;
				physGrabber.grabStrength += 0.1f;
				localPlayer.playerAvatarScript.physGrabber.grabStrength = (float)Math.Round(localPlayer.playerAvatarScript.physGrabber.grabStrength, 2);
			}
			if (GUILayout.Button("strength-", customButtonStyle, Array.Empty<GUILayoutOption>()))
			{
				PhysGrabber physGrabber2 = localPlayer.playerAvatarScript.physGrabber;
				physGrabber2.grabStrength -= 0.1f;
				localPlayer.playerAvatarScript.physGrabber.grabStrength = (float)Math.Round(localPlayer.playerAvatarScript.physGrabber.grabStrength, 2);
			}
			GUILayout.Label("Current strength:" + localPlayer.playerAvatarScript.physGrabber.grabStrength + " (Default is 1, +0.1 for each upgrade)", customLabelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
		}
		GUILayout.Space(30f);
		GUILayout.Label("Notice" + debugText, customLabelStyle, Array.Empty<GUILayoutOption>());
	}

	private void WindowsFunc_ENEMY()
	{
		int num = 0;
		string text = "怪物编号/Enemy List ";
		foreach (EnemySetup item in EnemyDirector.instance.enemiesDifficulty3)
		{
			text += $"\n[{num}]{((Object)item.spawnObjects[0]).name}";
			num++;
		}
		GUILayout.Label(text, customLabelStyle, Array.Empty<GUILayoutOption>());
		GUILayout.Label("DebugMode:EnergyCurrent=1000,GodMode=true,grabStrength =10 \n 调试模式:体力1000,无敌模式,力量为10倍", customLabelStyle, Array.Empty<GUILayoutOption>());
		GUILayout.Label("After the enemy is generated, it will be automatically initialized and teleported to the spawn point. You can click \"TP here\" to teleport the enemy to facilitate debugging. \n 生成敌人后,敌人会自动初始化并传送到出生点,可以点'来'将怪物传送过来方便调试", customLabelStyle, Array.Empty<GUILayoutOption>());
		GUILayout.Label("特别感谢傀鹏赞助本MOD", customLabelStyle, Array.Empty<GUILayoutOption>());
	}

	private void TrySpawnEnemy(int num)
	{
		//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)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: 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_0110: 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)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: 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)
		if (num < 0 || num >= EnemyDirector.instance.enemiesDifficulty3.Count)
		{
			debugText = "无效的敌人编号/Invalid enemy ID";
			return;
		}
		EnemySetup enemySetup = EnemyDirector.instance.enemiesDifficulty3[num];
		Vector3 zero = Vector3.zero;
		if (SpwanRandomPos)
		{
			LevelPoint val = null;
			float num2 = 0f;
			foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints)
			{
				float num3 = Vector3.Distance(((Component)levelPathPoint).transform.position, ((Component)LevelGenerator.Instance).transform.position);
				if (num3 > num2)
				{
					num2 = num3;
					val = levelPathPoint;
				}
			}
			zero = ((Component)val).transform.position;
		}
		else
		{
			Transform transform = ((Component)Camera.main).transform;
			zero = transform.position + transform.forward * 2f;
		}
		SpawnEnemy(enemySetup, zero);
	}

	private void SpawnEnemy(EnemySetup enemySetup, Vector3 pos)
	{
		//IL_0086: 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_0073: 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)
		if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null || enemySetup.spawnObjects.Count == 0)
		{
			return;
		}
		GameObject val = enemySetup.spawnObjects[0];
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		GameObject val2 = ((!GameManager.Multiplayer() || !PhotonNetwork.IsMasterClient) ? Object.Instantiate<GameObject>(val, pos, Quaternion.identity) : PhotonNetwork.InstantiateRoomObject("Enemies/" + ((Object)val).name, pos, Quaternion.identity, (byte)0, (object[])null));
		if ((Object)(object)val2 == (Object)null)
		{
			return;
		}
		EnemyParent component = val2.GetComponent<EnemyParent>();
		if ((Object)(object)component == (Object)null)
		{
			return;
		}
		component.SetupDone = true;
		Plugin.logger.LogInfo((object)("SpawnEnemy/生成:" + component.enemyName));
		debugText = "Spawn Enemy/生成:" + component.enemyName;
		foreach (GameObject spawnObject in enemySetup.spawnObjects)
		{
			Plugin.logger.LogInfo((object)("列表:" + ((Object)spawnObject).name));
		}
	}

	private void DebugMode()
	{
		if ((Object)(object)localPlayer != (Object)null)
		{
			localPlayer.EnergyCurrent = (isDebugMode ? 1000 : 40);
			localPlayer.playerAvatarScript.playerHealth.godMode = isDebugMode;
			localPlayer.playerAvatarScript.physGrabber.grabStrength = ((!isDebugMode) ? 1 : 10);
		}
	}
}