Decompiled source of Ratio v0.6.3
Ratio.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using Il2Cpp; using Il2CppActiveRagdoll; using Il2CppDinoFracture; using Il2CppHexabodyVR.PlayerController; using Il2CppHurricaneVR.Framework.Core; using Il2CppHurricaneVR.Framework.Core.Grabbers; using Il2CppHurricaneVR.Framework.Shared; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MelonLoader; using Microsoft.CodeAnalysis; using RatioMod; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.XR; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Core), "Ratio 7:3", "0.6.3", "coope", null)] [assembly: MelonGame("Kubunautilus", "BrutalistickVR")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Ratio")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Ratio")] [assembly: AssemblyTitle("Ratio")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RatioMod { public class Core : MelonMod { private struct SpeedSample { public Vector3 Position; public float Time; } private class HeldColliderCache { public HVRGrabbable Held; public Collider[] Colliders; public float NextRefresh; } private class LightningBranch { public GameObject Obj; public LineRenderer Core; public LineRenderer Edge; public Vector3[] Points; public List<GameObject> EndOrbs = new List<GameObject>(); public bool OrbsSpawned; } private class MarkerTick { public Transform Tr; public float Delay; } private class ImpactParticle { public GameObject Obj; public Vector3 Velocity; public Vector3 BaseScale; public float Gravity; public float Life; public float Age; public bool Align; public bool Spin; public bool Shrink; } private class WeakCandidate { public Transform Part; public Collider Collider; public string Name; public Vector3 Position { get { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0036: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Part != (Object)null) { return Part.position; } if ((Object)(object)Collider != (Object)null) { Bounds bounds = Collider.bounds; return ((Bounds)(ref bounds)).center; } return Vector3.zero; } } } private const float WeakRadius = 0.28f; private const float MinSwingSpeed = 2f; private const float CritCooldown = 0.55f; private const float TargetRefresh = 0.35f; private const float TargetCacheRefresh = 2f; private const float TargetRetry = 0.4f; private const float MaxTargetDistance = 16f; private const float MaxTargetAngle = 40f; private const float MaxHitDistance = 4.5f; private const float MarkerLineGrowTime = 0.18f; private const float MarkerTickGrowTime = 0.13f; private const float MarkerRingGrowTime = 0.2f; private const float MarkerDetachHoldTime = 0.12f; private const float MarkerDetachFadeTime = 1.6f; private const float MarkerWidthFactor = 0.13f; private const float MarkerWidthMin = 0.7f; private const float MarkerWidthMax = 1.6f; private const float MarkerLineCoreHeight = 0.008f; private const float MarkerLineOutlineHeight = 0.018f; private const float MarkerTickHeight = 0.1f; private const float MarkerEndHeight = 0.26f; private const float MarkerRingRadius = 0.075f; private const int ImpactSparks = 30; private const int ImpactStreaks = 14; private const int ImpactSlabs = 9; private const int ImpactBloodDecals = 8; private const int ImpactRedRain = 6; private const string BlackFlashSoundKey = "blackflash"; private const string RatioOnSoundKey = "ratio_on"; private const string RatioOffSoundKey = "ratio_off"; private const string FractureSoundKey = "fracture"; private const int BlackFlashVolume = 100; private const int RatioOnVolume = 100; private const int RatioOffVolume = 100; private const int FractureVolume = 100; private const int BfMainBranches = 14; private const float BfMainLengthMin = 3f; private const float BfMainLengthMax = 5f; private const float BfMainWidthStart = 0.1f; private const float BfMainWidthEnd = 0.008f; private const float BfGrowEndTime = 0.7f; private const float BfCollapseStartTime = 0.28f; private const float BfTotalDuration = 0.98f; private const float BfEndOrbSize = 0.015f; private const int BfCubeFragments = 15; private const float BfCubeLifetime = 0.5f; private const int BfMidBranches = 8; private const float BfMidLengthMin = 1.2f; private const float BfMidLengthMax = 2.5f; private const float BfMidWidthStart = 0.05f; private const float BfMidWidthEnd = 0.004f; private const float BfMidScatterMin = 0.8f; private const float BfMidScatterMax = 2f; private const int BfSmallBranches = 12; private const float BfSmallLengthMin = 0.5f; private const float BfSmallLengthMax = 1.1f; private const float BfSmallWidthStart = 0.025f; private const float BfSmallWidthEnd = 0.002f; private const float BfSmallScatterMin = 2f; private const float BfSmallScatterMax = 4f; private const float BfSmallCollapseDelay = 0.3f; private static readonly Color MarkerWhiteColor = new Color(1f, 1f, 1f, 1f); private static readonly Color MarkerBlackColor = new Color(0.015f, 0.015f, 0.015f, 1f); private static readonly Color MarkerRedColor = new Color(0.92f, 0.02f, 0.02f, 1f); private static readonly Color BfCoreColor = new Color(0.18f, 0.01f, 0.02f, 1f); private static readonly Color BfEdgeColor = new Color(1f, 0.06f, 0.04f, 0.9f); private static readonly Color BfInnerGlow = new Color(0.85f, 0.03f, 0.02f, 1f); private static readonly Color BfOrbColor = new Color(0.3f, 0.01f, 0.01f, 1f); private static readonly Color BfCubeColor = new Color(0.1f, 0.005f, 0.005f, 1f); private HexaBodyPlayer4 _body; private Transform _rig; private Transform _camera; private HVRHandGrabber _leftHand; private HVRHandGrabber _rightHand; private HVRHexaBodyInputs _inputs; private bool _inputBoundLogged; private float _nextInputWarn; private GameObject _marker; private Transform _markerTransform; private Transform _markerLineCore; private Transform _markerLineOutline; private Transform _markerRing; private Transform _markerFlash; private MeshRenderer _markerFlashRenderer; private Material _markerWhiteMat; private Material _markerBlackMat; private Material _markerRedMat; private Material _markerFlashMat; private Mesh _markerQuadMesh; private Mesh _markerRingMesh; private Mesh _markerRingOutlineMesh; private Texture2D _whiteTex; private float _markerAppearStart = -1f; private bool _markerDetached; private float _markerDetachStart; private Vector3 _markerDetachPosition; private Quaternion _markerDetachRotation; private Vector3 _markerDetachScale; private bool _markerFailed; private readonly List<MarkerTick> _markerTicks = new List<MarkerTick>(); private StickHealth _target; private StickHealth[] _targetCache; private float _nextTargetCache; private Transform _weakPart; private Collider _weakCollider; private string _weakName; private bool _ratioActive; private bool _bHeld; private float _nextScan; private float _nextTargetScan; private float _nextHitAllowed; private bool _disabled; private readonly Dictionary<StickHealth, float> _lastCrit = new Dictionary<StickHealth, float>(); private readonly Dictionary<int, SpeedSample> _samples = new Dictionary<int, SpeedSample>(); private readonly Dictionary<int, HeldColliderCache> _heldColliders = new Dictionary<int, HeldColliderCache>(); private Shader _bfLineShader; private Shader _bfSolidShader; private float _nextBlackFlashTime; private bool _soundReady; public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("Ratio 7:3 0.6.3 loaded"); LoadSounds(); } public override void OnApplicationQuit() { RatioSound.Close(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { Cleanup(); _disabled = sceneName == "MainMenuScene" || sceneName == "IntroScene"; _nextScan = 0f; _nextTargetScan = 0f; _markerFailed = false; _bHeld = false; _rig = null; _inputBoundLogged = false; _nextInputWarn = 0f; } public override void OnUpdate() { if (_disabled) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime >= _nextScan) { _nextScan = unscaledTime + 1f; FindPlayer(); } UpdateActivation(); if (!((Object)(object)_body == (Object)null) && !((Object)(object)_camera == (Object)null)) { if (!_ratioActive) { HideMarker(); return; } UpdateMarker(unscaledTime); UpdateHits(unscaledTime); } } private void FindPlayer() { if ((Object)(object)_body == (Object)null) { _body = Object.FindObjectOfType<HexaBodyPlayer4>(); } if ((Object)(object)_rig == (Object)null) { _rig = FindRig(); } if ((Object)(object)_camera == (Object)null && (Object)(object)_body != (Object)null) { _camera = _body.Camera; } if ((Object)(object)_leftHand == (Object)null) { _leftHand = FindHand("Physics LeftHand"); } if ((Object)(object)_rightHand == (Object)null) { _rightHand = FindHand("Physics RightHand"); } if ((Object)(object)_inputs == (Object)null) { _inputs = FindInputs(); } if ((Object)(object)_inputs != (Object)null && !_inputBoundLogged) { _inputBoundLogged = true; ((MelonBase)this).LoggerInstance.Msg("Ratio: inputs bound, rig=" + ((Object)(object)_rig != (Object)null)); } if ((Object)(object)_inputs == (Object)null && (Object)(object)_body != (Object)null && Time.unscaledTime >= _nextInputWarn) { _nextInputWarn = Time.unscaledTime + 5f; ((MelonBase)this).LoggerInstance.Warning("Ratio: HVR input not found yet"); } } private Transform FindRig() { GameObject val = GameObject.Find("Hexa4Rig26.10.23"); if ((Object)(object)val == (Object)null) { Transform[] array = Il2CppArrayBase<Transform>.op_Implicit(Object.FindObjectsOfType<Transform>(false)); foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null) && ((Object)val2).name.StartsWith("Hexa4Rig", StringComparison.OrdinalIgnoreCase)) { val = ((Component)val2).gameObject; break; } } } if ((Object)(object)val != (Object)null) { return val.transform; } if ((Object)(object)_body != (Object)null) { return ((Component)_body).transform.root; } return null; } private HVRHexaBodyInputs FindInputs() { if ((Object)(object)_rig != (Object)null) { try { HVRHexaBodyInputs componentInChildren = ((Component)_rig).GetComponentInChildren<HVRHexaBodyInputs>(); if ((Object)(object)componentInChildren != (Object)null) { return componentInChildren; } } catch (Exception) { } } try { HVRHexaBodyInputs val = Object.FindObjectOfType<HVRHexaBodyInputs>(); if ((Object)(object)val != (Object)null) { return val; } } catch (Exception) { } if ((Object)(object)_body != (Object)null) { try { HVRHexaBodyInputs componentInChildren2 = ((Component)_body).GetComponentInChildren<HVRHexaBodyInputs>(); if ((Object)(object)componentInChildren2 != (Object)null) { return componentInChildren2; } } catch (Exception) { } } try { HexaBodyInputsBase inputs = HexaBodyPlayer4.Inputs; if ((Object)(object)inputs != (Object)null) { HVRHexaBodyInputs val2 = ((Il2CppObjectBase)inputs).TryCast<HVRHexaBodyInputs>(); if ((Object)(object)val2 != (Object)null) { return val2; } } } catch (Exception) { } return null; } private HVRHandGrabber FindHand(string name) { Transform val = (((Object)(object)_body != (Object)null) ? ((Component)_body).transform.root : null); Transform val2 = null; if ((Object)(object)val != (Object)null) { val2 = val.Find(name); } if ((Object)(object)val2 == (Object)null) { GameObject val3 = GameObject.Find(name); if ((Object)(object)val3 != (Object)null) { val2 = val3.transform; } } if ((Object)(object)val2 == (Object)null) { return null; } return ((Component)val2).GetComponent<HVRHandGrabber>(); } private void UpdateActivation() { bool flag = ReadRatioButton(); if (flag && !_bHeld) { ToggleRatio(); } _bHeld = flag; } private bool ReadRatioButton() { bool flag = false; if ((Object)(object)_inputs != (Object)null) { flag = IsButtonPressed(_inputs.RightController) || IsButtonPressed(_inputs.LeftController); } if (!flag) { flag = ReadXrButton(); } return flag; } private bool IsButtonPressed(HVRController controller) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0034: 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_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)controller == (Object)null) { return false; } try { if ((int)controller.ControllerType == 3) { return controller.TrackpadButtonState.Active || controller.MenuButtonState.Active; } return controller.SecondaryButtonState.Active; } catch (Exception) { return false; } } private bool ReadXrButton() { try { if (ReadXrButton((XRNode)5)) { return true; } return ReadXrButton((XRNode)4); } catch (Exception) { return false; } } private bool ReadXrButton(XRNode node) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode(node); if (!((InputDevice)(ref deviceAtXRNode)).isValid) { return false; } bool flag = default(bool); return ((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.secondaryButton, ref flag) && flag; } private void ToggleRatio() { _ratioActive = !_ratioActive; if (_ratioActive) { _target = FindTarget(); ClearWeakPoint(); _markerAppearStart = -1f; if ((Object)(object)_target != (Object)null) { SelectWeakPoint(_target); } _nextTargetScan = Time.unscaledTime + 0.35f; ((MelonBase)this).LoggerInstance.Msg("Ratio ON point=" + (_weakName ?? "-") + " target=" + ((Object)(object)_target != (Object)null)); RatioSound.Play("ratio_on"); } else { _target = null; ClearWeakPoint(); HideMarker(); ((MelonBase)this).LoggerInstance.Msg("Ratio OFF"); RatioSound.Play("ratio_off"); } } private void UpdateMarker(float now) { //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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) if ((Object)(object)_marker == (Object)null) { if (!_markerFailed) { try { BuildMarker(); } catch (Exception ex) { _markerFailed = true; ((MelonBase)this).LoggerInstance.Warning("Marker build failed: " + ex.Message); } } if ((Object)(object)_marker == (Object)null) { return; } } if (_markerDetached) { UpdateDetachedMarker(now); return; } if (now >= _nextTargetScan) { _nextTargetScan = now + 0.35f; if (!IsTargetStillValid(_target)) { StickHealth target = _target; _target = FindTarget(); if ((Object)(object)_target != (Object)(object)target) { ClearWeakPoint(); _markerAppearStart = -1f; if ((Object)(object)_target != (Object)null) { SelectWeakPoint(_target); } } } } if ((Object)(object)_target == (Object)null || _target.isDead || !((Component)_target).gameObject.activeInHierarchy) { HideMarker(); return; } if ((Object)(object)_weakPart == (Object)null && (Object)(object)_weakCollider == (Object)null) { SelectWeakPoint(_target); } else if ((Object)(object)_weakPart != (Object)null && !((Component)_weakPart).gameObject.activeInHierarchy) { SelectWeakPoint(_target); } else if ((Object)(object)_weakCollider != (Object)null && (!_weakCollider.enabled || !((Component)_weakCollider).gameObject.activeInHierarchy)) { SelectWeakPoint(_target); } Vector3 weakPoint = GetWeakPoint(_target); Vector3 val = _camera.position - weakPoint; if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.up; } float num = Mathf.Clamp(((Vector3)(ref val)).magnitude * 0.13f, 0.7f, 1.6f); Vector3 val2 = weakPoint + ((Vector3)(ref val)).normalized * (0.12f + num * 0.04f); _markerTransform.position = val2; Vector3 val3 = _camera.position - val2; if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f) { val3 = _camera.forward; } Vector3 val4 = ((Mathf.Abs(Vector3.Dot(((Vector3)(ref val3)).normalized, Vector3.up)) > 0.99f) ? Vector3.forward : Vector3.up); _markerTransform.rotation = Quaternion.LookRotation(val3, val4); if (_markerAppearStart < 0f) { _markerAppearStart = now; } float num2 = 1f + Mathf.Sin(now * 6f) * 0.015f + Mathf.Sin(now * 13f) * 0.004f; float num3 = num * num2; _markerTransform.localScale = new Vector3(num3, num3, 1f); AnimateMarker(now - _markerAppearStart); if (!_marker.activeSelf) { _marker.SetActive(true); } } private void UpdateDetachedMarker(float now) { //IL_0045: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_marker == (Object)null || (Object)(object)_markerTransform == (Object)null) { _markerDetached = false; return; } float num = Mathf.Clamp01((now - _markerDetachStart - 0.12f) / 1.6f); _markerTransform.position = _markerDetachPosition; _markerTransform.rotation = _markerDetachRotation; _markerTransform.localScale = _markerDetachScale * (1f - num * num * 0.1f); SetMarkerAlpha(1f - num); if (!_marker.activeSelf) { _marker.SetActive(true); } if (!(num < 1f)) { HideMarker(); _target = null; ClearWeakPoint(); _nextTargetScan = now + 0.35f; } } private void DetachMarker(float now) { //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0092: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_marker == (Object)null) && !((Object)(object)_markerTransform == (Object)null)) { _markerDetached = true; _markerDetachStart = now; _markerDetachPosition = _markerTransform.position; _markerDetachRotation = _markerTransform.rotation; _markerDetachScale = _markerTransform.localScale; _markerAppearStart = -1f; if ((Object)(object)_markerFlashRenderer != (Object)null) { SetRendererColor((Renderer)(object)_markerFlashRenderer, new Color(1f, 1f, 1f, 0f)); } } } private void SetMarkerAlpha(float alpha) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) alpha = Mathf.Clamp01(alpha); SetMarkerMaterialAlpha(_markerWhiteMat, MarkerWhiteColor, alpha); SetMarkerMaterialAlpha(_markerBlackMat, MarkerBlackColor, alpha * alpha); SetMarkerMaterialAlpha(_markerRedMat, MarkerRedColor, alpha); } private static void SetMarkerMaterialAlpha(Material material, Color color, float alpha) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)material == (Object)null)) { color.a *= alpha; material.SetColor("_BaseColor", color); material.SetColor("_Color", color); } } private void AnimateMarker(float elapsed) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) float num = EaseOutCubic(Mathf.Clamp01(elapsed / 0.18f)); float num2 = Mathf.Lerp(0.035f, 1f, num); if ((Object)(object)_markerLineCore != (Object)null) { _markerLineCore.localScale = new Vector3(0.98f * num2, 0.008f, 1f); } if ((Object)(object)_markerLineOutline != (Object)null) { _markerLineOutline.localScale = new Vector3(num2, 0.018f, 1f); } float t = Mathf.Clamp01(elapsed / 0.2f); float num3 = Mathf.Lerp(0.15f, 1f, EaseOutBack(t)); if ((Object)(object)_markerRing != (Object)null) { _markerRing.localScale = new Vector3(num3, num3, 1f); } for (int i = 0; i < _markerTicks.Count; i++) { MarkerTick markerTick = _markerTicks[i]; if (markerTick != null && !((Object)(object)markerTick.Tr == (Object)null)) { float num4 = EaseOutBack(Mathf.Clamp01((elapsed - markerTick.Delay) / 0.13f)); markerTick.Tr.localScale = new Vector3(1f, num4, 1f); } } if ((Object)(object)_markerFlash != (Object)null && (Object)(object)_markerFlashRenderer != (Object)null) { float num5 = Mathf.Clamp01(elapsed / 0.18f); float num6 = 0.2f + EaseOutCubic(num5) * 0.9f; _markerFlash.localScale = new Vector3(num6, num6, 1f); SetRendererColor((Renderer)(object)_markerFlashRenderer, new Color(1f, 1f, 1f, (1f - num5) * (1f - num5) * 0.45f)); } } private void UpdateHits(float now) { //IL_0036: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (_markerDetached || (Object)(object)_target == (Object)null || _target.isDead || now < _nextHitAllowed) { return; } Vector3 weakPoint = GetWeakPoint(_target); if (!(Vector3.Distance(weakPoint, _camera.position) > 4.5f)) { HVRGrabbable held = GetHeld(_leftHand); HVRGrabbable held2 = GetHeld(_rightHand); if ((IsEnemyPart(held) || !CheckHand(_leftHand, held, weakPoint, now)) && !IsEnemyPart(held2)) { CheckHand(_rightHand, held2, weakPoint, now); } } } private bool IsEnemyPart(HVRGrabbable held) { if ((Object)(object)held == (Object)null) { return false; } try { if ((Object)(object)((Component)held).GetComponentInParent<StickHealth>() != (Object)null) { return true; } } catch (Exception) { } return false; } private bool CheckHand(HVRHandGrabber hand, HVRGrabbable held, Vector3 weak, float now) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hand == (Object)null) { return false; } if ((Object)(object)held == (Object)null) { if (Vector3.Distance(((Component)hand).transform.position, weak) > 0.28f) { return false; } if (GetSpeed(((Component)hand).transform, now) < 2f) { return false; } DoCrit(_target, weak, ((Component)hand).transform.position, now); return true; } if (GetSpeed(((Component)held).transform, now) < 2f) { return false; } if (!HeldTouches(held, weak)) { return false; } DoFractureCrit(_target, weak, ((Component)held).transform.position, now); return true; } private HVRGrabbable GetHeld(HVRHandGrabber hand) { if ((Object)(object)hand == (Object)null) { return null; } try { HVRGrabbable heldObject = ((HVRGrabberBase)hand).HeldObject; if ((Object)(object)heldObject != (Object)null && heldObject.IsBeingHeld && ((Component)heldObject).gameObject.activeInHierarchy) { return heldObject; } heldObject = ((HVRGrabberBase)hand).GrabbedTarget; if ((Object)(object)heldObject != (Object)null && heldObject.IsBeingHeld && ((Component)heldObject).gameObject.activeInHierarchy) { return heldObject; } } catch (Exception) { } return null; } private bool HeldTouches(HVRGrabbable held, Vector3 weak) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)held == (Object)null) { return false; } Collider[] heldColliders = GetHeldColliders(held); bool flag = false; if (heldColliders != null) { foreach (Collider val in heldColliders) { if ((Object)(object)val == (Object)null || !val.enabled || val.isTrigger) { continue; } flag = true; Bounds bounds = val.bounds; if (!(((Bounds)(ref bounds)).SqrDistance(weak) > 0.0784f)) { Vector3 val2 = val.ClosestPoint(weak) - weak; if (((Vector3)(ref val2)).sqrMagnitude <= 0.0784f) { return true; } } } } if (!flag) { return Vector3.Distance(((Component)held).transform.position, weak) <= 0.28f; } return false; } private Collider[] GetHeldColliders(HVRGrabbable held) { int instanceID = ((Object)held).GetInstanceID(); float unscaledTime = Time.unscaledTime; if (_heldColliders.TryGetValue(instanceID, out var value) && (Object)(object)value.Held == (Object)(object)held && value.Colliders != null && unscaledTime < value.NextRefresh) { return value.Colliders; } Collider[] array = Il2CppArrayBase<Collider>.op_Implicit(((Component)held).GetComponentsInChildren<Collider>(true)); _heldColliders[instanceID] = new HeldColliderCache { Held = held, Colliders = array, NextRefresh = unscaledTime + 2f }; return array; } private float GetSpeed(Transform t, float now) { //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_00a6: 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_00ca: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)t == (Object)null) { return 0f; } int instanceID = ((Object)t).GetInstanceID(); if (!_samples.TryGetValue(instanceID, out var value)) { _samples[instanceID] = new SpeedSample { Position = t.position, Time = now }; return 0f; } float num = now - value.Time; if (num <= 0.0001f) { return 0f; } if (num > 0.25f) { _samples[instanceID] = new SpeedSample { Position = t.position, Time = now }; return 0f; } float result = Vector3.Distance(t.position, value.Position) / num; _samples[instanceID] = new SpeedSample { Position = t.position, Time = now }; return result; } private void DoCrit(StickHealth enemy, Vector3 weak, Vector3 hitPoint, float now) { //IL_0069: 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_0079: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00db: 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_00e9: 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_0098: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)enemy == (Object)null) && !enemy.isDead && (!_lastCrit.TryGetValue(enemy, out var value) || !(now - value < 0.55f))) { _lastCrit[enemy] = now; _nextHitAllowed = now + 0.12f; float stickStartHealth = enemy.StickStartHealth; float damage = Mathf.Max(220f, stickStartHealth * 0.6f); Vector3 push = ((Component)enemy).transform.position - _camera.position; if (((Vector3)(ref push)).sqrMagnitude < 0.01f) { push = _camera.forward; } Vector3 val = ((Vector3)(ref push)).normalized + Vector3.up * 0.35f; push = ((Vector3)(ref val)).normalized * 90f; ApplyDamage(enemy, hitPoint, damage, push); DetachMarker(now); SpawnMarkerHitPulse(weak); SpawnBlackFlash(hitPoint); PlayBlackFlashSound(hitPoint); ((MelonBase)this).LoggerInstance.Msg("7:3 crit on '" + ((Object)((Component)enemy).gameObject).name + "' point=" + (_weakName ?? "-") + " dmg=" + damage.ToString("F0")); } } private void DoFractureCrit(StickHealth enemy, Vector3 weak, Vector3 hitPoint, float now) { //IL_012c: 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_0091: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemy == (Object)null || enemy.isDead || (_lastCrit.TryGetValue(enemy, out var value) && now - value < 0.55f)) { return; } _lastCrit[enemy] = now; _nextHitAllowed = now + 0.12f; RatioSound.Play("fracture"); SliceOnInputCustom val = FindSlicer(enemy, weak); if ((Object)(object)val == (Object)null) { ((MelonBase)this).LoggerInstance.Warning("7:3 fracture missing on '" + (_weakName ?? "-") + "'"); ApplyFractureDamage(enemy, hitPoint); return; } try { string text = _weakName ?? ""; if (text != "Head" && text != "Pelvis") { TransferJointsOnFractureCustom componentInParent = ((Component)val).GetComponentInParent<TransferJointsOnFractureCustom>(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.DistanceTolerance = 0f; } } val.ForceFracture(); ((MelonBase)this).LoggerInstance.Msg("7:3 fracture on '" + ((Object)((Component)enemy).gameObject).name + "' point=" + text); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("7:3 fracture failed: " + ex.Message); ApplyFractureDamage(enemy, hitPoint); } } private SliceOnInputCustom FindSlicer(StickHealth enemy, Vector3 weak) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_0086: Unknown result type (might be due to invalid IL or missing references) SliceOnInputCustom val = GetSlicer(_weakPart); if ((Object)(object)val != (Object)null) { return val; } if ((Object)(object)_weakCollider != (Object)null) { val = GetSlicer(((Component)_weakCollider).transform); if ((Object)(object)val != (Object)null) { return val; } } if ((Object)(object)enemy == (Object)null) { return null; } try { Il2CppArrayBase<SliceOnInputCustom> componentsInChildren = ((Component)enemy).GetComponentsInChildren<SliceOnInputCustom>(true); float num = float.MaxValue; for (int i = 0; i < componentsInChildren.Length; i++) { SliceOnInputCustom val2 = componentsInChildren[i]; if (!((Object)(object)val2 == (Object)null)) { Vector3 val3 = ((Component)val2).transform.position - weak; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; val = val2; } } } } catch (Exception) { } return val; } private SliceOnInputCustom GetSlicer(Transform part) { if ((Object)(object)part == (Object)null) { return null; } try { SliceOnInputCustom component = ((Component)part).GetComponent<SliceOnInputCustom>(); if ((Object)(object)component != (Object)null) { return component; } component = ((Component)part).GetComponentInParent<SliceOnInputCustom>(); if ((Object)(object)component != (Object)null) { return component; } return ((Component)part).GetComponentInChildren<SliceOnInputCustom>(true); } catch (Exception) { return null; } } private void ApplyFractureDamage(StickHealth enemy, Vector3 hitPoint) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0063: 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_0072: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)enemy == (Object)null) && !enemy.isDead) { float stickStartHealth = enemy.StickStartHealth; float damage = Mathf.Max(220f, stickStartHealth * 0.6f); Vector3 push = ((Component)enemy).transform.position - _camera.position; if (((Vector3)(ref push)).sqrMagnitude < 0.01f) { push = _camera.forward; } Vector3 val = ((Vector3)(ref push)).normalized + Vector3.up * 0.35f; push = ((Vector3)(ref val)).normalized * 90f; ApplyDamage(enemy, hitPoint, damage, push); } } private bool IsTargetStillValid(StickHealth enemy) { //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) //IL_0047: 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) if ((Object)(object)enemy == (Object)null || enemy.isDead || !((Component)enemy).gameObject.activeInHierarchy) { return false; } if ((Object)(object)_camera == (Object)null) { return false; } Vector3 val = AimPoint(enemy) - _camera.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.5f || magnitude > 18f) { return false; } return Vector3.Angle(_camera.forward, val) <= 52f; } private Vector3 AimPoint(StickHealth enemy) { //IL_0009: 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_0039: 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_0028: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemy == (Object)null) { return Vector3.zero; } if ((Object)(object)enemy.upperChest != (Object)null) { return enemy.upperChest.transform.position; } return ((Component)enemy).transform.position + Vector3.up; } private Vector3 GetWeakPoint(StickHealth enemy) { //IL_0009: 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_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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemy == (Object)null) { return Vector3.zero; } if ((Object)(object)_weakPart != (Object)null && ((Component)_weakPart).gameObject.activeInHierarchy) { return _weakPart.position; } if ((Object)(object)_weakCollider != (Object)null && _weakCollider.enabled && ((Component)_weakCollider).gameObject.activeInHierarchy) { Bounds bounds = _weakCollider.bounds; return ((Bounds)(ref bounds)).center; } if ((Object)(object)enemy.upperChest != (Object)null) { return enemy.upperChest.transform.position; } return ((Component)enemy).transform.position + Vector3.up; } private void SelectWeakPoint(StickHealth enemy) { ClearWeakPoint(); if ((Object)(object)enemy == (Object)null) { return; } List<WeakCandidate> list = new List<WeakCandidate>(); List<WeakCandidate> list2 = new List<WeakCandidate>(); AddBodyPart(enemy.upperChest, list, list2); AddBodyPart(enemy.pelvisGo, list, list2); AddBodyPart(enemy.jawBone, list, list2); if (enemy.bodyParts != null) { for (int i = 0; i < ((Il2CppArrayBase<GameObject>)(object)enemy.bodyParts).Length; i++) { AddBodyPart(((Il2CppArrayBase<GameObject>)(object)enemy.bodyParts)[i], list, list2); } } if (list.Count == 0 && list2.Count == 0) { AddColliders(enemy, list2); } List<WeakCandidate> list3 = list; if (list3.Count == 0) { list3 = list2; } if (list3.Count == 0) { _weakName = "chest"; _weakPart = (((Object)(object)enemy.upperChest != (Object)null) ? enemy.upperChest.transform : null); return; } WeakCandidate weakCandidate = list3[Random.Range(0, list3.Count)]; _weakPart = weakCandidate.Part; _weakCollider = weakCandidate.Collider; _weakName = weakCandidate.Name; } private void AddBodyPart(GameObject part, List<WeakCandidate> preferred, List<WeakCandidate> other) { //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) if ((Object)(object)part == (Object)null) { return; } string name = ((Object)part).name; string text = name.ToLowerInvariant(); if (!text.Contains("hand") && !text.Contains("finger") && !text.Contains("thumb") && !text.Contains("toe") && !text.Contains("foot") && IsBodyName(text)) { Vector3 position = part.transform.position; if (!(((Vector3)(ref position)).sqrMagnitude < 0.0001f)) { bool flag = text.Contains("shoulder") || text.Contains("arm") || text.Contains("hip") || text.Contains("leg") || text.Contains("thigh") || text.Contains("knee") || text.Contains("calf") || text.Contains("shin"); AddCandidate(flag ? other : preferred, part.transform, null, name); } } } private bool IsBodyName(string lower) { if (!lower.Contains("head") && !lower.Contains("neck") && !lower.Contains("chest") && !lower.Contains("spine") && !lower.Contains("torso") && !lower.Contains("pelvis") && !lower.Contains("hip") && !lower.Contains("shoulder") && !lower.Contains("arm") && !lower.Contains("leg") && !lower.Contains("thigh") && !lower.Contains("knee") && !lower.Contains("calf") && !lower.Contains("shin")) { return lower.Contains("jaw"); } return true; } private void AddColliders(StickHealth enemy, List<WeakCandidate> other) { //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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (enemy.bodyColliders == null) { return; } for (int i = 0; i < ((Il2CppArrayBase<Collider>)(object)enemy.bodyColliders).Length; i++) { Collider val = ((Il2CppArrayBase<Collider>)(object)enemy.bodyColliders)[i]; if ((Object)(object)val == (Object)null || !val.enabled || val.isTrigger) { continue; } string text = ((Object)val).name.ToLowerInvariant(); if (!text.Contains("hand") && !text.Contains("finger") && !text.Contains("thumb") && !text.Contains("toe") && !text.Contains("foot")) { Bounds bounds = val.bounds; Vector3 size = ((Bounds)(ref bounds)).size; if (!(((Vector3)(ref size)).sqrMagnitude < 0.02f)) { AddCandidate(other, null, val, ((Object)val).name); } } } } private void AddCandidate(List<WeakCandidate> list, Transform part, Collider collider, string name) { //IL_001a: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector3 val; if (!((Object)(object)part != (Object)null)) { Bounds bounds = collider.bounds; val = ((Bounds)(ref bounds)).center; } else { val = part.position; } Vector3 val2 = val; for (int i = 0; i < list.Count; i++) { Vector3 val3 = list[i].Position - val2; if (((Vector3)(ref val3)).sqrMagnitude < 0.04f) { return; } } list.Add(new WeakCandidate { Part = part, Collider = collider, Name = name }); } private void ClearWeakPoint() { _weakPart = null; _weakCollider = null; _weakName = null; } private void HideMarker() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_marker != (Object)null && _marker.activeSelf) { _marker.SetActive(false); } _markerAppearStart = -1f; if (_markerDetached) { _markerDetached = false; SetMarkerAlpha(1f); if ((Object)(object)_markerFlashRenderer != (Object)null) { SetRendererColor((Renderer)(object)_markerFlashRenderer, new Color(1f, 1f, 1f, 0f)); } } } private void BuildMarker() { //IL_0044: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) _markerQuadMesh = CreateMarkerQuadMesh(); _markerRingMesh = CreateMarkerRingMesh("RatioRing", 0.075f, 0.006f); _markerRingOutlineMesh = CreateMarkerRingMesh("RatioRingOutline", 0.075f, 0.013f); _markerWhiteMat = CreateMarkerColorMaterial(MarkerWhiteColor); _markerBlackMat = CreateMarkerColorMaterial(MarkerBlackColor); _markerRedMat = CreateMarkerColorMaterial(MarkerRedColor); _markerFlashMat = CreateEffectMaterial(new Color(1f, 1f, 1f, 0f), additive: true); GameObject val = new GameObject("Ratio73Marker"); Transform transform = val.transform; _markerTicks.Clear(); _markerLineOutline = CreateMarkerQuad(transform, "LineOutline", _markerBlackMat, 0f, 0f, 0.001f, 1f, 0.018f).transform; _markerLineCore = CreateMarkerQuad(transform, "LineCore", _markerWhiteMat, 0f, 0f, 0.007f, 0.98f, 0.008f).transform; float[] array = new float[10] { -0.5f, -0.4f, -0.3f, -0.2f, -0.1f, 0f, 0.1f, 0.3f, 0.4f, 0.5f }; for (int i = 0; i < array.Length; i++) { float num = array[i]; bool num2 = Mathf.Abs(Mathf.Abs(num) - 0.5f) < 0.001f; float num3 = (num2 ? 0.26f : 0.1f); float num4 = (num2 ? 0.008f : 0.005f); GameObject val2 = new GameObject("Tick" + i); val2.transform.SetParent(transform, false); val2.transform.localPosition = new Vector3(num, 0f, 0f); CreateMarkerQuad(val2.transform, "Outline", _markerBlackMat, 0f, 0f, 0.002f, num4 * 2.4f, num3 + 0.014f); CreateMarkerQuad(val2.transform, "Core", _markerWhiteMat, 0f, 0f, 0.006f, num4, num3); _markerTicks.Add(new MarkerTick { Tr = val2.transform, Delay = 0.05f + Mathf.Abs(num) * 0.34f }); } GameObject val3 = new GameObject("Ring"); val3.transform.SetParent(transform, false); val3.transform.localPosition = new Vector3(0.2f, 0f, 0f); CreateMarkerMeshObject(val3.transform, "Outline", _markerRingOutlineMesh, _markerBlackMat, 0.001f); CreateMarkerMeshObject(val3.transform, "Core", _markerRingMesh, _markerWhiteMat, 0.005f); CreateMarkerQuad(val3.transform, "CrossV", _markerRedMat, 0f, 0f, 0.008f, 0.004f, 0.17f); CreateMarkerQuad(val3.transform, "CrossH", _markerRedMat, 0f, 0f, 0.008f, 0.145f, 0.004f); GameObject val4 = CreateMarkerQuad(transform, "AppearFlash", _markerFlashMat, 0f, 0f, 0.012f, 0.2f, 0.2f); val.SetActive(false); _marker = val; _markerTransform = transform; _markerRing = val3.transform; _markerFlash = val4.transform; _markerFlashRenderer = val4.GetComponent<MeshRenderer>(); _markerAppearStart = -1f; } private GameObject CreateMarkerQuad(Transform parent, string name, Material material, float x, float y, float z, float width, float height) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(x, y, z); val.transform.localScale = new Vector3(width, height, 1f); val.AddComponent<MeshFilter>().sharedMesh = _markerQuadMesh; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = material; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; return val; } private GameObject CreateMarkerMeshObject(Transform parent, string name, Mesh mesh, Material material, float z) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(0f, 0f, z); val.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = material; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; return val; } private Material CreateMarkerColorMaterial(Color color) { //IL_0023: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005f: 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_007f: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Universal Render Pipeline/Unlit"); if ((Object)(object)val != (Object)null && val.isSupported) { Material val2 = new Material(val); Texture2D whiteTexture = GetWhiteTexture(); val2.SetTexture("_BaseMap", (Texture)(object)whiteTexture); val2.SetTexture("_MainTex", (Texture)(object)whiteTexture); val2.SetColor("_BaseColor", color); val2.SetColor("_Color", color); val2.SetFloat("_Surface", 1f); val2.SetFloat("_Blend", 0f); val2.SetFloat("_SrcBlend", 5f); val2.SetFloat("_DstBlend", 10f); val2.SetFloat("_SrcBlendAlpha", 1f); val2.SetFloat("_DstBlendAlpha", 10f); val2.SetFloat("_Cull", 0f); val2.SetFloat("_ZWrite", 1f); val2.SetInt("_ZTest", 4); val2.SetFloat("_AlphaClip", 0f); val2.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); val2.DisableKeyword("_ALPHATEST_ON"); val2.renderQueue = 3000; return val2; } val = Shader.Find("Unlit/Color"); if ((Object)(object)val == (Object)null || !val.isSupported) { val = Shader.Find("Standard"); } if ((Object)(object)val == (Object)null || !val.isSupported) { ((MelonBase)this).LoggerInstance.Warning("No marker shader found"); return null; } Material val3 = new Material(val); SetMaterialColor(val3, color); return val3; } private Mesh CreateMarkerQuadMesh() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh(); ((Object)val).name = "RatioMarkerQuad"; val.vertices = Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f, 0f), new Vector3(0.5f, -0.5f, 0f), new Vector3(-0.5f, 0.5f, 0f), new Vector3(0.5f, 0.5f, 0f) }); val.uv = Il2CppStructArray<Vector2>.op_Implicit((Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f) }); val.triangles = Il2CppStructArray<int>.op_Implicit(new int[6] { 0, 1, 2, 2, 1, 3 }); val.RecalculateNormals(); val.RecalculateBounds(); return val; } private Mesh CreateMarkerRingMesh(string name, float radius, float thickness) { //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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown float num = radius + thickness * 0.5f; float num2 = radius - thickness * 0.5f; Vector3[] array = (Vector3[])(object)new Vector3[98]; Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length]; int[] array3 = new int[288]; for (int i = 0; i <= 48; i++) { float num3 = (float)i / 48f * (float)Math.PI * 2f; float num4 = Mathf.Cos(num3); float num5 = Mathf.Sin(num3); array[i * 2] = new Vector3(num4 * num2, num5 * num2, 0f); array[i * 2 + 1] = new Vector3(num4 * num, num5 * num, 0f); array2[i * 2] = new Vector2((float)i / 48f, 0f); array2[i * 2 + 1] = new Vector2((float)i / 48f, 1f); } for (int j = 0; j < 48; j++) { int num6 = j * 2; int num7 = j * 6; array3[num7] = num6; array3[num7 + 1] = num6 + 1; array3[num7 + 2] = num6 + 2; array3[num7 + 3] = num6 + 2; array3[num7 + 4] = num6 + 1; array3[num7 + 5] = num6 + 3; } Mesh val = new Mesh { name = name, vertices = Il2CppStructArray<Vector3>.op_Implicit(array), uv = Il2CppStructArray<Vector2>.op_Implicit(array2), triangles = Il2CppStructArray<int>.op_Implicit(array3) }; val.RecalculateNormals(); val.RecalculateBounds(); return val; } private Material CreateEffectMaterial(Color color, bool additive) { //IL_0023: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005f: 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_0089: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00df: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown Shader val = Shader.Find("Universal Render Pipeline/Unlit"); if ((Object)(object)val != (Object)null && val.isSupported) { Material val2 = new Material(val); Texture2D whiteTexture = GetWhiteTexture(); val2.SetTexture("_BaseMap", (Texture)(object)whiteTexture); val2.SetTexture("_MainTex", (Texture)(object)whiteTexture); val2.SetColor("_BaseColor", color); val2.SetColor("_Color", color); val2.SetFloat("_Surface", 1f); val2.SetFloat("_Blend", additive ? 2f : 0f); val2.SetFloat("_SrcBlend", 5f); val2.SetFloat("_DstBlend", additive ? 1f : 10f); val2.SetFloat("_ZWrite", 0f); val2.SetInt("_ZTest", 4); val2.SetFloat("_Cull", 0f); val2.SetFloat("_AlphaClip", 0f); val2.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); val2.DisableKeyword("_ALPHATEST_ON"); val2.renderQueue = (additive ? 3110 : 3100); return val2; } val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null || !val.isSupported) { val = Shader.Find("Unlit/Transparent"); } if ((Object)(object)val == (Object)null || !val.isSupported) { ((MelonBase)this).LoggerInstance.Warning("No effect shader found"); return null; } Material val3 = new Material(val); val3.SetTexture("_MainTex", (Texture)(object)GetWhiteTexture()); val3.SetColor("_Color", color); if (val3.HasProperty("_BaseColor")) { val3.SetColor("_BaseColor", color); } val3.renderQueue = (additive ? 3110 : 3100); return val3; } private Texture2D GetWhiteTexture() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_whiteTex != (Object)null) { return _whiteTex; } _whiteTex = new Texture2D(1, 1, (TextureFormat)4, false); _whiteTex.SetPixel(0, 0, Color.white); _whiteTex.Apply(); ((Texture)_whiteTex).wrapMode = (TextureWrapMode)1; ((Texture)_whiteTex).filterMode = (FilterMode)1; return _whiteTex; } private void SetRendererColor(Renderer renderer, Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_001d: 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) if (!((Object)(object)renderer == (Object)null)) { MaterialPropertyBlock val = new MaterialPropertyBlock(); renderer.GetPropertyBlock(val); val.SetColor("_BaseColor", color); val.SetColor("_Color", color); renderer.SetPropertyBlock(val); } } private Quaternion GetEffectFacing(Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_003b: 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) if ((Object)(object)_camera == (Object)null) { return Quaternion.identity; } Vector3 val = _camera.position - position; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { return Quaternion.identity; } return Quaternion.LookRotation(val); } private static float EaseOutCubic(float t) { t = Mathf.Clamp01(t); float num = 1f - t; return 1f - num * num * num; } private static float EaseOutBack(float t) { t = Mathf.Clamp01(t); float num = t - 1f; return 1f + 2.70158f * num * num * num + 1.70158f * num * num; } private void SpawnMarkerHitPulse(Vector3 position) { //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) //IL_007e: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002e: 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_0040: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_markerRingMesh == (Object)null) { return; } if ((Object)(object)_camera != (Object)null) { Vector3 val = _camera.position - position; if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { position += ((Vector3)(ref val)).normalized * 0.15f; } } MelonCoroutines.Start(ExpandingRingRoutine(position, _markerRingMesh, Color.white, 1.2f, 13f, 0.32f)); MelonCoroutines.Start(ExpandingRingRoutine(position, _markerRingMesh, new Color(0.95f, 0.02f, 0.02f, 1f), 0.9f, 9f, 0.42f)); } private IEnumerator ExpandingRingRoutine(Vector3 position, Mesh mesh, Color color, float startScale, float endScale, float duration) { //IL_000e: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Material material = CreateEffectMaterial(color, additive: true); if (!((Object)(object)material == (Object)null)) { GameObject ring = new GameObject("RatioHitRing"); ring.transform.position = position; ring.transform.rotation = GetEffectFacing(position); ring.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer renderer = ring.AddComponent<MeshRenderer>(); ((Renderer)renderer).sharedMaterial = material; ((Renderer)renderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)renderer).receiveShadows = false; float elapsed = 0f; while (elapsed < duration && (Object)(object)ring != (Object)null) { elapsed += Time.deltaTime; float num = Mathf.Clamp01(elapsed / duration); float num2 = Mathf.Lerp(startScale, endScale, EaseOutCubic(num)); ring.transform.localScale = new Vector3(num2, num2, 1f); Color color2 = color; color2.a = 1f - num; SetRendererColor((Renderer)(object)renderer, color2); yield return null; } if ((Object)(object)ring != (Object)null) { Object.Destroy((Object)(object)ring); } Object.Destroy((Object)(object)material); } } private void LoadSounds() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = Path.Combine(Path.GetDirectoryName(executingAssembly.Location), "RatioSounds"); Directory.CreateDirectory(text); string text2 = ExtractSound(executingAssembly, text, "BlackFlash.wav", "RatioBlackFlash.wav"); if (text2 != null) { RatioSound.Open("blackflash", text2, 100); } OpenOptionalSound(text, "RatioOn.wav", "Activate.wav", "ratio_on", 100); OpenOptionalSound(text, "RatioOff.wav", "Deactivate.wav", "ratio_off", 100); OpenOptionalSound(text, "Fracture.wav", "Break.wav", "fracture", 100); _soundReady = RatioSound.IsOpen("blackflash"); ((MelonBase)this).LoggerInstance.Msg("Sounds: blackflash=" + _soundReady + " on=" + RatioSound.IsOpen("ratio_on") + " off=" + RatioSound.IsOpen("ratio_off") + " fracture=" + RatioSound.IsOpen("fracture")); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Sounds failed: " + ex.Message); } } private string ExtractSound(Assembly assembly, string folder, string fileName, string resourceName) { string text = Path.Combine(folder, fileName); if (File.Exists(text) && new FileInfo(text).Length > 0) { return text; } using Stream stream = assembly.GetManifestResourceStream(resourceName); if (stream == null) { return File.Exists(text) ? text : null; } using FileStream destination = new FileStream(text, FileMode.Create, FileAccess.Write); stream.CopyTo(destination); return text; } private void OpenOptionalSound(string folder, string fileName, string alternative, string key, int volume) { string path = Path.Combine(folder, fileName); if (!File.Exists(path)) { path = Path.Combine(folder, alternative); if (!File.Exists(path)) { return; } } RatioSound.Open(key, path, volume); } private void PlayBlackFlashSound(Vector3 position) { RatioSound.Play("blackflash"); } private void SpawnBlackFlash(Vector3 position) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; if (!(unscaledTime < _nextBlackFlashTime)) { _nextBlackFlashTime = unscaledTime + 0.98f + 0.3f; Vector3 forward = (((Object)(object)_camera != (Object)null) ? _camera.forward : Vector3.forward); MelonCoroutines.Start(BlackFlashRoutine(position, forward)); MelonCoroutines.Start(ImpactFlareRoutine(position)); MelonCoroutines.Start(ImpactBurstRoutine(position, forward)); MelonCoroutines.Start(RedRainRoutine(position)); MelonCoroutines.Start(GroundBloodRoutine(position)); } } private IEnumerator ImpactFlareRoutine(Vector3 contact) { //IL_000e: 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) Material material = CreateEffectMaterial(Color.white, additive: true); if ((Object)(object)material == (Object)null) { yield break; } GameObject quad = new GameObject("RatioImpactFlash"); quad.transform.position = contact; quad.transform.rotation = GetEffectFacing(contact); quad.AddComponent<MeshFilter>().sharedMesh = _markerQuadMesh; MeshRenderer quadRenderer = quad.AddComponent<MeshRenderer>(); ((Renderer)quadRenderer).sharedMaterial = material; ((Renderer)quadRenderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)quadRenderer).receiveShadows = false; GameObject ring = new GameObject("RatioImpactRing"); ring.transform.position = contact; ring.transform.rotation = GetEffectFacing(contact); ring.AddComponent<MeshFilter>().sharedMesh = _markerRingMesh; MeshRenderer ringRenderer = ring.AddComponent<MeshRenderer>(); ((Renderer)ringRenderer).sharedMaterial = material; ((Renderer)ringRenderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)ringRenderer).receiveShadows = false; GameObject lightObj = new GameObject("RatioImpactLight"); lightObj.transform.position = contact; Light light = lightObj.AddComponent<Light>(); light.type = (LightType)2; light.color = new Color(1f, 0.9f, 0.78f); light.range = 4.5f; light.intensity = 0f; light.shadows = (LightShadows)0; float duration = 0.32f; float elapsed = 0f; while (elapsed < duration && (Object)(object)quad != (Object)null) { elapsed += Time.deltaTime; float num = Mathf.Clamp01(elapsed / duration); float num2 = Mathf.Clamp01(elapsed / 0.12f); float num3 = Mathf.Lerp(0.15f, 1.5f, EaseOutCubic(num2)); float num4 = Mathf.Lerp(1f, 12f, EaseOutCubic(num)); quad.transform.localScale = new Vector3(num3, num3, 1f); ring.transform.localScale = new Vector3(num4, num4, 1f); SetRendererColor((Renderer)(object)quadRenderer, new Color(1f, 1f, 1f, (1f - num2) * 0.8f)); SetRendererColor((Renderer)(object)ringRenderer, new Color(1f, 1f, 1f, 1f - num)); if ((Object)(object)light != (Object)null) { light.intensity = (1f - num) * 7f; } yield return null; } if ((Object)(object)quad != (Object)null) { Object.Destroy((Object)(object)quad); } if ((Object)(object)ring != (Object)null) { Object.Destroy((Object)(object)ring); } if ((Object)(object)lightObj != (Object)null) { Object.Destroy((Object)(object)lightObj); } Object.Destroy((Object)(object)material); } private IEnumerator ImpactBurstRoutine(Vector3 contact, Vector3 forward) { //IL_000e: 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_0015: 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) Material white = CreateEffectMaterial(Color.white, additive: true); Material red = CreateEffectMaterial(new Color(0.85f, 0.015f, 0.015f, 1f), additive: false); if ((Object)(object)white == (Object)null && (Object)(object)red == (Object)null) { yield break; } List<ImpactParticle> particles = new List<ImpactParticle>(); if ((Object)(object)white != (Object)null) { Vector3 val; for (int i = 0; i < 30; i++) { Vector3 onUnitSphere = Random.onUnitSphere; val = onUnitSphere + forward * 0.22f; onUnitSphere = ((Vector3)(ref val)).normalized; GameObject val2 = CreateEffectPrimitive((PrimitiveType)0, "RatioSpark", contact + Random.insideUnitSphere * 0.12f, white); float num = Random.Range(0.009f, 0.022f); val2.transform.localScale = Vector3.one * num; particles.Add(new ImpactParticle { Obj = val2, Velocity = onUnitSphere * Random.Range(3.5f, 8.5f), Gravity = 5f, Life = Random.Range(0.35f, 0.7f), BaseScale = Vector3.one * num, Shrink = true }); } Vector3 val4 = default(Vector3); for (int j = 0; j < 14; j++) { Vector3 onUnitSphere2 = Random.onUnitSphere; val = onUnitSphere2 + forward * 0.15f; onUnitSphere2 = ((Vector3)(ref val)).normalized; GameObject val3 = CreateEffectPrimitive((PrimitiveType)3, "RatioStreak", contact, white); ((Vector3)(ref val4))..ctor(0.007f, 0.007f, Random.Range(0.09f, 0.2f)); val3.transform.localScale = val4; particles.Add(new ImpactParticle { Obj = val3, Velocity = onUnitSphere2 * Random.Range(5f, 10f), Gravity = 2.5f, Life = Random.Range(0.22f, 0.42f), BaseScale = val4, Align = true, Shrink = true }); } } if ((Object)(object)red != (Object)null) { Vector3 val6 = default(Vector3); for (int k = 0; k < 9; k++) { Vector3 onUnitSphere3 = Random.onUnitSphere; onUnitSphere3.y = Mathf.Abs(onUnitSphere3.y) * 0.5f + 0.35f; ((Vector3)(ref onUnitSphere3)).Normalize(); GameObject val5 = CreateEffectPrimitive((PrimitiveType)3, "RatioSlab", contact + Random.insideUnitSphere * 0.15f, red); ((Vector3)(ref val6))..ctor(Random.Range(0.06f, 0.16f), 0.012f, Random.Range(0.03f, 0.09f)); val5.transform.localScale = val6; val5.transform.rotation = Random.rotation; particles.Add(new ImpactParticle { Obj = val5, Velocity = onUnitSphere3 * Random.Range(2f, 4.5f), Gravity = 16f, Life = Random.Range(0.9f, 1.4f), BaseScale = val6, Spin = true }); } } while (particles.Count > 0) { float deltaTime = Time.deltaTime; for (int num2 = particles.Count - 1; num2 >= 0; num2--) { ImpactParticle impactParticle = particles[num2]; if ((Object)(object)impactParticle.Obj == (Object)null) { particles.RemoveAt(num2); } else { impactParticle.Age += deltaTime; if (impactParticle.Age >= impactParticle.Life) { Object.Destroy((Object)(object)impactParticle.Obj); particles.RemoveAt(num2); } else { impactParticle.Velocity += Vector3.down * impactParticle.Gravity * deltaTime; Transform transform = impactParticle.Obj.transform; transform.position += impactParticle.Velocity * deltaTime; if (impactParticle.Align && ((Vector3)(ref impactParticle.Velocity)).sqrMagnitude > 0.0001f) { impactParticle.Obj.transform.rotation = Quaternion.LookRotation(impactParticle.Velocity); } if (impactParticle.Spin) { impactParticle.Obj.transform.Rotate(impactParticle.Velocity * (25f * deltaTime), (Space)1); } float num3 = impactParticle.Age / impactParticle.Life; float num4 = 1f; if (impactParticle.Shrink) { num4 = 1f - num3; } else if (num3 > 0.78f) { num4 = 1f - (num3 - 0.78f) / 0.22f; } impactParticle.Obj.transform.localScale = impactParticle.BaseScale * Mathf.Max(0.001f, num4); } } } yield return null; } if ((Object)(object)white != (Object)null) { Object.Destroy((Object)(object)white); } if ((Object)(object)red != (Object)null) { Object.Destroy((Object)(object)red); } } private GameObject CreateEffectPrimitive(PrimitiveType type, string name, Vector3 position, Material material) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive(type); ((Object)obj).name = name; obj.transform.position = position; Collider component = obj.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { component.enabled = false; Object.Destroy((Object)(object)component); } Renderer component2 = obj.GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null) { component2.sharedMaterial = material; component2.shadowCastingMode = (ShadowCastingMode)0; component2.receiveShadows = false; } return obj; } private IEnumerator RedRainRoutine(Vector3 contact) { //IL_000e: 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) Material material = CreateEffectMaterial(new Color(0.85f, 0.01f, 0.01f, 1f), additive: true); if ((Object)(object)material == (Object)null) { yield break; } List<LineRenderer> lines = new List<LineRenderer>(); Color start = new Color(0.85f, 0.01f, 0.01f, 1f); Color end = new Color(0.45f, 0f, 0f, 0f); for (int i = 0; i < 6; i++) { LineRenderer val = new GameObject("RatioRedRain").AddComponent<LineRenderer>(); ((Renderer)val).sharedMaterial = material; val.positionCount = 2; val.startWidth = 0.012f; val.endWidth = 0.002f; val.numCapVertices = 2; val.alignment = (LineAlignment)0; ((Renderer)val).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val).receiveShadows = false; val.startColor = start; val.endColor = end; Vector3 val2 = contact + new Vector3(Random.Range(-0.35f, 0.35f), Random.Range(-0.25f, 0.3f), Random.Range(-0.35f, 0.35f)); Vector3 val3 = val2 + Vector3.down * Random.Range(0.9f, 1.8f) + new Vector3(Random.Range(-0.25f, 0.25f), 0f, Random.Range(-0.25f, 0.25f)); val.SetPosition(0, val2); val.SetPosition(1, val3); lines.Add(val); } float duration = 0.7f; float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float num = Mathf.Clamp01(elapsed / duration); Color startColor = start; startColor.a = 1f - num; for (int j = 0; j < lines.Count; j++) { LineRenderer val4 = lines[j]; if (!((Object)(object)val4 == (Object)null)) { val4.startColor = startColor; val4.endColor = end; } } yield return null; } for (int k = 0; k < lines.Count; k++) { LineRenderer val5 = lines[k]; if ((Object)(object)val5 != (Object)null) { Object.Destroy((Object)(object)((Component)val5).gameObject); } } Object.Destroy((Object)(object)material); } private IEnumerator GroundBloodRoutine(Vector3 contact) { //IL_000e: 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) Vector3 val = FindGround(contact); Material material = CreateEffectMaterial(new Color(0.55f, 0f, 0f, 0.95f), additive: false); if ((Object)(object)material == (Object)null) { yield break; } List<MeshRenderer> decals = new List<MeshRenderer>(); GameObject rootObj = new GameObject("RatioBloodDecals"); Transform transform = rootObj.transform; for (int i = 0; i < 8; i++) { GameObject val2 = new GameObject("RatioBloodDecal"); val2.transform.SetParent(transform, false); Vector2 val3 = Random.insideUnitCircle * 1.1f; val2.transform.position = val + new Vector3(val3.x, 0.015f + (float)i * 0.0008f, val3.y); val2.transform.rotation = Quaternion.Euler(-90f, Random.Range(0f, 360f), 0f); float num = Random.Range(0.06f, 0.22f); val2.transform.localScale = new Vector3(num, num * Random.Range(0.55f, 1.5f), 1f); val2.AddComponent<MeshFilter>().sharedMesh = _markerQuadMesh; MeshRenderer val4 = val2.AddComponent<MeshRenderer>(); ((Renderer)val4).sharedMaterial = material; ((Renderer)val4).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val4).receiveShadows = false; SetRendererColor((Renderer)(object)val4, new Color(0.55f, 0f, 0f, 0f)); decals.Add(val4); } float duration = 1.5f; float fadeStart = 1f; float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float num2 = ((elapsed < fadeStart) ? 0.95f : (0.95f * (1f - (elapsed - fadeStart) / (duration - fadeStart)))); for (int j = 0; j < decals.Count; j++) { MeshRenderer val5 = decals[j]; if (!((Object)(object)val5 == (Object)null)) { SetRendererColor((Renderer)(object)val5, new Color(0.55f, 0f, 0f, num2)); } } yield return null; } if ((Object)(object)rootObj != (Object)null) { Object.Destroy((Object)(object)rootObj); } Object.Destroy((Object)(object)material); } private Vector3 FindGround(Vector3 contact) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00b1: Unknown result type (might be due to invalid IL or missing references) Vector3 result = contact + Vector3.down * 1.5f; float num = float.MinValue; try { RaycastHit[] array = Il2CppArrayBase<RaycastHit>.op_Implicit((Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(contact + Vector3.up * 0.3f, Vector3.down, 40f, -1, (QueryTriggerInteraction)1)); for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if (!((Object)(object)collider == (Object)null)) { bool flag = false; try { flag = (Object)(object)((Component)collider).GetComponentInParent<StickHealth>() != (Object)null; } catch (Exception) { } if (!flag && !(((RaycastHit)(ref array[i])).point.y <= num)) { num = ((RaycastHit)(ref array[i])).point.y; result = ((RaycastHit)(ref array[i])).point; } } } } catch (Exception) { } return result; } private IEnumerator BlackFlashRoutine(Vector3 contact, Vector3 forward) { //IL_000e: 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_0015: 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) Material coreMaterial = CreateBlackLineMaterial(); Material edgeMaterial = CreateBlackLineMaterial(); Material coreSolid = CreateBlackSolidMaterial(BfCoreColor); Material orbSolid = CreateBlackSolidMaterial(BfOrbColor); Material cubeSolid = CreateBlackSolidMaterial(BfCubeColor); GameObject origin = SpawnBlackOrigin(contact, coreSolid); List<LightningBranch> main = new List<LightningBranch>(); List<LightningBranch> mid = new List<LightningBranch>(); List<LightningBranch> small = new List<LightningBranch>(); for (int i = 0; i < 14; i++) { Vector3 onUnitSphere = Random.onUnitSphere; Vector3 val = onUnitSphere * 0.85f + forward * 0.15f; onUnitSphere = ((Vector3)(ref val)).normalized; float length = Random.Range(3f, 5f); LightningBranch lightningBranch = CreateLightningBranch(contact, onUnitSphere, length, i, coreMaterial, edgeMaterial); if (lightningBranch != null) { main.Add(lightningBranch); } } for (int j = 0; j < 8; j++) { Vector3 start = contact + Random.onUnitSphere * Random.Range(0.8f, 2f); Vector3 onUnitSphere2 = Random.onUnitSphere; float length2 = Random.Range(1.2f, 2.5f); LightningBranch lightningBranch2 = CreateLightningBranchCustom(start, onUnitSphere2, length2, 0.05f, 0.004f, j + 100, coreMaterial, edgeMaterial); if (lightningBranch2 != null) { mid.Add(lightningBranch2); } } for (int k = 0; k < 12; k++) { Vector3 start2 = contact + Random.onUnitSphere * Random.Range(2f, 4f); Vector3 onUnitSphere3 = Random.onUnitSphere; float length3 = Random.Range(0.5f, 1.1f); LightningBranch lightningBranch3 = CreateLightningBranchCustom(start2, onUnitSphere3, length3, 0.025f, 0.002f, k + 200, coreMaterial, edgeMaterial); if (lightningBranch3 != null) { small.Add(lightningBranch3); } } SpawnBlackFragments(contact, cubeSolid); float totalDuration = 1.28f; float elapsed = 0f; while (elapsed < totalDuration) { elapsed += Time.deltaTime; float num = Mathf.Clamp01(elapsed / 0.7f); float num2 = num * num * (3f - 2f * num); float num3 = Mathf.Clamp01((elapsed - 0.28f) / 0.70000005f); float num4 = num3 * num3 * (3f - 2f * num3); float num5 = Mathf.Clamp01((elapsed - 0.28f - 0.3f) / 0.70000005f); float collapse = num5 * num5 * (3f - 2f * num5); float num6 = Mathf.Clamp01(elapsed / 0.84000003f); float grow = num6 * num6 * (3f - 2f * num6); AnimateBranches(main, num2, num4); AnimateBranches(mid, num2, num4); AnimateBranches(small, grow, collapse); if (num2 >= 1f) { for (int l = 0; l < main.Count; l++) { LightningBranch lightningBranch4 = main[l]; if (lightningBranch4 != null && !lightningBranch4.OrbsSpawned) { SpawnEndOrbs(lightningBranch4, orbSolid); lightningBranch4.OrbsSpawned = true; } } } if (num4 > 0f) { for (int m = 0; m < main.Count; m++) { LightningBranch lightningBranch5 = main[m]; if (lightningBranch5 == null) { continue; } for (int n = 0; n < lightningBranch5.EndOrbs.Count; n++) { GameObject val2 = lightningBranch5.EndOrbs[n]; if (!((Object)(object)val2 == (Object)null)) { float num7 = 0.015f * (1f - num4); val2.transform.localScale = Vector3.one * Mathf.Max(0.001f, num7); } } } } yield return null; } for (int num8 = 0; num8 < main.Count; num8++) { DestroyBlackBranch(main[num8]); } for (int num9 = 0; num9 < mid.Count; num9++) { DestroyBlackBranch(mid[num9]); } for (int num10 = 0; num10 < small.Count; num10++) { DestroyBlackBranch(small[num10]); } if ((Object)(object)origin != (Object)null) { origin.SetActive(false); Object.Destroy((Object)(object)origin); } DestroyBlackMaterial(coreMaterial); DestroyBlackMaterial(edgeMaterial); DestroyBlackMaterial(coreSolid); DestroyBlackMaterial(orbSolid); DestroyBlackMaterial(cubeSolid); } private void AnimateBranches(List<LightningBranch> branches, float grow, float collapse) { for (int i = 0; i < branches.Count; i++) { LightningBranch lightningBranch = branches[i]; if (lightningBranch != null && !((Object)(object)lightningBranch.Obj == (Object)null)) { if (collapse <= 0f) { AnimateBranchGrowth(lightningBranch, grow); } else { AnimateBranchGrowthAndCollapse(lightningBranch, grow, collapse); } } } } private void AnimateBranchGrowth(LightningBranch branch, float progress) { //IL_00a3: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (branch == null || branch.Points == null || branch.Points.Length < 2) { return; } int num = branch.Points.Length - 1; float num2 = progress * (float)num; int num3 = Mathf.FloorToInt(num2); float num4 = num2 - (float)num3; if (num3 >= num) { SetBranchFull(branch.Core, branch.Points); SetBranchFull(branch.Edge, branch.Points); return; } Vector3[] array = (Vector3[])(object)new Vector3[num3 + 2]; for (int i = 0; i <= num3 && i < branch.Points.Length; i++) { array[i] = branch.Points[i]; } if (num3 < num) { array[num3 + 1] = Vector3.Lerp(branch.Points[num3], branch.Points[num3 + 1], num4); } SetBranchFull(branch.Core, array); SetBranchFull(branch.Edge, array); } private void AnimateBranchGrowthAndCollapse(LightningBranch branch, float growProgress, float collapseProgress) { //IL_0123: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_022b: 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_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) if (branch == null || branch.Points == null || branch.Points.Length < 2) { return; } int num = branch.Points.Length - 1; float num2 = growProgress * (float)num; int num3 = Mathf.FloorToInt(num2); float num4 = num2 - (float)num3; float num5 = collapseProgress * (float)num; int num6 = Mathf.FloorToInt(num5); float num7 = num5 - (float)num6; if (num6 >= num3) { if ((Object)(object)branch.Core != (Object)null) { branch.Core.positionCount = 0; } if ((Object)(object)branch.Edge != (Object)null) { branch.Edge.positionCount = 0; } return; } int num8 = num6; int nu