Decompiled source of GWYFThirdPersonMod v1.2.2

gwyfmod1.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("gwyfmod1")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("gwyfmod1")]
[assembly: AssemblyTitle("gwyfmod1")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("gwyf.thirdperson.camera", "GWYF Third Person Camera", "1.2.2")]
public class Class1 : BaseUnityPlugin
{
	private GameObject player;

	private GameObject cam;

	private float camDistance = -2f;

	private float minDistance = -4f;

	private float maxDistance = -0.5f;

	private float scrollSpeed = 0.5f;

	private void Update()
	{
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)player == (Object)null)
		{
			player = GameObject.Find("Player(Clone)");
		}
		if ((Object)(object)cam == (Object)null)
		{
			cam = GameObject.Find("Camera(Clone)");
		}
		if ((Object)(object)player == (Object)null || (Object)(object)cam == (Object)null)
		{
			return;
		}
		float num = ((InputControl<float>)(object)((Vector2Control)Mouse.current.scroll).y).ReadValue();
		num *= 0.2f;
		if (num != 0f)
		{
			camDistance += num * scrollSpeed;
			camDistance = Mathf.Clamp(camDistance, minDistance, maxDistance);
		}
		Component component = cam.GetComponent("CameraBreathing");
		Behaviour val = (Behaviour)(object)((component is Behaviour) ? component : null);
		if ((Object)(object)val != (Object)null)
		{
			val.enabled = false;
		}
		cam.transform.localPosition = new Vector3(0.6f, 0.3f, camDistance);
		Camera component2 = cam.GetComponent<Camera>();
		if ((Object)(object)component2 != (Object)null)
		{
			component2.cullingMask |= 0x2000;
		}
		Component component3 = player.GetComponent("PlayerInteract");
		if ((Object)(object)component3 != (Object)null)
		{
			FieldInfo field = ((object)component3).GetType().GetField("raycastDistance");
			if (field != null)
			{
				field.SetValue(component3, 6f);
			}
		}
	}
}