using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("DeadBotMode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DeadBotMode")]
[assembly: AssemblyTitle("DeadBotMode")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.deadbot.mode", "DeadBot Mode GOD", "10.0.0")]
public class DeadBotMode : BaseUnityPlugin
{
private GameObject robotPlayer;
private GameObject screenObj;
private Camera cam;
private bool isDead = false;
private float mouseX;
private float mouseY;
private float sensitivity = 3f;
private static int alivePlayers;
private void Start()
{
((MonoBehaviour)this).InvokeRepeating("UpdatePlayers", 1f, 2f);
}
private void Update()
{
if (!isDead)
{
CheckIfDead();
}
if (isDead && (Object)(object)robotPlayer != (Object)null)
{
HandleMovement();
HandleMouseLook();
AnimateFace();
}
}
private void CheckIfDead()
{
GameObject localPlayer = GetLocalPlayer();
if ((Object)(object)localPlayer == (Object)null || !localPlayer.activeInHierarchy)
{
TriggerDeath();
}
}
private GameObject GetLocalPlayer()
{
GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
foreach (GameObject val in array)
{
if ((Object)(object)val.GetComponentInChildren<Camera>() != (Object)null)
{
return val;
}
}
return null;
}
private void TriggerDeath()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
if (isDead)
{
return;
}
isDead = true;
GameObject localPlayer = GetLocalPlayer();
if (!((Object)(object)localPlayer == (Object)null))
{
Vector3 position = localPlayer.transform.position;
localPlayer.SetActive(false);
robotPlayer = CreateRobot(position);
cam = Camera.main;
if ((Object)(object)cam != (Object)null)
{
((Component)cam).transform.parent = robotPlayer.transform;
((Component)cam).transform.localPosition = new Vector3(0f, 0.5f, -1.5f);
}
Cursor.lockState = (CursorLockMode)1;
Cursor.visible = false;
alivePlayers--;
CheckGameOver();
}
}
private GameObject CreateRobot(Vector3 pos)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_003a: 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_0055: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Expected O, but got Unknown
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("DeadBot");
GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3);
val2.transform.parent = val.transform;
val2.transform.localScale = new Vector3(0.5f, 0.4f, 0.5f);
Material val3 = new Material(Shader.Find("Standard"));
val3.color = new Color(0.1f, 0.3f, 1f);
val2.GetComponent<Renderer>().material = val3;
GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)3);
val4.transform.parent = val.transform;
val4.transform.localPosition = new Vector3(0f, 0.1f, 0.26f);
val4.transform.localScale = new Vector3(0.4f, 0.2f, 0.05f);
Material val5 = new Material(Shader.Find("Standard"));
val5.EnableKeyword("_EMISSION");
val5.SetColor("_EmissionColor", Color.green * 3f);
val4.GetComponent<Renderer>().material = val5;
screenObj = val4;
Rigidbody val6 = val.AddComponent<Rigidbody>();
val6.mass = 1f;
val.transform.position = pos;
return val;
}
private void HandleMovement()
{
//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_003f: 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_0091: Unknown result type (might be due to invalid IL or missing references)
Rigidbody component = robotPlayer.GetComponent<Rigidbody>();
float axis = Input.GetAxis("Vertical");
float axis2 = Input.GetAxis("Horizontal");
component.AddForce(robotPlayer.transform.forward * axis * 12f);
robotPlayer.transform.Rotate(0f, axis2 * 150f * Time.deltaTime, 0f);
component.freezeRotation = true;
if (Input.GetKeyDown((KeyCode)32))
{
component.AddForce(Vector3.up * 6f, (ForceMode)1);
}
}
private void HandleMouseLook()
{
//IL_0077: 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)
float num = Input.GetAxis("Mouse X") * sensitivity;
float num2 = Input.GetAxis("Mouse Y") * sensitivity;
mouseX += num;
mouseY -= num2;
mouseY = Mathf.Clamp(mouseY, -60f, 60f);
robotPlayer.transform.rotation = Quaternion.Euler(0f, mouseX, 0f);
if ((Object)(object)cam != (Object)null)
{
((Component)cam).transform.localRotation = Quaternion.Euler(mouseY, 0f, 0f);
}
}
private void AnimateFace()
{
//IL_003b: 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 (!((Object)(object)screenObj == (Object)null))
{
float num = Mathf.Sin(Time.time * 3f);
Renderer component = screenObj.GetComponent<Renderer>();
component.material.SetColor("_EmissionColor", Color.green * (2f + num));
}
}
private void UpdatePlayers()
{
alivePlayers = GameObject.FindGameObjectsWithTag("Player").Length;
}
private void CheckGameOver()
{
if (alivePlayers <= 0)
{
((MonoBehaviour)this).Invoke("EndGame", 2f);
}
}
private void EndGame()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"ALL PLAYERS DEAD");
Time.timeScale = 0.3f;
((MonoBehaviour)this).Invoke("LoadLobby", 5f);
}
private void LoadLobby()
{
Time.timeScale = 1f;
SceneManager.LoadScene(0);
}
}