using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using BulletTrails;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSystem;
using Il2CppSystem.IO;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "BulletTrails", "1.1.3", "Zer0Bytes", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BulletTrails")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BulletTrails")]
[assembly: AssemblyTitle("BulletTrails")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BulletTrails
{
public class Core : MelonMod
{
private static List<Trail> m_ActiveTrails = new List<Trail>();
public static bool IsQuest => (int)Application.platform == 11;
public override void OnInitializeMelon()
{
Hooking.OnLevelLoaded += OnLevelLoaded;
Trail.OnInitializeMelon();
}
public override void OnUpdate()
{
float deltaTime = Time.deltaTime;
for (int num = m_ActiveTrails.Count - 1; num >= 0; num--)
{
Trail trail = m_ActiveTrails[num];
if ((Object)(object)trail != (Object)null)
{
trail.UpdateTrail(deltaTime);
if (trail.IsExpired)
{
trail.Cleanup();
m_ActiveTrails.RemoveAt(num);
}
}
else
{
m_ActiveTrails.RemoveAt(num);
}
}
}
public static void AddTrail(Trail ripple)
{
m_ActiveTrails.Add(ripple);
}
private static void OnLevelLoaded(LevelInfo info)
{
foreach (Trail activeTrail in m_ActiveTrails)
{
if ((Object)(object)activeTrail != (Object)null)
{
activeTrail.Cleanup();
}
}
m_ActiveTrails.Clear();
Trail.InitResources();
}
}
public static class Utilities
{
public static T LoadAsset<T>(this AssetBundle bundle, string name) where T : Object
{
if ((Object)(object)bundle == (Object)null)
{
Debug.LogError(Object.op_Implicit("AssetBundle is null."));
return default(T);
}
try
{
Type val = Il2CppType.Of<T>(true);
Object val2 = bundle.LoadAsset(name, val);
if (val2 == (Object)null)
{
Debug.LogError(Object.op_Implicit("Failed to load asset: " + name));
return default(T);
}
return ((Il2CppObjectBase)val2).Cast<T>();
}
catch (Exception ex)
{
Debug.LogError(Object.op_Implicit("Error loading asset: " + ex));
return default(T);
}
}
public static AssetBundle LoadFromResources(string name)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if (executingAssembly.GetManifestResourceNames().Contains(name))
{
byte[] array;
using (Stream stream = executingAssembly.GetManifestResourceStream(name))
{
using MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
array = memoryStream.ToArray();
}
return AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
}
return null;
}
}
[RegisterTypeInIl2Cpp]
public class Trail : MonoBehaviour
{
public Mesh m_Mesh;
public MeshFilter m_MeshFilter;
public MeshRenderer m_MeshRenderer;
public List<Vector3> m_Verticies;
public List<int> m_Triangles;
public List<Vector2> m_UVS;
private static Shader m_Shader = null;
private static Material m_Material = null;
private static Shader m_Shader2 = null;
private static Material m_Material2 = null;
private Vector3 m_OriginStart;
private Vector3 m_OriginStartOld;
private Vector3 m_OriginEnd;
private Vector3 m_OriginEnd_Target;
private float m_TotalDistance;
private float m_CurrentDistanceEnd;
private float m_CurrentDistanceStart;
private static readonly float m_MinTimeScale = 0.85f;
private float m_ElapsedTime;
private float m_FadeTime;
private float m_BulletCount = 1f;
private float m_Velocity;
private float m_MuzzleVelocity;
private bool m_IsBlur;
private static readonly int m_Segments = 6;
private static bool m_Enabled = true;
private static bool m_SlowmoOnly = true;
private static float m_Duration = 0.6f;
private static float m_Radius = 4f;
private static float m_BarrelOffset = 0.15f;
private static float m_HitOffset = 0.1f;
private static Color m_Color = (Color)(Core.IsQuest ? Color.white : new Color(0f, 0f, 0f, 1f));
private static MelonPreferences_Category MainCategory = null;
public int NumSegments => Mathf.FloorToInt((1f - m_FadeTime) * (float)m_Segments);
public bool IsExpired
{
get
{
if (!Core.IsQuest)
{
return m_CurrentDistanceStart >= m_TotalDistance;
}
return NumSegments <= 0;
}
}
public Trail(IntPtr ptr)
: base(ptr)
{
}
public static void OnInitializeMelon()
{
MelonPreferences.CreateCategory("BulletTrails");
SetupConfig();
Hooking.OnPostFireGun += OnWeaponFire;
}
public static void SetupConfig()
{
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
MainCategory = MelonPreferences.CreateCategory("BulletTrails");
MelonPreferences_Entry<bool> MelonPrefEnabled = MainCategory.CreateEntry<bool>("Enabled", m_Enabled, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences_Entry<bool> MelonPrefSlomoOnly = MainCategory.CreateEntry<bool>("SlomoOnly", m_SlowmoOnly, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences_Entry<float> MelonPrefDuration = MainCategory.CreateEntry<float>("Duration", m_Duration, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences_Entry<float> MelonPrefRadius = MainCategory.CreateEntry<float>("Radius", m_Radius, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences_Entry<float> MelonPrefBarrelOffset = MainCategory.CreateEntry<float>("OffsetBarrel", m_BarrelOffset, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences_Entry<float> MelonPrefOffsetHit = MainCategory.CreateEntry<float>("OffsetHit", m_HitOffset, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences_Entry<Color> MelonPrefColor = MainCategory.CreateEntry<Color>("Color", m_Color, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
m_Enabled = MelonPrefEnabled.Value;
m_SlowmoOnly = MelonPrefSlomoOnly.Value;
m_Duration = MelonPrefDuration.Value;
m_Radius = MelonPrefRadius.Value;
m_BarrelOffset = MelonPrefBarrelOffset.Value;
m_HitOffset = MelonPrefOffsetHit.Value;
m_Color = MelonPrefColor.Value;
Page val = Page.Root.CreatePage("BulletTrails", Color.gray, 0, true);
BoolElement VarModBool = null;
VarModBool = val.CreateBool("Enabled", Color.green, m_Enabled, (Action<bool>)delegate(bool value)
{
//IL_001a: 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)
m_Enabled = value;
((Element)VarModBool).ElementColor = (m_Enabled ? Color.green : Color.red);
UpdatePreferenceAndSave(MelonPrefEnabled, value);
});
((Element)VarModBool).ElementColor = (m_Enabled ? Color.green : Color.red);
val.CreateBool("Slomo Only", Color.grey, m_SlowmoOnly, (Action<bool>)delegate(bool value)
{
m_SlowmoOnly = value;
UpdatePreferenceAndSave(MelonPrefSlomoOnly, value);
});
val.CreateFloat("Duration", Color.yellow, m_Duration, 0.1f, 0.1f, 5f, (Action<float>)delegate(float value)
{
m_Duration = value;
UpdatePreferenceAndSave(MelonPrefDuration, value);
});
val.CreateFloat("Radius", Color.cyan, m_Radius, 1f, 1f, 10f, (Action<float>)delegate(float value)
{
m_Radius = value;
UpdatePreferenceAndSave(MelonPrefRadius, value);
});
val.CreateFloat("Barrel Offset", Color.blue, m_BarrelOffset, 0.01f, 0f, 0.5f, (Action<float>)delegate(float value)
{
m_BarrelOffset = value;
UpdatePreferenceAndSave(MelonPrefBarrelOffset, value);
});
val.CreateFloat("Hit Offset", Color.red, m_HitOffset, 0.05f, 0f, 1f, (Action<float>)delegate(float value)
{
m_HitOffset = value;
UpdatePreferenceAndSave(MelonPrefOffsetHit, value);
});
Page obj = val.CreatePage("Color", Color.white, 0, true);
obj.CreateFloat("Red", Color.red, m_Color.r, 0.1f, 0f, 1f, (Action<float>)delegate(float value)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
m_Color.r = value;
UpdatePreferenceAndSave<Color>(MelonPrefColor, m_Color);
if ((Object)(object)m_Material != (Object)null)
{
m_Material.color = m_Color;
}
});
obj.CreateFloat("Green", Color.green, m_Color.g, 0.1f, 0f, 1f, (Action<float>)delegate(float value)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
m_Color.g = value;
UpdatePreferenceAndSave<Color>(MelonPrefColor, m_Color);
if ((Object)(object)m_Material != (Object)null)
{
m_Material.color = m_Color;
}
});
obj.CreateFloat("Blue", Color.blue, m_Color.b, 0.1f, 0f, 1f, (Action<float>)delegate(float value)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
m_Color.b = value;
UpdatePreferenceAndSave<Color>(MelonPrefColor, m_Color);
if ((Object)(object)m_Material != (Object)null)
{
m_Material.color = m_Color;
}
});
obj.CreateFloat("Alpha", Color.white, m_Color.a, 0.1f, 0f, 1f, (Action<float>)delegate(float value)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
m_Color.a = value;
UpdatePreferenceAndSave<Color>(MelonPrefColor, m_Color);
if ((Object)(object)m_Material != (Object)null)
{
m_Material.color = m_Color;
}
});
}
private static void UpdatePreferenceAndSave<T>(MelonPreferences_Entry<T> preference, T value)
{
preference.Value = value;
MainCategory.SaveToFile(false);
}
public static void OnWeaponFire(Gun Weapon)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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)
//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_005b: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Expected O, but got Unknown
//IL_0171: 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_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
if (m_Enabled && (!m_SlowmoOnly || !(Time.timeScale >= 1f)) && !Weapon.entity.IsCulled)
{
Vector3 forward = ((Component)Weapon.firePointTransform).transform.forward;
Vector3 val = ((Component)Weapon.firePointTransform).transform.position + forward * m_BarrelOffset;
Vector3 val2 = val + forward * 15f;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val, forward, ref val3, 1000f))
{
float num = Vector3.Distance(val, ((RaycastHit)(ref val3)).point);
float num2 = num - num * m_HitOffset;
val2 = val + forward * num2;
}
GameObject val4 = new GameObject("BulletTrail");
Trail trail = val4.AddComponent<Trail>();
trail.m_MeshFilter = val4.AddComponent<MeshFilter>();
trail.m_MeshRenderer = val4.AddComponent<MeshRenderer>();
trail.m_OriginStart = val;
trail.m_OriginStartOld = val;
trail.m_OriginEnd_Target = val2;
trail.m_OriginEnd = val;
trail.m_BulletCount = Weapon.defaultCartridge.projectile.count;
trail.m_Velocity = Weapon.defaultCartridge.projectile.startVelocity;
trail.m_MuzzleVelocity = Weapon.muzzleVelocity;
trail.m_TotalDistance = Vector3.Distance(val, val2);
Trail trail2 = null;
if (!Core.IsQuest)
{
GameObject val5 = new GameObject("BulletTrail_Blur");
trail2 = val4.AddComponent<Trail>();
trail2.m_MeshFilter = val5.AddComponent<MeshFilter>();
trail2.m_MeshRenderer = val5.AddComponent<MeshRenderer>();
trail2.m_OriginStart = val;
trail2.m_OriginStartOld = val;
trail2.m_OriginEnd_Target = val2;
trail2.m_OriginEnd = val;
trail2.m_BulletCount = Weapon.defaultCartridge.projectile.count;
trail2.m_Velocity = Weapon.defaultCartridge.projectile.startVelocity;
trail2.m_MuzzleVelocity = Weapon.muzzleVelocity;
trail2.m_TotalDistance = Vector3.Distance(val, val2);
trail2.m_IsBlur = true;
}
trail.Start();
if (!Core.IsQuest)
{
trail2.Start();
}
}
}
private static AssetBundle GetLoadedBundleByAsset(string AssetPath)
{
foreach (AssetBundle item in MonoLinqHelper.ToArray<AssetBundle>(AssetBundle.GetAllLoadedAssetBundles()))
{
if (((Il2CppArrayBase<string>)(object)item.GetAllAssetNames()).Contains(AssetPath))
{
return item;
}
}
return null;
}
public static void InitResources()
{
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Expected O, but got Unknown
string text = (Core.IsQuest ? "_quest" : "");
string text2 = "Assets/_SLZPackages/Prefabs/Environment/Doors/ForceFields/Materials/ForceField.shader";
string text3 = "Assets/_SLZPackages/Shaders/ScreenDistortion.shader";
if ((Object)(object)m_Shader == (Object)null)
{
AssetBundle loadedBundleByAsset = GetLoadedBundleByAsset(text2);
if (Object.op_Implicit((Object)(object)loadedBundleByAsset))
{
m_Shader = loadedBundleByAsset.LoadAsset<Shader>(text2);
}
else
{
loadedBundleByAsset = Utilities.LoadFromResources("BulletTrails.Resources.slz_forcefield" + text + ".bundle");
m_Shader = loadedBundleByAsset.LoadAsset<Shader>(text2);
loadedBundleByAsset.Unload(false);
}
}
if (!Core.IsQuest && (Object)(object)m_Shader2 == (Object)null)
{
AssetBundle loadedBundleByAsset2 = GetLoadedBundleByAsset(text3);
if (Object.op_Implicit((Object)(object)loadedBundleByAsset2))
{
m_Shader2 = loadedBundleByAsset2.LoadAsset<Shader>(text3);
}
else
{
loadedBundleByAsset2 = Utilities.LoadFromResources("BulletTrails.Resources.slz_screendistortion.bundle");
m_Shader2 = loadedBundleByAsset2.LoadAsset<Shader>(text3);
loadedBundleByAsset2.Unload(false);
}
}
if ((Object)(object)m_Material == (Object)null)
{
m_Material = new Material(m_Shader)
{
name = "Mat_BulletTimeTrail",
renderQueue = 2549
};
m_Material.SetFloat("_AlphaCutoff", 0f);
m_Material.SetColor("_Color", m_Color);
m_Material.SetColor("_EdgeColor", Color.clear);
m_Material.SetColor("_EmissionColor", m_Color);
m_Material.SetFloat("_EdgeDistance", 0.1f);
m_Material.EnableKeyword("_EMISSION");
}
else
{
m_Material.shader = m_Shader;
}
if (!Core.IsQuest)
{
if ((Object)(object)m_Material2 == (Object)null)
{
m_Material2 = new Material(m_Shader2)
{
name = "Mat_BulletTimeTrail2",
renderQueue = 2548
};
}
else
{
m_Material2.shader = m_Shader2;
}
}
}
private void Start()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
m_Mesh = new Mesh();
m_Verticies = new List<Vector3>();
m_Triangles = new List<int>();
m_UVS = new List<Vector2>();
((Renderer)m_MeshRenderer).material = (m_IsBlur ? m_Material2 : m_Material);
((Renderer)m_MeshRenderer).material.renderQueue = (m_IsBlur ? 2548 : 2549);
CreateTrailMesh(m_IsBlur ? (m_Radius * 3f) : m_Radius, Core.IsQuest ? NumSegments : m_Segments, Time.deltaTime);
Core.AddTrail(this);
}
public void Cleanup()
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
public void UpdateTrail(float deltaTime)
{
//IL_0070: 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)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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)
float num = Mathf.Max(Time.timeScale, m_MinTimeScale);
m_ElapsedTime += deltaTime;
float num2 = m_ElapsedTime / (m_Duration / num);
m_FadeTime = Mathf.Clamp01(num2);
float num3 = m_Velocity * m_MuzzleVelocity * Time.timeScale * 0.0015f;
m_CurrentDistanceEnd = Mathf.Min(m_CurrentDistanceEnd + num3 * deltaTime, m_TotalDistance);
m_OriginEnd = Vector3.Lerp(m_OriginStartOld, m_OriginEnd_Target, m_CurrentDistanceEnd / m_TotalDistance);
if (num2 >= 0.7f)
{
float num4 = Mathf.Pow((num2 - 0.7f) / 0.3f, 2f);
float num5 = Mathf.Lerp(0.05f, 0.3f, num4);
float num6 = num3 * num5;
m_CurrentDistanceStart = Mathf.Min(m_CurrentDistanceStart + num6 * deltaTime, m_TotalDistance);
m_OriginStart = Vector3.Lerp(m_OriginStartOld, m_OriginEnd_Target, m_CurrentDistanceStart / m_TotalDistance);
}
UpdateMeshSegments(m_FadeTime);
}
private void UpdateMeshSegments(float deltaTime)
{
CreateTrailMesh(m_IsBlur ? (m_Radius * 3f) : m_Radius, m_Segments, deltaTime);
}
private void CreateTrailMesh(float Radius, int Segments, float deltaTime)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_0095: 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_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: 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_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: 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_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Clamp(m_BulletCount / 5f, 0.5f, 10f);
float num2 = Mathf.Clamp(m_Velocity / 10f, 0.5f, 2f);
float num3 = Mathf.Clamp(m_MuzzleVelocity / 10f, 0.5f, 2f);
float num4 = 0.001f * Radius * num * num2 * num3 * Mathf.Pow(1.05f, deltaTime);
float num5 = num4 * 0.5f;
Vector3 val = m_OriginEnd - m_OriginStart;
Vector3 normalized = ((Vector3)(ref val)).normalized;
val = Vector3.Cross(normalized, Vector3.up);
Vector3 normalized2 = ((Vector3)(ref val)).normalized;
val = Vector3.Cross(normalized2, normalized);
Vector3 normalized3 = ((Vector3)(ref val)).normalized;
m_Verticies.Clear();
m_Triangles.Clear();
m_UVS.Clear();
for (int i = 0; i < Segments; i++)
{
float num6 = (float)i / (float)Segments * (float)Math.PI * 2f;
Vector3 val2 = normalized3 * Mathf.Cos(num6) + normalized2 * Mathf.Sin(num6);
Vector3 val3 = normalized3 * Mathf.Cos(num6) + normalized2 * Mathf.Sin(num6);
m_Verticies.Add(m_OriginStart + val2 * num4);
m_Verticies.Add(m_OriginEnd + val3 * num5);
m_UVS.Add(new Vector2((float)i / (float)Segments, 0f));
m_UVS.Add(new Vector2((float)i / (float)Segments, 1f));
}
for (int j = 0; j < Segments - 1; j++)
{
int num7 = j * 2;
int num8 = (j + 1) % Segments * 2;
m_Triangles.Add(num7);
m_Triangles.Add(num7 + 1);
m_Triangles.Add(num8);
m_Triangles.Add(num7 + 1);
m_Triangles.Add(num8 + 1);
m_Triangles.Add(num8);
}
m_Mesh.Clear();
m_Mesh.vertices = Il2CppStructArray<Vector3>.op_Implicit(m_Verticies.ToArray());
m_Mesh.triangles = Il2CppStructArray<int>.op_Implicit(m_Triangles.ToArray());
m_Mesh.uv = Il2CppStructArray<Vector2>.op_Implicit(m_UVS.ToArray());
m_Mesh.RecalculateNormals();
m_MeshFilter.mesh = m_Mesh;
}
}
}