Decompiled source of ShotGun Shouldering v1.3.0
ShotGun_Shouldering.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FistVR; using HarmonyLib; using UnityEngine; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [Serializable] public class BlurCircle { [Range(0f, 1f)] public float positionX = 0.5f; [Range(0f, 1f)] public float positionY = 0.5f; [Range(0.01f, 0.5f)] public float radius = 0.1f; [Range(0.1f, 5f)] public float transitionSharpness = 1f; [Range(0f, 1f)] public float intensity = 1f; public bool isActive = true; [HideInInspector] public float pulseTimer = 0f; [HideInInspector] public float pulseSpeed = 1f; [HideInInspector] public float minRadius = 0.05f; [HideInInspector] public float maxRadius = 0.2f; public Vector2 Position { get { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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) return new Vector2(positionX, positionY); } set { positionX = Mathf.Clamp01(value.x); positionY = Mathf.Clamp01(value.y); } } } public class EnhancedCircleBlur : MonoBehaviour { [Header("Blur Settings")] [Range(0f, 10f)] public float blurStrength = 5f; [Range(0.1f, 10f)] public float globalTransitionSharpness = 3f; [Range(0f, 1f)] public float globalIntensity = 1f; public bool invertEffect = false; [Header("Circle Management")] public List<BlurCircle> circles = new List<BlurCircle>(); public int maxCircles = 60; [Header("Animation")] public bool animateCircles = false; public float animationSpeed = 1f; public bool pulseRadius = false; public float pulseMin = 0.05f; public float pulseMax = 0.2f; [Header("Performance")] public int updateRate = 30; public bool useFastBlur = true; [Header("References")] public Material targetMaterial; public Renderer targetRenderer; private Texture2D circleDataTexture; private float updateTimer = 0f; private bool materialAssigned = false; private static readonly int CircleDataTexID = Shader.PropertyToID("_CircleDataTex"); private static readonly int CircleCountID = Shader.PropertyToID("_CircleCount"); private static readonly int BlurStrengthID = Shader.PropertyToID("_BlurStrength"); private static readonly int TransitionSharpnessID = Shader.PropertyToID("_TransitionSharpness"); private static readonly int InvertEffectID = Shader.PropertyToID("_InvertEffect"); private static readonly int GlobalIntensityID = Shader.PropertyToID("_GlobalIntensity"); private void Start() { if ((Object)(object)targetRenderer == (Object)null) { targetRenderer = ((Component)this).GetComponent<Renderer>(); } if ((Object)(object)targetMaterial == (Object)null && (Object)(object)targetRenderer != (Object)null) { targetMaterial = targetRenderer.sharedMaterial; } if (circles.Count == 0) { circles.Add(new BlurCircle()); } if (circles.Count > maxCircles) { circles.RemoveRange(maxCircles, circles.Count - maxCircles); } CreateCircleDataTexture(); if ((Object)(object)targetMaterial != (Object)null) { targetMaterial.SetTexture(CircleDataTexID, (Texture)(object)circleDataTexture); UpdateMaterialProperties(); materialAssigned = true; } InitializeAnimation(); } private void Update() { updateTimer += Time.deltaTime; float num = 1f / (float)updateRate; if (updateTimer >= num) { if (animateCircles) { UpdateAnimations(); } UpdateCircleDataTexture(); if (materialAssigned) { UpdateMaterialProperties(); } updateTimer = 0f; } } private void CreateCircleDataTexture() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown circleDataTexture = new Texture2D(maxCircles, 1, (TextureFormat)20, false); ((Texture)circleDataTexture).wrapMode = (TextureWrapMode)1; ((Texture)circleDataTexture).filterMode = (FilterMode)0; ((Object)circleDataTexture).name = "CircleDataTexture"; UpdateCircleDataTexture(); } private void UpdateCircleDataTexture() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)circleDataTexture == (Object)null) { return; } Color[] array = (Color[])(object)new Color[maxCircles]; for (int i = 0; i < maxCircles; i++) { ref Color reference = ref array[i]; reference = Color.black; } int num = 0; for (int j = 0; j < circles.Count && j < maxCircles; j++) { if (circles[j].isActive) { BlurCircle blurCircle = circles[j]; float num2 = Mathf.Clamp01(blurCircle.radius / 0.5f); float num3 = Mathf.Clamp01(blurCircle.transitionSharpness / 5f); ref Color reference2 = ref array[num]; reference2 = new Color(blurCircle.positionX, blurCircle.positionY, num2, num3); num++; } } circleDataTexture.SetPixels(array); circleDataTexture.Apply(); if ((Object)(object)targetMaterial != (Object)null) { targetMaterial.SetTexture(CircleDataTexID, (Texture)(object)circleDataTexture); targetMaterial.SetInt(CircleCountID, num); } } private void UpdateMaterialProperties() { if (!((Object)(object)targetMaterial == (Object)null)) { targetMaterial.SetFloat(BlurStrengthID, blurStrength); targetMaterial.SetFloat(TransitionSharpnessID, globalTransitionSharpness); targetMaterial.SetFloat(GlobalIntensityID, globalIntensity); targetMaterial.SetFloat(InvertEffectID, (!invertEffect) ? 0f : 1f); } } private void InitializeAnimation() { foreach (BlurCircle circle in circles) { circle.pulseTimer = Random.Range(0f, (float)Math.PI * 2f); circle.pulseSpeed = Random.Range(0.5f, 2f); circle.minRadius = pulseMin; circle.maxRadius = pulseMax; } } private void UpdateAnimations() { if (!animateCircles) { return; } foreach (BlurCircle circle in circles) { if (circle.isActive) { circle.pulseTimer += Time.deltaTime * animationSpeed * circle.pulseSpeed; if (pulseRadius) { float num = (Mathf.Sin(circle.pulseTimer) + 1f) * 0.5f; circle.radius = Mathf.Lerp(circle.minRadius, circle.maxRadius, num); } circle.positionX = Mathf.Clamp01(circle.positionX); circle.positionY = Mathf.Clamp01(circle.positionY); circle.radius = Mathf.Clamp(circle.radius, 0.01f, 0.5f); } } } public void AddCircle(Vector2 position, float radius, float transitionSharpness) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (circles.Count >= maxCircles) { Debug.LogWarning((object)("Maximum number of circles reached:" + maxCircles)); return; } BlurCircle blurCircle = new BlurCircle(); blurCircle.Position = position; blurCircle.radius = Mathf.Clamp(radius, 0.01f, 0.5f); blurCircle.transitionSharpness = Mathf.Clamp(transitionSharpness, 0.1f, 5f); blurCircle.isActive = true; BlurCircle item = blurCircle; circles.Add(item); } public void RemoveCircle(int index) { if (index >= 0 && index < circles.Count) { circles.RemoveAt(index); } } public void SetCircleActive(int index, bool active) { if (index >= 0 && index < circles.Count) { circles[index].isActive = active; } } public void ClearCircles() { circles.Clear(); } public void RandomizeCircles(int count) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) circles.Clear(); for (int i = 0; i < count && i < maxCircles; i++) { AddCircle(new Vector2(Random.value, Random.value), Random.Range(0.05f, 0.2f), Random.Range(0.5f, 3f)); } } private void OnValidate() { blurStrength = Mathf.Clamp(blurStrength, 0f, 10f); globalTransitionSharpness = Mathf.Clamp(globalTransitionSharpness, 0.1f, 10f); globalIntensity = Mathf.Clamp01(globalIntensity); foreach (BlurCircle circle in circles) { circle.positionX = Mathf.Clamp01(circle.positionX); circle.positionY = Mathf.Clamp01(circle.positionY); circle.radius = Mathf.Clamp(circle.radius, 0.01f, 0.5f); circle.transitionSharpness = Mathf.Clamp(circle.transitionSharpness, 0.1f, 5f); circle.intensity = Mathf.Clamp01(circle.intensity); } if (Application.isPlaying && (Object)(object)circleDataTexture != (Object)null) { UpdateCircleDataTexture(); UpdateMaterialProperties(); } } private void OnDrawGizmosSelected() { //IL_006a: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00ce: Unknown result type (might be due to invalid IL or missing references) if (circles == null || !((Behaviour)this).enabled) { return; } Color color = default(Color); foreach (BlurCircle circle in circles) { if (circle.isActive) { Vector3 val = ((Component)this).transform.TransformPoint(new Vector3(circle.positionX - 0.5f, 0f, circle.positionY - 0.5f)); Gizmos.color = Color.green; Gizmos.DrawWireSphere(val, circle.radius * 0.5f); ((Color)(ref color))..ctor(0f, 1f, 0f, 0.2f); Gizmos.color = color; Gizmos.DrawSphere(val, circle.radius * 0.5f); Gizmos.color = Color.red; Gizmos.DrawSphere(val, 0.01f); } } } private void OnDestroy() { if ((Object)(object)circleDataTexture != (Object)null) { Object.DestroyImmediate((Object)(object)circleDataTexture); } } } public class CircleDataMul { public Vector2 position; public float radius; public float transitionSpeed; public CircleDataMul(Vector2 pos, float rad, float speed) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) position = pos; radius = rad; transitionSpeed = speed; } } public class MultiCircleBlurController : MonoBehaviour { [Header("Shader Properties")] public Material targetMaterial; [Range(0f, 1f)] public float blurStrength = 0.5f; public float defaultRadius = 0.1f; public float transitionSmoothness = 2f; [Header("Circle Settings")] public List<Vector2> circlePositions = new List<Vector2>(); public List<float> circleRadii = new List<float>(); public List<float> circleTransitions = new List<float>(); [Header("Animation Settings")] public bool animateTransitions = true; public float transitionDuration = 2f; private List<float> currentTransitionValues = new List<float>(); private List<float> targetTransitionValues = new List<float>(); private float transitionTimer = 0f; private const int MAX_CIRCLES = 8; private void Start() { InitializeCircles(); UpdateShaderProperties(); for (int i = 0; i < circleTransitions.Count; i++) { currentTransitionValues.Add(circleTransitions[i]); targetTransitionValues.Add(circleTransitions[i]); } } private void Update() { if (animateTransitions) { UpdateTransitions(); } UpdateShaderProperties(); } private void InitializeCircles() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (circlePositions.Count == 0) { circlePositions.Add(new Vector2(0.5f, 0.5f)); circleRadii.Add(defaultRadius); circleTransitions.Add(1f); } while (circleRadii.Count < circlePositions.Count) { circleRadii.Add(defaultRadius); } while (circleTransitions.Count < circlePositions.Count) { circleTransitions.Add(1f); } } private void UpdateTransitions() { transitionTimer += Time.deltaTime; if (transitionTimer >= transitionDuration) { transitionTimer = 0f; for (int i = 0; i < targetTransitionValues.Count; i++) { targetTransitionValues[i] = Random.Range(0.1f, 3f); } } float num = transitionTimer / transitionDuration; float num2 = Mathf.SmoothStep(0f, 1f, num); for (int j = 0; j < currentTransitionValues.Count; j++) { currentTransitionValues[j] = Mathf.Lerp(circleTransitions[j], targetTransitionValues[j], num2); } } private void UpdateShaderProperties() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0265: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_042f: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetMaterial == (Object)null) { return; } targetMaterial.SetFloat("_BlurStrength", blurStrength); targetMaterial.SetFloat("_CircleRadius", defaultRadius); targetMaterial.SetFloat("_TransitionSmoothness", transitionSmoothness); int num = Mathf.Min(circlePositions.Count, 8); targetMaterial.SetInt("_CircleCount", num); Vector4 zero = Vector4.zero; Vector4 zero2 = Vector4.zero; Vector4 zero3 = Vector4.zero; for (int i = 0; i < Mathf.Min(num, 4); i++) { if (i == 0) { zero.x = circlePositions[i].x; } if (i == 0) { zero.y = circlePositions[i].y; } if (i == 1) { zero.z = circlePositions[i].x; } if (i == 1) { zero.w = circlePositions[i].y; } if (i == 0) { zero2.x = circleRadii[i]; } if (i == 1) { zero2.y = circleRadii[i]; } if (i == 2) { zero2.z = circleRadii[i]; } if (i == 3) { zero2.w = circleRadii[i]; } float num2 = ((!animateTransitions) ? circleTransitions[i] : currentTransitionValues[i]); if (i == 0) { zero3.x = num2; } if (i == 1) { zero3.y = num2; } if (i == 2) { zero3.z = num2; } if (i == 3) { zero3.w = num2; } } targetMaterial.SetVector("_CirclePositions", zero); targetMaterial.SetVector("_CircleRadii", zero2); targetMaterial.SetVector("_CircleTransitions", zero3); if (num <= 4) { return; } Vector4 zero4 = Vector4.zero; Vector4 zero5 = Vector4.zero; Vector4 zero6 = Vector4.zero; for (int j = 4; j < Mathf.Min(num, 8); j++) { int num3 = j - 4; if (num3 == 0) { zero4.x = circlePositions[j].x; } if (num3 == 0) { zero4.y = circlePositions[j].y; } if (num3 == 1) { zero4.z = circlePositions[j].x; } if (num3 == 1) { zero4.w = circlePositions[j].y; } if (num3 == 0) { zero5.x = circleRadii[j]; } if (num3 == 1) { zero5.y = circleRadii[j]; } if (num3 == 2) { zero5.z = circleRadii[j]; } if (num3 == 3) { zero5.w = circleRadii[j]; } float num4 = ((!animateTransitions) ? circleTransitions[j] : currentTransitionValues[j]); if (num3 == 0) { zero6.x = num4; } if (num3 == 1) { zero6.y = num4; } if (num3 == 2) { zero6.z = num4; } if (num3 == 3) { zero6.w = num4; } } targetMaterial.SetVector("_CirclePositions2", zero4); targetMaterial.SetVector("_CircleRadii2", zero5); targetMaterial.SetVector("_CircleTransitions2", zero6); } public void AddCircle(Vector2 position, float radius, float transitionSpeed) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (circlePositions.Count >= 8) { Debug.LogWarning((object)("已达到最大圆数量限制 (" + 8 + ")")); return; } circlePositions.Add(position); circleRadii.Add(radius); circleTransitions.Add(transitionSpeed); currentTransitionValues.Add(transitionSpeed); targetTransitionValues.Add(transitionSpeed); } public void RemoveCircle(int index) { if (index >= 0 && index < circlePositions.Count) { circlePositions.RemoveAt(index); circleRadii.RemoveAt(index); circleTransitions.RemoveAt(index); currentTransitionValues.RemoveAt(index); targetTransitionValues.RemoveAt(index); } } public void UpdateCircle(int index, Vector2 position, float radius, float transitionSpeed) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (index >= 0 && index < circlePositions.Count) { circlePositions[index] = position; circleRadii[index] = radius; circleTransitions[index] = transitionSpeed; } } public void SetCircleTransition(int index, float transitionValue) { if (index >= 0 && index < circleTransitions.Count) { circleTransitions[index] = transitionValue; if (index < currentTransitionValues.Count) { currentTransitionValues[index] = transitionValue; } } } private void OnDrawGizmosSelected() { //IL_0038: 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_0057: 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_006a: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00ab: 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) if (circlePositions == null) { return; } for (int i = 0; i < circlePositions.Count; i++) { if (i < circleRadii.Count) { Vector3 val = ((Component)this).transform.TransformPoint(new Vector3(circlePositions[i].x - 0.5f, 0f, circlePositions[i].y - 0.5f)); Gizmos.color = Color.green; Gizmos.DrawWireSphere(val, circleRadii[i] * 0.5f); Gizmos.color = new Color(0f, 1f, 0f, 0.3f); Gizmos.DrawSphere(val, circleRadii[i] * 0.5f); } } } } public class BezierMover : MonoBehaviour { [Header("控制点")] public Transform p0; public Transform p1; public Transform p2; public Transform p3; public GameObject hook; [Header("运动设置")] public LineRenderer wire; public Transform wp0; public Transform wp1; public Transform wp2; public Transform wp3; public GameObject[] joints; private void Update() { //IL_0024: 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_003a: 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_004a: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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) for (int i = 0; i < joints.Length; i++) { joints[i].transform.position = GetCubicBezierPoint((float)i * 0.1f, p0.position, p1.position, p2.position, p3.position); if (i == joints.Length - 1) { AxisLookAt(joints[i].transform, hook.transform.position, -Vector3.right); } if (i != joints.Length - 1) { AxisLookAt(joints[i].transform, joints[i + 1].transform.position, -Vector3.right); } } } private void AxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0016: 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_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_006b: 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) Quaternion rotation = tr_self.rotation; Vector3 val = lookPos - tr_self.position; Vector3 val2 = tr_self.rotation * directionAxis; Vector3 val3 = Vector3.Cross(val2, val); Vector3 normalized = ((Vector3)(ref val3)).normalized; float num = Vector3.Angle(val2, val); tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation; tr_self.localEulerAngles = new Vector3(0f, tr_self.localEulerAngles.y, tr_self.localEulerAngles.z); } public static Vector3 GetCubicBezierPoint(float t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0044: 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_004d: 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) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) float num = 1f - t; float num2 = t * t; float num3 = num * num; float num4 = num3 * num; float num5 = num2 * t; return num4 * p0 + 3f * num3 * t * p1 + 3f * num * num2 * p2 + num5 * p3; } 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) //IL_0016: 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_003a: 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_0050: 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) //IL_005a: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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) Gizmos.color = Color.white; Vector3 val = p0.position; for (int i = 1; i <= 30; i++) { float t = (float)i / 30f; Vector3 cubicBezierPoint = GetCubicBezierPoint(t, wp0.position, wp1.position, wp2.position, wp3.position); Gizmos.DrawLine(val, cubicBezierPoint); val = cubicBezierPoint; } } } public class FishingRodPhysics : MonoBehaviour { [Serializable] public class RodBone { public Transform boneTransform; public Vector3 restPosition; public Quaternion restRotation; public float flexibility = 1f; } public GameObject hook; public GameObject top; public GameObject topref; [Header("骨骼设置")] public RodBone[] rodBones = new RodBone[9]; [Header("物理参数")] [SerializeField] private float pullForce = 0f; [SerializeField] private Vector3 pullDirection = Vector3.right; [SerializeField] private float maxBendAngle = 60f; [SerializeField] private float springStiffness = 100f; [SerializeField] private float damping = 10f; [SerializeField] private float rodLength = 2f; [Header("弯曲曲线")] public AnimationCurve bendCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f); private Vector3[] bonePositions; private Vector3[] boneVelocities; private Vector3 pullPointWorld; public float PullForce { get { return pullForce; } set { pullForce = Mathf.Clamp01(value); } } public Vector3 PullDirection { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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) return pullDirection; } set { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) pullDirection = ((Vector3)(ref value)).normalized; } } private void Start() { //IL_00a7: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) InitializeBones(); bonePositions = (Vector3[])(object)new Vector3[rodBones.Length]; boneVelocities = (Vector3[])(object)new Vector3[rodBones.Length]; for (int i = 0; i < rodBones.Length; i++) { if ((Object)(object)rodBones[i].boneTransform != (Object)null) { ref Vector3 reference = ref bonePositions[i]; reference = rodBones[i].boneTransform.position; ref Vector3 reference2 = ref boneVelocities[i]; reference2 = Vector3.zero; } } pullPointWorld = top.transform.position; } private void InitializeBones() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rodBones[0].boneTransform == (Object)null) { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(); int num = Mathf.Min(9, componentsInChildren.Length - 1); for (int i = 0; i < num; i++) { rodBones[i].boneTransform = componentsInChildren[i + 1]; rodBones[i].restPosition = rodBones[i].boneTransform.localPosition; rodBones[i].restRotation = rodBones[i].boneTransform.localRotation; } return; } for (int j = 0; j < rodBones.Length; j++) { if ((Object)(object)rodBones[j].boneTransform != (Object)null) { rodBones[j].restPosition = rodBones[j].boneTransform.localPosition; rodBones[j].restRotation = rodBones[j].boneTransform.localRotation; } } } private void Update() { //IL_0033: 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_004d: 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) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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) SimulateRodPhysics(Time.deltaTime); for (int i = 0; i < rodBones.Length; i++) { rodBones[i].boneTransform.localEulerAngles = new Vector3(0f, rodBones[i].boneTransform.localEulerAngles.y, rodBones[i].boneTransform.localEulerAngles.z); } pullForce = Vector3.Distance(top.transform.position, hook.transform.position); top.transform.position = topref.transform.position; top.transform.eulerAngles = topref.transform.eulerAngles; pullDirection = hook.transform.position - top.transform.position; ApplyBendToBones(); } private void SimulateRodPhysics(float deltaTime) { //IL_003b: 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_0051: 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) //IL_0093: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_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_010e: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_01dd: Unknown result type (might be due to invalid IL or missing references) if (rodBones.Length == 0) { return; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(pullDirection.x, pullDirection.y, pullDirection.z); Vector3 val2 = val * pullForce * 10f; for (int i = 1; i < rodBones.Length; i++) { if (!((Object)(object)rodBones[i].boneTransform == (Object)null)) { float num = bendCurve.Evaluate((float)i / (float)(rodBones.Length - 1)); Vector3 val3 = val2 * num * rodBones[i].flexibility; Vector3 val4 = ((Component)this).transform.TransformPoint(rodBones[i].restPosition); Vector3 val5 = (val4 - bonePositions[i]) * springStiffness; Vector3 val6 = -boneVelocities[i] * damping; Vector3 val7 = val3 + val5 + val6; ref Vector3 reference = ref boneVelocities[i]; reference += val7 * deltaTime; ref Vector3 reference2 = ref bonePositions[i]; reference2 += boneVelocities[i] * deltaTime; } } if ((Object)(object)rodBones[0].boneTransform != (Object)null) { ref Vector3 reference3 = ref bonePositions[0]; reference3 = ((Component)this).transform.TransformPoint(rodBones[0].restPosition); ref Vector3 reference4 = ref boneVelocities[0]; reference4 = Vector3.zero; } ApplyDistanceConstraints(); } private void ApplyDistanceConstraints() { //IL_0069: 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_0084: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f3: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) float num = rodLength / (float)(rodBones.Length - 1); for (int i = 0; i < 3; i++) { for (int j = 0; j < rodBones.Length - 1; j++) { if ((Object)(object)rodBones[j].boneTransform == (Object)null || (Object)(object)rodBones[j + 1].boneTransform == (Object)null) { continue; } Vector3 val = bonePositions[j + 1] - bonePositions[j]; float magnitude = ((Vector3)(ref val)).magnitude; float num2 = magnitude - num; if (magnitude > 0f) { Vector3 val2 = val * (num2 / magnitude) * 0.5f; if (j > 0) { ref Vector3 reference = ref bonePositions[j]; reference += val2; } ref Vector3 reference2 = ref bonePositions[j + 1]; reference2 -= val2; } } } } private void ApplyBendToBones() { //IL_0079: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_00d4: 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_00db: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) Vector3 val4 = default(Vector3); for (int i = 0; i < rodBones.Length; i++) { if ((Object)(object)rodBones[i].boneTransform == (Object)null) { continue; } Vector3 val; Quaternion val2; if (i == 0) { val = ((Component)this).transform.TransformPoint(rodBones[i].restPosition); val2 = ((Component)this).transform.rotation * rodBones[i].restRotation; } else { Vector3 val3 = bonePositions[i - 1] - bonePositions[i]; val = bonePositions[i]; if (val3 != Vector3.zero) { ((Vector3)(ref val4))..ctor(val3.x, val3.y, 0f); Vector3 normalized = ((Vector3)(ref val4)).normalized; Quaternion val5 = Quaternion.FromToRotation(Vector3.right, normalized); val2 = ((Component)this).transform.rotation * val5 * rodBones[i].restRotation; } else { val2 = ((Component)this).transform.rotation * rodBones[i].restRotation; } } rodBones[i].boneTransform.position = Vector3.Lerp(rodBones[i].boneTransform.position, val, Time.deltaTime * 20f); rodBones[i].boneTransform.rotation = Quaternion.Slerp(rodBones[i].boneTransform.rotation, val2, Time.deltaTime * 20f); } } private void OnDrawGizmosSelected() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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) //IL_0147: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (rodBones == null || rodBones.Length == 0) { return; } Gizmos.color = Color.green; for (int i = 0; i < rodBones.Length; i++) { if ((Object)(object)rodBones[i].boneTransform != (Object)null) { Gizmos.DrawSphere(rodBones[i].boneTransform.position, 0.02f); if (i < rodBones.Length - 1 && (Object)(object)rodBones[i + 1].boneTransform != (Object)null) { Gizmos.DrawLine(rodBones[i].boneTransform.position, rodBones[i + 1].boneTransform.position); } } } if (pullForce > 0.01f) { Gizmos.color = Color.red; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f - pullDirection.x, pullDirection.y, 0f); Vector3 val2 = val * pullForce * 0.5f; Vector3 val3 = ((Component)this).transform.TransformPoint(new Vector3(0f - rodLength, 0f, 0f)); Gizmos.DrawLine(val3, val3 + val2); Gizmos.DrawSphere(val3 + val2, 0.03f); } } public void TestPull(float force, Vector2 direction) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) PullForce = force; PullDirection = Vector2.op_Implicit(direction); } public void ResetRod() { //IL_0042: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) PullForce = 0f; for (int i = 0; i < rodBones.Length; i++) { if ((Object)(object)rodBones[i].boneTransform != (Object)null) { rodBones[i].boneTransform.localPosition = rodBones[i].restPosition; rodBones[i].boneTransform.localRotation = rodBones[i].restRotation; ref Vector3 reference = ref boneVelocities[i]; reference = Vector3.zero; } } } } internal class TronTrailSection { public Vector3 point; public Vector3 upDir; public float time; public TronTrailSection() { } public TronTrailSection(Vector3 p, float t) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) point = p; time = t; } } [RequireComponent(typeof(MeshFilter))] public class LightsaberTrail : MonoBehaviour { public float height = 2f; public float time = 2f; public bool alwaysUp = false; public float minDistance = 0.1f; public float timeTransitionSpeed = 1f; public float desiredTime = 2f; public Color startColor = Color.white; public Color endColor = new Color(1f, 1f, 1f, 0f); private Vector3 position; private float now = 0f; private TronTrailSection currentSection; private Matrix4x4 localSpaceTransform; private Mesh mesh; private Vector3[] vertices; private Color[] colors; private Vector2[] uv; private MeshRenderer meshRenderer; private Material trailMaterial; private List<TronTrailSection> sections = new List<TronTrailSection>(); private void Awake() { Component component = ((Component)this).GetComponent(typeof(MeshFilter)); MeshFilter val = (MeshFilter)(object)((component is MeshFilter) ? component : null); mesh = val.mesh; ref MeshRenderer reference = ref meshRenderer; Component component2 = ((Component)this).GetComponent(typeof(MeshRenderer)); reference = (MeshRenderer)(object)((component2 is MeshRenderer) ? component2 : null); trailMaterial = ((Renderer)meshRenderer).material; } public void StartTrail(float timeToTweenTo, float fadeInTime) { desiredTime = timeToTweenTo; if (time != desiredTime) { timeTransitionSpeed = Mathf.Abs(desiredTime - time) / fadeInTime; } if (time <= 0f) { time = 0.01f; } } public void SetTime(float trailTime, float timeToTweenTo, float tweenSpeed) { time = trailTime; desiredTime = timeToTweenTo; timeTransitionSpeed = tweenSpeed; if (time <= 0f) { ClearTrail(); } } public void FadeOut(float fadeTime) { desiredTime = 0f; if (time > 0f) { timeTransitionSpeed = time / fadeTime; } } public void SetTrailColor(Color color) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) trailMaterial.SetColor("_TintColor", color); } public void Iterate(float itterateTime) { //IL_0008: 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_0068: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_0083: Unknown result type (might be due to invalid IL or missing references) position = ((Component)this).transform.position; now = itterateTime; if (sections.Count != 0) { Vector3 val = sections[0].point - position; if (!(((Vector3)(ref val)).sqrMagnitude > minDistance * minDistance)) { return; } } TronTrailSection tronTrailSection = new TronTrailSection(); tronTrailSection.point = position; if (alwaysUp) { tronTrailSection.upDir = Vector3.up; } else { tronTrailSection.upDir = ((Component)this).transform.TransformDirection(Vector3.up); } tronTrailSection.time = now; sections.Insert(0, tronTrailSection); } public void UpdateTrail(float currentTime, float deltaTime) { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(); while (sections.Count > 0 && currentTime > sections[sections.Count - 1].time + time) { sections.RemoveAt(sections.Count - 1); } if (sections.Count < 2) { return; } vertices = (Vector3[])(object)new Vector3[sections.Count * 2]; colors = (Color[])(object)new Color[sections.Count * 2]; uv = (Vector2[])(object)new Vector2[sections.Count * 2]; currentSection = sections[0]; localSpaceTransform = ((Component)this).transform.worldToLocalMatrix; for (int i = 0; i < sections.Count; i++) { currentSection = sections[i]; float num = 0f; if (i != 0) { num = Mathf.Clamp01((currentTime - currentSection.time) / time); } Vector3 upDir = currentSection.upDir; ref Vector3 reference = ref vertices[i * 2]; reference = ((Matrix4x4)(ref localSpaceTransform)).MultiplyPoint(currentSection.point); ref Vector3 reference2 = ref vertices[i * 2 + 1]; reference2 = ((Matrix4x4)(ref localSpaceTransform)).MultiplyPoint(currentSection.point + upDir * height); ref Vector2 reference3 = ref uv[i * 2]; reference3 = new Vector2(num, 0f); ref Vector2 reference4 = ref uv[i * 2 + 1]; reference4 = new Vector2(num, 1f); Color val = Color.Lerp(startColor, endColor, num); colors[i * 2] = val; colors[i * 2 + 1] = val; } int[] array = new int[(sections.Count - 1) * 2 * 3]; for (int j = 0; j < array.Length / 6; j++) { array[j * 6] = j * 2; array[j * 6 + 1] = j * 2 + 1; array[j * 6 + 2] = j * 2 + 2; array[j * 6 + 3] = j * 2 + 2; array[j * 6 + 4] = j * 2 + 1; array[j * 6 + 5] = j * 2 + 3; } mesh.vertices = vertices; mesh.colors = colors; mesh.uv = uv; mesh.triangles = array; if (time > desiredTime) { time -= deltaTime * timeTransitionSpeed; if (time <= desiredTime) { time = desiredTime; } } else if (time < desiredTime) { time += deltaTime * timeTransitionSpeed; if (time >= desiredTime) { time = desiredTime; } } } public void ClearTrail() { desiredTime = 0f; time = 0f; if ((Object)(object)mesh != (Object)null) { mesh.Clear(); sections.Clear(); } } } [RequireComponent(typeof(LightsaberTrail))] public class LightsaberTrailController : MonoBehaviour { private LightsaberTrail lightsaberTrail; private void Start() { lightsaberTrail = ((Component)this).GetComponent<LightsaberTrail>(); } private void Update() { lightsaberTrail.Iterate(Time.time); lightsaberTrail.UpdateTrail(Time.time, 0f); } } namespace JerryAr.ShotGun_Shouldering { [BepInPlugin("JerryAr.ShotGun_Shouldering", "ShotGun_Shouldering", "1.3.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] public class ShotGun_ShoulderingPlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "JerryAr.ShotGun_Shouldering"); } } } namespace JerryShotGun { [BepInPlugin("JerryShotGun", "JSG", "1.0.0")] [BepInProcess("h3vr.exe")] public class JerryShotGunShoulder : BaseUnityPlugin { private bool reverse = false; private bool isPalmable = true; private bool isLeftShoulder = true; private bool isActivated = true; private TubeFedShotgun Gun; private FVRQuickBeltSlot slot; private bool wasHarnessed = false; private FVRAlternateGrip Grip; private bool shouldered = false; private bool palmed = false; private GameObject shoulderpos; private GameObject headpos; private GameObject Gunholder; private GameObject Gunrot; private GameObject Gunref; private float shoulderdis = 0.25f; public static ConfigEntry<float> ShoulderDistance; public static ConfigEntry<bool> ShotGunShoulderingEnabled; public static ConfigEntry<bool> LeftShoulder; public static ConfigEntry<bool> ReverseGrabbing; public static ConfigEntry<bool> ShotGunShellPalmingEnabled; public static ConfigEntry<Vector3> PalmedRoundRotation; public static ConfigEntry<Vector3> PalmedRoundPosition; public static ConfigEntry<bool> Collision; private Vector3 Pos; private Vector3 Rot; private bool hasCol = true; private void Start() { //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_0042: Unknown result type (might be due to invalid IL or missing references) LoadConfigFile(); isActivated = ShotGunShoulderingEnabled.Value; isPalmable = ShotGunShellPalmingEnabled.Value; Pos = PalmedRoundPosition.Value; Rot = PalmedRoundRotation.Value; isLeftShoulder = LeftShoulder.Value; shoulderdis = ShoulderDistance.Value; hasCol = Collision.Value; reverse = ReverseGrabbing.Value; } private void LoadConfigFile() { //IL_00a4: 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) ShotGunShoulderingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "ShotGunShouldering", true, "Toggle the function (requires restart.)"); LeftShoulder = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "UseLeftShoulder", true, "Toggle the which shoulder you use to reload (requires restart.)"); ShoulderDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Float", "ShoulderDistance", 0.25f, "Change the distance of stock shouldering detection (requires restart.)"); ShotGunShellPalmingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "ShotGunShellPalming", true, "Toggle the function (requires restart.)"); PalmedRoundRotation = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Vector3", "PalmedRoundRotation", new Vector3(125f, 0f, 0f), "Change the Rotation of palmed shells (requires restart.)"); PalmedRoundPosition = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Vector3", "PalmedRoundPosition", new Vector3(0f, -0.05f, -0.05f), "Change the Position of palmed shells (requires restart.)"); Collision = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "ShellCollision", true, "Toggle the collider on shells (requires restart.)"); ReverseGrabbing = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "ReverseGrabbing", false, "Grab the gun with another hand."); } private void Update() { //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Expected O, but got Unknown //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Expected O, but got Unknown //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Expected O, but got Unknown //IL_00cc: 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) //IL_0219: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Expected O, but got Unknown //IL_1483: Unknown result type (might be due to invalid IL or missing references) //IL_148d: Expected O, but got Unknown //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_1531: Unknown result type (might be due to invalid IL or missing references) //IL_1555: Unknown result type (might be due to invalid IL or missing references) //IL_14b0: Unknown result type (might be due to invalid IL or missing references) //IL_14ba: Expected O, but got Unknown //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_150b: Unknown result type (might be due to invalid IL or missing references) //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_0913: Unknown result type (might be due to invalid IL or missing references) //IL_093e: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_1969: Unknown result type (might be due to invalid IL or missing references) //IL_1992: Unknown result type (might be due to invalid IL or missing references) //IL_19bd: Unknown result type (might be due to invalid IL or missing references) //IL_19e8: Unknown result type (might be due to invalid IL or missing references) //IL_1a09: Unknown result type (might be due to invalid IL or missing references) //IL_1a0e: Unknown result type (might be due to invalid IL or missing references) //IL_10a9: Unknown result type (might be due to invalid IL or missing references) //IL_10d2: Unknown result type (might be due to invalid IL or missing references) //IL_10fd: Unknown result type (might be due to invalid IL or missing references) //IL_1128: Unknown result type (might be due to invalid IL or missing references) //IL_1149: Unknown result type (might be due to invalid IL or missing references) //IL_114e: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_2128: Unknown result type (might be due to invalid IL or missing references) //IL_2151: Unknown result type (might be due to invalid IL or missing references) //IL_217c: Unknown result type (might be due to invalid IL or missing references) //IL_21a7: Unknown result type (might be due to invalid IL or missing references) //IL_21c8: Unknown result type (might be due to invalid IL or missing references) //IL_21cd: Unknown result type (might be due to invalid IL or missing references) //IL_169d: Unknown result type (might be due to invalid IL or missing references) //IL_16ad: Unknown result type (might be due to invalid IL or missing references) //IL_0ddd: Unknown result type (might be due to invalid IL or missing references) //IL_0ded: Unknown result type (might be due to invalid IL or missing references) //IL_0a4f: Unknown result type (might be due to invalid IL or missing references) //IL_0a78: Unknown result type (might be due to invalid IL or missing references) //IL_0aa3: Unknown result type (might be due to invalid IL or missing references) //IL_0ace: Unknown result type (might be due to invalid IL or missing references) //IL_0aef: Unknown result type (might be due to invalid IL or missing references) //IL_0af4: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_1e5c: Unknown result type (might be due to invalid IL or missing references) //IL_1e6c: Unknown result type (might be due to invalid IL or missing references) //IL_1ace: Unknown result type (might be due to invalid IL or missing references) //IL_1af7: Unknown result type (might be due to invalid IL or missing references) //IL_1b22: Unknown result type (might be due to invalid IL or missing references) //IL_1b4d: Unknown result type (might be due to invalid IL or missing references) //IL_1b6e: Unknown result type (might be due to invalid IL or missing references) //IL_1b73: Unknown result type (might be due to invalid IL or missing references) //IL_170f: Unknown result type (might be due to invalid IL or missing references) //IL_171f: Unknown result type (might be due to invalid IL or missing references) //IL_120e: Unknown result type (might be due to invalid IL or missing references) //IL_1237: Unknown result type (might be due to invalid IL or missing references) //IL_1262: Unknown result type (might be due to invalid IL or missing references) //IL_128d: Unknown result type (might be due to invalid IL or missing references) //IL_12ae: Unknown result type (might be due to invalid IL or missing references) //IL_12b3: Unknown result type (might be due to invalid IL or missing references) //IL_0e4f: Unknown result type (might be due to invalid IL or missing references) //IL_0e5f: Unknown result type (might be due to invalid IL or missing references) //IL_228d: Unknown result type (might be due to invalid IL or missing references) //IL_22b6: Unknown result type (might be due to invalid IL or missing references) //IL_22e1: Unknown result type (might be due to invalid IL or missing references) //IL_230c: Unknown result type (might be due to invalid IL or missing references) //IL_232d: Unknown result type (might be due to invalid IL or missing references) //IL_2332: Unknown result type (might be due to invalid IL or missing references) //IL_1ece: Unknown result type (might be due to invalid IL or missing references) //IL_1ede: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07f7: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_17e7: Unknown result type (might be due to invalid IL or missing references) //IL_180c: Unknown result type (might be due to invalid IL or missing references) //IL_1831: Unknown result type (might be due to invalid IL or missing references) //IL_1856: Unknown result type (might be due to invalid IL or missing references) //IL_1876: Unknown result type (might be due to invalid IL or missing references) //IL_1896: Unknown result type (might be due to invalid IL or missing references) //IL_0f27: Unknown result type (might be due to invalid IL or missing references) //IL_0f4c: Unknown result type (might be due to invalid IL or missing references) //IL_0f71: Unknown result type (might be due to invalid IL or missing references) //IL_0f96: Unknown result type (might be due to invalid IL or missing references) //IL_0fb6: Unknown result type (might be due to invalid IL or missing references) //IL_0fd6: Unknown result type (might be due to invalid IL or missing references) //IL_1fa6: Unknown result type (might be due to invalid IL or missing references) //IL_1fcb: Unknown result type (might be due to invalid IL or missing references) //IL_1ff0: Unknown result type (might be due to invalid IL or missing references) //IL_2015: Unknown result type (might be due to invalid IL or missing references) //IL_2035: Unknown result type (might be due to invalid IL or missing references) //IL_2055: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Gun == (Object)null || (Object)(object)Grip == (Object)null || (Object)(object)slot == (Object)null) { } if (isPalmable && shouldered && (Object)(object)Gun != (Object)null) { if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRFireArmRound>() != (Object)null) { FVRFireArmRound component = ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRFireArmRound>(); if ((Object)(object)component != (Object)null && component.RoundType == ((FVRFireArm)Gun).RoundType) { ((Component)component).gameObject.transform.SetParent(((Component)((FVRInteractiveObject)component).m_hand).gameObject.transform); ((Component)component).gameObject.transform.localPosition = Pos; ((Component)component).gameObject.transform.localEulerAngles = Rot; if (!hasCol) { ((FVRInteractiveObject)component).SetAllCollidersToLayer(false, "Interactable"); } else if (hasCol) { ((FVRInteractiveObject)component).SetAllCollidersToLayer(false, "Default"); } if (component.ProxyRounds.Count == 1) { component.ProxyRounds[0].GO.transform.localPosition = new Vector3(0f, 0f, -0.065f); } } } if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRFireArmRound>() != (Object)null) { FVRFireArmRound component2 = ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRFireArmRound>(); if ((Object)(object)component2 != (Object)null && component2.RoundType == ((FVRFireArm)Gun).RoundType) { ((Component)component2).gameObject.transform.SetParent(((Component)((FVRInteractiveObject)component2).m_hand).gameObject.transform); ((Component)component2).gameObject.transform.localPosition = Pos; ((Component)component2).gameObject.transform.localEulerAngles = Rot; if (!hasCol) { ((FVRInteractiveObject)component2).SetAllCollidersToLayer(false, "Interactable"); } else if (hasCol) { ((FVRInteractiveObject)component2).SetAllCollidersToLayer(false, "Default"); } if (component2.ProxyRounds.Count == 1) { component2.ProxyRounds[0].GO.transform.localPosition = new Vector3(0f, 0f, -0.065f); } } } } if (!isActivated || !((Object)(object)GM.CurrentMovementManager != (Object)null)) { return; } if ((Object)(object)Gunholder == (Object)null) { Gunholder = new GameObject("Gunholder"); Debug.Log((object)"GunHolder"); } if ((Object)(object)Gunrot == (Object)null) { Gunrot = new GameObject("Gunrot"); Debug.Log((object)"Gunrot"); } if ((Object)(object)Gunref == (Object)null) { Gunref = new GameObject("Gunref"); Debug.Log((object)"Gunref"); } if ((Object)(object)Gunholder != (Object)null && (Object)(object)Gunrot != (Object)null) { Gunholder.transform.rotation = Gunrot.transform.rotation; } if (isLeftShoulder) { if ((Object)(object)headpos == (Object)null) { headpos = new GameObject("HeadPos"); Debug.Log((object)"Headpos"); } if ((Object)(object)shoulderpos == (Object)null) { shoulderpos = new GameObject("ShoulderPos"); Debug.Log((object)"ShoulderPos"); if ((Object)(object)headpos != (Object)null) { shoulderpos.transform.SetParent(headpos.transform); shoulderpos.transform.localPosition = new Vector3(-0.15f, -0.1f, 0f); } } headpos.transform.position = ((Component)GM.CurrentMovementManager.Head).transform.position; headpos.transform.eulerAngles = ((Component)GM.CurrentMovementManager.Head).transform.eulerAngles; if (!reverse) { if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>() != (Object)null && ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>()).HasActiveShoulderStock) { Gun = ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>(); } if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)Gun != (Object)null && (Object)(object)shoulderpos != (Object)null && (Object)(object)headpos != (Object)null) { if ((Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>() != (Object)null) { Grip = ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>(); } if ((Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)(object)Gun) || (Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null)) { if (((FVRPhysicalObject)Gun).m_isHardnessed) { wasHarnessed = true; slot = ((FVRPhysicalObject)Gun).m_quickbeltSlot; slot.CurObject = null; ((FVRPhysicalObject)Gun).m_quickbeltSlot = null; ((FVRPhysicalObject)Gun).m_isHardnessed = false; } if (!shouldered) { Gunrot.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position; Gunrot.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles; Gunholder.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position; Gunholder.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles; Gunref.transform.position = ((Component)Gun).transform.position; Gunref.transform.eulerAngles = ((Component)Gun).transform.eulerAngles; ((FVRInteractiveObject)Gun).ForceBreakInteraction(); ((FVRInteractiveObject)Grip).ForceBreakInteraction(); ((FVRPhysicalObject)Gun).StoreAndDestroyRigidbody(); shouldered = true; } } } if (shouldered && GM.CurrentMovementManager.Hands[0].Input.GripPressed) { if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null) { Gunref.transform.SetParent(Gunholder.transform); ((Component)Gun).gameObject.transform.SetParent(Gunref.transform); ((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position; Gunrot.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position; LeftAxisLookAt(Gunrot.transform, shoulderpos.transform.position, Vector3.back); GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(false); } else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null) { if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)(object)Gun) { Gunref.transform.SetParent(Gunholder.transform); ((Component)Gun).gameObject.transform.SetParent(Gunref.transform); ((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position; Gunrot.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position; LeftAxisLookAt(Gunrot.transform, shoulderpos.transform.position, Vector3.back); GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(false); } else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun) { if (wasHarnessed && (Object)(object)slot != (Object)null) { ((FVRPhysicalObject)Gun).m_quickbeltSlot = slot; slot.CurObject = (FVRPhysicalObject)(object)Gun; ((FVRPhysicalObject)Gun).m_isHardnessed = true; wasHarnessed = false; } ((FVRInteractiveObject)Gun).BeginInteraction(GM.CurrentMovementManager.Hands[1]); ((FVRInteractiveObject)Grip).BeginInteraction(GM.CurrentMovementManager.Hands[0]); GM.CurrentMovementManager.Hands[0].ForceSetInteractable((FVRInteractiveObject)(object)Grip); shouldered = false; } } } else if (shouldered && !GM.CurrentMovementManager.Hands[0].Input.GripPressed) { if (wasHarnessed && (Object)(object)slot != (Object)null) { ((FVRPhysicalObject)Gun).m_quickbeltSlot = slot; slot.CurObject = (FVRPhysicalObject)(object)Gun; ((FVRPhysicalObject)Gun).m_isHardnessed = true; wasHarnessed = false; } ((Component)Gun).gameObject.transform.SetParent((Transform)null); ((FVRPhysicalObject)Gun).RecoverRigidbody(); GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(true); shouldered = false; } } if (reverse) { if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>() != (Object)null && ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>()).HasActiveShoulderStock) { Gun = ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>(); } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null && (Object)(object)Gun != (Object)null && (Object)(object)shoulderpos != (Object)null && (Object)(object)headpos != (Object)null) { if ((Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>() != (Object)null) { Grip = ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>(); } if ((Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)(object)Gun) || (Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null)) { if (((FVRPhysicalObject)Gun).m_isHardnessed) { wasHarnessed = true; slot = ((FVRPhysicalObject)Gun).m_quickbeltSlot; slot.CurObject = null; ((FVRPhysicalObject)Gun).m_quickbeltSlot = null; ((FVRPhysicalObject)Gun).m_isHardnessed = false; } if (!shouldered) { Gunrot.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position; Gunrot.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles; Gunholder.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position; Gunholder.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles; Gunref.transform.position = ((Component)Gun).transform.position; Gunref.transform.eulerAngles = ((Component)Gun).transform.eulerAngles; ((FVRInteractiveObject)Gun).ForceBreakInteraction(); ((FVRInteractiveObject)Grip).ForceBreakInteraction(); ((FVRPhysicalObject)Gun).StoreAndDestroyRigidbody(); shouldered = true; } } } if (shouldered && GM.CurrentMovementManager.Hands[1].Input.GripPressed) { if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null) { Gunref.transform.SetParent(Gunholder.transform); ((Component)Gun).gameObject.transform.SetParent(Gunref.transform); ((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position; Gunrot.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position; RightAxisLookAt(Gunrot.transform, shoulderpos.transform.position, Vector3.back); GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(false); } else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null) { if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)(object)Gun) { Gunref.transform.SetParent(Gunholder.transform); ((Component)Gun).gameObject.transform.SetParent(Gunref.transform); ((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position; Gunrot.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position; RightAxisLookAt(Gunrot.transform, shoulderpos.transform.position, Vector3.back); GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(false); } else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun) { if (wasHarnessed && (Object)(object)slot != (Object)null) { ((FVRPhysicalObject)Gun).m_quickbeltSlot = slot; slot.CurObject = (FVRPhysicalObject)(object)Gun; ((FVRPhysicalObject)Gun).m_isHardnessed = true; wasHarnessed = false; } ((FVRInteractiveObject)Gun).BeginInteraction(GM.CurrentMovementManager.Hands[0]); ((FVRInteractiveObject)Grip).BeginInteraction(GM.CurrentMovementManager.Hands[1]); GM.CurrentMovementManager.Hands[1].ForceSetInteractable((FVRInteractiveObject)(object)Grip); shouldered = false; } } } else if (shouldered && !GM.CurrentMovementManager.Hands[1].Input.GripPressed) { if (wasHarnessed && (Object)(object)slot != (Object)null) { ((FVRPhysicalObject)Gun).m_quickbeltSlot = slot; slot.CurObject = (FVRPhysicalObject)(object)Gun; ((FVRPhysicalObject)Gun).m_isHardnessed = true; wasHarnessed = false; } ((Component)Gun).gameObject.transform.SetParent((Transform)null); ((FVRPhysicalObject)Gun).RecoverRigidbody(); GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(true); shouldered = false; } } } if (isLeftShoulder) { return; } if ((Object)(object)headpos == (Object)null) { headpos = new GameObject("HeadPos"); Debug.Log((object)"Headpos"); } if ((Object)(object)shoulderpos == (Object)null) { shoulderpos = new GameObject("ShoulderPos"); Debug.Log((object)"ShoulderPos"); if ((Object)(object)headpos != (Object)null) { shoulderpos.transform.SetParent(headpos.transform); shoulderpos.transform.localPosition = new Vector3(0.15f, -0.1f, 0f); } } headpos.transform.position = ((Component)GM.CurrentMovementManager.Head).transform.position; headpos.transform.eulerAngles = ((Component)GM.CurrentMovementManager.Head).transform.eulerAngles; if (!reverse) { if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>() != (Object)null && ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>()).HasActiveShoulderStock) { Gun = ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>(); } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null && (Object)(object)Gun != (Object)null && (Object)(object)shoulderpos != (Object)null && (Object)(object)headpos != (Object)null) { if ((Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>() != (Object)null) { Grip = ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>(); } if ((Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)(object)Gun) || (Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null)) { if (((FVRPhysicalObject)Gun).m_isHardnessed) { wasHarnessed = true; slot = ((FVRPhysicalObject)Gun).m_quickbeltSlot; slot.CurObject = null; ((FVRPhysicalObject)Gun).m_quickbeltSlot = null; ((FVRPhysicalObject)Gun).m_isHardnessed = false; } if (!shouldered) { Gunholder.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position; Gunholder.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles; Gunrot.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position; Gunrot.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles; Gunref.transform.position = ((Component)Gun).transform.position; Gunref.transform.eulerAngles = ((Component)Gun).transform.eulerAngles; ((FVRInteractiveObject)Gun).ForceBreakInteraction(); ((FVRInteractiveObject)Grip).ForceBreakInteraction(); ((FVRPhysicalObject)Gun).StoreAndDestroyRigidbody(); shouldered = true; } } } if (shouldered && GM.CurrentMovementManager.Hands[1].Input.GripPressed) { if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null) { Gunref.transform.SetParent(Gunholder.transform); ((Component)Gun).gameObject.transform.SetParent(Gunref.transform); ((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position; Gunrot.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position; RightAxisLookAt(Gunrot.transform, shoulderpos.transform.position, Vector3.back); GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(false); } else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null) { if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)(object)Gun) { Gunref.transform.SetParent(Gunholder.transform); ((Component)Gun).gameObject.transform.SetParent(Gunref.transform); ((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position; Gunrot.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position; RightAxisLookAt(Gunrot.transform, shoulderpos.transform.position, Vector3.back); GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(false); } else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun) { if (wasHarnessed && (Object)(object)slot != (Object)null) { ((FVRPhysicalObject)Gun).m_quickbeltSlot = slot; slot.CurObject = (FVRPhysicalObject)(object)Gun; ((FVRPhysicalObject)Gun).m_isHardnessed = true; wasHarnessed = false; } ((FVRInteractiveObject)Gun).BeginInteraction(GM.CurrentMovementManager.Hands[0]); ((FVRInteractiveObject)Grip).BeginInteraction(GM.CurrentMovementManager.Hands[1]); GM.CurrentMovementManager.Hands[1].ForceSetInteractable((FVRInteractiveObject)(object)Grip); shouldered = false; } } } else if (shouldered && !GM.CurrentMovementManager.Hands[1].Input.GripPressed) { if (wasHarnessed && (Object)(object)slot != (Object)null) { ((FVRPhysicalObject)Gun).m_quickbeltSlot = slot; slot.CurObject = (FVRPhysicalObject)(object)Gun; ((FVRPhysicalObject)Gun).m_isHardnessed = true; wasHarnessed = false; } ((Component)Gun).gameObject.transform.SetParent((Transform)null); ((FVRPhysicalObject)Gun).RecoverRigidbody(); GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(true); shouldered = false; } } if (!reverse) { return; } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>() != (Object)null && ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>()).HasActiveShoulderStock) { Gun = ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>(); } if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)Gun != (Object)null && (Object)(object)shoulderpos != (Object)null && (Object)(object)headpos != (Object)null) { if ((Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>() != (Object)null) { Grip = ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>(); } if ((Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)(object)Gun) || (Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null)) { if (((FVRPhysicalObject)Gun).m_isHardnessed) { wasHarnessed = true; slot = ((FVRPhysicalObject)Gun).m_quickbeltSlot; slot.CurObject = null; ((FVRPhysicalObject)Gun).m_quickbeltSlot = null; ((FVRPhysicalObject)Gun).m_isHardnessed = false; } if (!shouldered) { Gunholder.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position; Gunholder.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles; Gunrot.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position; Gunrot.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles; Gunref.transform.position = ((Component)Gun).transform.position; Gunref.transform.eulerAngles = ((Component)Gun).transform.eulerAngles; ((FVRInteractiveObject)Gun).ForceBreakInteraction(); ((FVRInteractiveObject)Grip).ForceBreakInteraction(); ((FVRPhysicalObject)Gun).StoreAndDestroyRigidbody(); shouldered = true; } } } if (shouldered && GM.CurrentMovementManager.Hands[0].Input.GripPressed) { if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null) { Gunref.transform.SetParent(Gunholder.transform); ((Component)Gun).gameObject.transform.SetParent(Gunref.transform); ((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position; Gunrot.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position; LeftAxisLookAt(Gunrot.transform, shoulderpos.transform.position, Vector3.back); GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(false); } else { if (!((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null)) { return; } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)(object)Gun) { Gunref.transform.SetParent(Gunholder.transform); ((Component)Gun).gameObject.transform.SetParent(Gunref.transform); ((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position; Gunrot.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position; LeftAxisLookAt(Gunrot.transform, shoulderpos.transform.position, Vector3.back); GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(false); } else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun) { if (wasHarnessed && (Object)(object)slot != (Object)null) { ((FVRPhysicalObject)Gun).m_quickbeltSlot = slot; slot.CurObject = (FVRPhysicalObject)(object)Gun; ((FVRPhysicalObject)Gun).m_isHardnessed = true; wasHarnessed = false; } ((FVRInteractiveObject)Gun).BeginInteraction(GM.CurrentMovementManager.Hands[1]); ((FVRInteractiveObject)Grip).BeginInteraction(GM.CurrentMovementManager.Hands[0]); GM.CurrentMovementManager.Hands[0].ForceSetInteractable((FVRInteractiveObject)(object)Grip); shouldered = false; } } } else if (shouldered && !GM.CurrentMovementManager.Hands[0].Input.GripPressed) { if (wasHarnessed && (Object)(object)slot != (Object)null) { ((FVRPhysicalObject)Gun).m_quickbeltSlot = slot; slot.CurObject = (FVRPhysicalObject)(object)Gun; ((FVRPhysicalObject)Gun).m_isHardnessed = true; wasHarnessed = false; } ((Component)Gun).gameObject.transform.SetParent((Transform)null); ((FVRPhysicalObject)Gun).RecoverRigidbody(); GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(true); shouldered = false; } } private void LeftAxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0016: 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_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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 refere