Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of KazuyaEnemy v0.9.0
plugins/KazuyaEnemy.dll
Decompiled an hour 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using REPOLib.Objects.Sdk; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("KazuyaEnemy")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.9.0.0")] [assembly: AssemblyInformationalVersion("0.9.0")] [assembly: AssemblyProduct("KazuyaEnemy")] [assembly: AssemblyTitle("KazuyaEnemy")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.9.0.0")] [module: UnverifiableCode] [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 Kazuya { internal static class KazAssets { private static readonly Dictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>(); private static string folder; public static string Folder { get { if (folder != null) { return folder; } List<string> list = new List<string>(); if (!string.IsNullOrWhiteSpace(Plugin.AssetFolder.Value)) { list.Add(Plugin.AssetFolder.Value.Trim().Trim('"')); } list.Add(Path.Combine(Plugin.PluginFolder, "assets")); list.Add(Plugin.PluginFolder); foreach (string item in list) { if (File.Exists(Path.Combine(item, "kazuya.rig")) && File.Exists(Path.Combine(item, "kazuya.anim"))) { return folder = item; } } throw new FileNotFoundException("kazuya.rig / kazuya.anim not found. Looked in: " + string.Join("; ", list)); } } public static byte[] Read(string name) { return File.ReadAllBytes(Path.Combine(Folder, name)); } public static Texture2D Texture(string name) { //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) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(name)) { return null; } if (textures.TryGetValue(name, out var value)) { return value; } string path = Path.Combine(Folder, name + ".png"); if (!File.Exists(path)) { path = Path.Combine(Folder, name + ".jpg"); } if (!File.Exists(path)) { Plugin.Log.LogWarning((object)("[Kazuya] Missing texture " + name)); return textures[name] = null; } value = new Texture2D(2, 2, (TextureFormat)4, true, false) { name = "Kazuya " + name, wrapMode = (TextureWrapMode)0 }; ImageConversion.LoadImage(value, File.ReadAllBytes(path)); Texture2D obj = value; ((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x20); return textures[name] = value; } } internal static class KazBuilder { public const string PrefabName = "Enemy - Kazuya"; public static EnemySetup Setup; private static bool tried; private static readonly string[] Contacts = new string[4] { "ATH_L_Foot_Btm", "ATH_R_Foot_Btm", "ATH_L_Toe_Btm", "ATH_R_Toe_Btm" }; private static readonly string[] HiddenMaterials = new string[5] { "Eye_ADD", "MI_CH_tear", "evileeye_tear", "eye_shadow", "evileeye_shadow" }; private static readonly string[] CutoutMaterials = new string[5] { "har_1p", "eyelash", "eyebrow", "evileeye_line", "evileeye_emissive" }; public static void BuildAndRegister(EnemyDirector director) { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Expected O, but got Unknown //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Expected O, but got Unknown //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Expected O, but got Unknown //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Expected O, but got Unknown //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Expected O, but got Unknown //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Expected O, but got Unknown //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Expected O, but got Unknown //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_072a: Unknown result type (might be due to invalid IL or missing references) //IL_07ec: Unknown result type (might be due to invalid IL or missing references) //IL_07fc: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_091c: Unknown result type (might be due to invalid IL or missing references) //IL_0921: Unknown result type (might be due to invalid IL or missing references) //IL_09c7: Unknown result type (might be due to invalid IL or missing references) if (tried) { return; } tried = true; List<EnemySetup> source = (from s in director.enemiesDifficulty1.Concat(director.enemiesDifficulty2).Concat(director.enemiesDifficulty3) where Object.op_Implicit((Object)(object)s) select s).ToList(); EnemySetup val = ((IEnumerable<EnemySetup>)source).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup s) => ((Object)s).name.Contains("Robe"))); if ((Object)(object)val == (Object)null) { throw new Exception("Could not find REPO's Robe enemy to build on. The game may have been updated."); } GameObject val2 = PrefabOf(val); if ((Object)(object)val2 == (Object)null) { throw new Exception("The Robe enemy has no prefab."); } EnemySetup val3 = ((IEnumerable<EnemySetup>)source).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup s) => ((Object)s).name.Contains("Beamer"))); GameObject val4 = (Object.op_Implicit((Object)(object)val3) ? PrefabOf(val3) : null); SemiLaser val5 = ((!Object.op_Implicit((Object)(object)val4)) ? null : val4.GetComponentInChildren<EnemyBeamer>(true)?.laser); byte[] rig = KazAssets.Read("kazuya.rig"); byte[] anim = KazAssets.Read("kazuya.anim"); GameObject val6 = new GameObject("Kazuya Prefabs"); val6.SetActive(false); ((Object)val6).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val6); GameObject val7 = Object.Instantiate<GameObject>(val2, val6.transform); ((Object)val7).name = "Enemy - Kazuya"; EnemyParent component = val7.GetComponent<EnemyParent>(); Enemy componentInChildren = val7.GetComponentInChildren<Enemy>(true); EnemyRigidbody componentInChildren2 = val7.GetComponentInChildren<EnemyRigidbody>(true); if (!Object.op_Implicit((Object)(object)componentInChildren) || !Object.op_Implicit((Object)(object)componentInChildren2)) { throw new Exception("The Robe prefab is missing its Enemy or EnemyRigidbody."); } AudioMixerGroup mixer = (from a in val7.GetComponentsInChildren<AudioSource>(true) select a.outputAudioMixerGroup).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup g) => Object.op_Implicit((Object)(object)g))); Material baseMat = (from r in val7.GetComponentsInChildren<Renderer>(true) where !(r is ParticleSystemRenderer) select r.sharedMaterial).FirstOrDefault((Func<Material, bool>)((Material m) => Object.op_Implicit((Object)(object)m))); MonoBehaviour[] componentsInChildren = val7.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val8 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val8) && ((object)val8).GetType().Name.StartsWith("EnemyRobe")) { Object.DestroyImmediate((Object)(object)val8); } } Animator[] componentsInChildren2 = val7.GetComponentsInChildren<Animator>(true); for (int num = 0; num < componentsInChildren2.Length; num++) { ((Behaviour)componentsInChildren2[num]).enabled = false; } Renderer[] componentsInChildren3 = val7.GetComponentsInChildren<Renderer>(true); for (int num = 0; num < componentsInChildren3.Length; num++) { componentsInChildren3[num].enabled = false; } Light[] componentsInChildren4 = val7.GetComponentsInChildren<Light>(true); for (int num = 0; num < componentsInChildren4.Length; num++) { ((Behaviour)componentsInChildren4[num]).enabled = false; } AudioSource[] componentsInChildren5 = val7.GetComponentsInChildren<AudioSource>(true); for (int num = 0; num < componentsInChildren5.Length; num++) { componentsInChildren5[num].playOnAwake = false; } EnemyStateSpawn component2 = ((Component)componentInChildren).GetComponent<EnemyStateSpawn>(); if (Object.op_Implicit((Object)(object)component2)) { component2.OnSpawn = new UnityEvent(); } EnemyVision component3 = ((Component)componentInChildren).GetComponent<EnemyVision>(); if (Object.op_Implicit((Object)(object)component3)) { component3.onVisionTriggered = new UnityEvent(); } EnemyStateInvestigate component4 = ((Component)componentInChildren).GetComponent<EnemyStateInvestigate>(); if (Object.op_Implicit((Object)(object)component4)) { component4.onInvestigateTriggered = new UnityEvent(); component4.OnlyEvent = true; } EnemyHealth component5 = ((Component)componentInChildren).GetComponent<EnemyHealth>(); if (Object.op_Implicit((Object)(object)component5)) { component5.onHurt = new UnityEvent(); component5.onDeathStart = new UnityEvent(); component5.onDeath = new UnityEvent(); component5.onObjectHurt = new UnityEvent(); component5.health = Plugin.Health.Value; component5.impactHurt = true; if (component5.impactLightDamage <= 0) { component5.impactLightDamage = 5; } if (component5.impactMediumDamage <= 0) { component5.impactMediumDamage = 15; } if (component5.impactHeavyDamage <= 0) { component5.impactHeavyDamage = 40; } } FieldInfo[] fields = typeof(EnemyRigidbody).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(UnityEvent)) { fieldInfo.SetValue(componentInChildren2, (object?)new UnityEvent()); } } RigKazuya.Result res = RigKazuya.Load(rig, anim, "Kazuya Model"); GameObject model = res.Root; int layer = ((Component)componentInChildren2).gameObject.layer; Transform[] componentsInChildren6 = model.GetComponentsInChildren<Transform>(true); for (int num = 0; num < componentsInChildren6.Length; num++) { ((Component)componentsInChildren6[num]).gameObject.layer = layer; } foreach (RigKazuya.Part part2 in res.Parts) { Dress(part2, baseMat); } foreach (RigKazuya.Part part3 in res.Parts) { if (((Object)part3.Renderer).name.Contains("exp_devil")) { DoubleSided(part3.Renderer.sharedMesh); } } Animation animation = res.Animation; animation.cullingType = (AnimationCullingType)0; AnimationClip clip = animation.GetClip("Idle"); if (Object.op_Implicit((Object)(object)clip)) { clip.SampleAnimation(model, 0f); } Transform val9 = Find("Head"); Transform val10 = Find("ATH_Head_Top"); Transform[] array = (from t in Contacts.Select(Find) where Object.op_Implicit((Object)(object)t) select t).ToArray(); float num2 = (Object.op_Implicit((Object)(object)val10) ? model.transform.InverseTransformPoint(val10.position).y : (Object.op_Implicit((Object)(object)val9) ? (model.transform.InverseTransformPoint(val9.position).y + 0.12f) : 1.75f)); float num3 = ((array.Length != 0) ? array.Min((Transform t) => model.transform.InverseTransformPoint(t.position).y) : 0f); float num4 = Plugin.Height.Value / Mathf.Max(0.5f, num2); model.transform.SetParent(((Component)componentInChildren2).transform, false); model.transform.localScale = Vector3.one * num4; model.transform.localRotation = Quaternion.identity; model.transform.localPosition = Vector3.up * ColliderFloor(((Component)componentInChildren2).transform); if (Object.op_Implicit((Object)(object)component5)) { component5.meshParent = model.transform; } RebuildBody(componentInChildren2, Plugin.Height.Value); RigKazuya.Part part = res.Parts.FirstOrDefault((RigKazuya.Part p) => ((Object)p.Renderer).name.Contains("bdu")); AddLimbColliders((part != null) ? part.Renderer : res.Parts[0].Renderer); SemiLaser val11 = null; if (Object.op_Implicit((Object)(object)val5)) { GameObject obj = Object.Instantiate<GameObject>(((Component)val5).gameObject, val7.transform); ((Object)obj).name = "Kazuya Devil Beam"; obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one; val11 = obj.GetComponent<SemiLaser>(); HurtCollider[] componentsInChildren7 = obj.GetComponentsInChildren<HurtCollider>(true); foreach (HurtCollider obj2 in componentsInChildren7) { obj2.enemyHost = componentInChildren; obj2.playerKill = false; obj2.playerDamage = Plugin.BeamDamage.Value; } } else { Plugin.Log.LogWarning((object)"[Kazuya] Couldn't find the Beamer's laser: the Devil Beam will be a plain line with no damage."); } KazuyaAI kazuyaAI = ((Component)componentInChildren).gameObject.AddComponent<KazuyaAI>(); kazuyaAI.model = model.transform; kazuyaAI.rig = res; KazuyaAI.SharedRig = res; kazuyaAI.anim = animation; kazuyaAI.head = val9; kazuyaAI.eyeL = Find("L_Eye_Joint"); kazuyaAI.eyeR = Find("R_Eye_Joint"); kazuyaAI.handR = Find("R_Hand"); kazuyaAI.handL = Find("L_Hand"); kazuyaAI.contacts = array; kazuyaAI.sole = num3 * num4; kazuyaAI.scale = num4; kazuyaAI.modelHome = model.transform.localPosition; kazuyaAI.laser = val11; kazuyaAI.voice = NewSource(model.transform, "Kazuya Voice", mixer, loop: false, 25f); kazuyaAI.sfx = NewSource(model.transform, "Kazuya Sfx", mixer, loop: false, 20f); kazuyaAI.steps = NewSource(model.transform, "Kazuya Steps", mixer, loop: false, 15f); kazuyaAI.mixer = mixer; component.enemyName = "Kazuya"; component.enemyNameLocalized = null; component.difficulty = (Difficulty)(Mathf.Clamp(Plugin.Difficulty.Value, 1, 3) - 1); component.SpawnedTimeMin = 180f; component.SpawnedTimeMax = 300f; component.DespawnedTimeMin = 60f; component.DespawnedTimeMax = 120f; Setup = Object.Instantiate<EnemySetup>(val); ((Object)Setup).name = "Enemy - Kazuya"; RarityPreset val12 = ScriptableObject.CreateInstance<RarityPreset>(); ((Object)val12).name = "Rarity - Kazuya"; val12.chance = Plugin.Rarity.Value; Setup.rarityPreset = val12; Object.DontDestroyOnLoad((Object)(object)Setup); Object.DontDestroyOnLoad((Object)(object)val12); EnemyContent val13 = ScriptableObject.CreateInstance<EnemyContent>(); AccessTools.Field(typeof(EnemyContent), "_setup").SetValue(val13, Setup); AccessTools.Field(typeof(EnemyContent), "_spawnObjects").SetValue(val13, new List<GameObject> { val7 }); Enemies.RegisterEnemy(val13); Plugin.Log.LogInfo((object)string.Format("[Kazuya] Registered (tier {0}, {1} animations, scale {2:0.00}, laser {3}, files from {4}).", Plugin.Difficulty.Value, animation.GetClipCount(), num4, Object.op_Implicit((Object)(object)val11) ? "Beamer's" : "none", KazAssets.Folder)); Transform Find(string n) { if (!res.ByName.TryGetValue(n, out var value)) { return null; } return value; } } private static GameObject PrefabOf(EnemySetup s) { return s.spawnObjects.Select((PrefabRef r) => ((PrefabRef<GameObject>)(object)r)?.Prefab).FirstOrDefault((Func<GameObject, bool>)((GameObject p) => Object.op_Implicit((Object)(object)p) && Object.op_Implicit((Object)(object)p.GetComponent<EnemyParent>()))); } private static void Dress(RigKazuya.Part part, Material baseMat) { Mesh sharedMesh = part.Renderer.sharedMesh; Material[] array = (Material[])(object)new Material[part.Submeshes.Count]; for (int i = 0; i < array.Length; i++) { RigKazuya.Submesh sub = part.Submeshes[i]; if (HiddenMaterials.Any((string h) => sub.Material.Contains(h))) { sharedMesh.SetTriangles(new int[0], i); array[i] = Opaque(baseMat, null, sub.Material); continue; } Texture2D albedo = KazAssets.Texture(sub.Albedo); bool flag = CutoutMaterials.Any((string c) => sub.Material.Contains(c)); array[i] = (flag ? Cutout(albedo, sub.Material, sub.Material.Contains("emissive")) : Opaque(baseMat, albedo, sub.Material)); } ((Renderer)part.Renderer).sharedMaterials = array; } private static void DoubleSided(Mesh mesh) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) int vertexCount = mesh.vertexCount; Vector3[] array = mesh.vertices; Vector3[] array2 = mesh.normals; Vector2[] array3 = mesh.uv; BoneWeight[] array4 = mesh.boneWeights; Array.Resize(ref array, vertexCount * 2); Array.Copy(array, 0, array, vertexCount, vertexCount); if (array2.Length == vertexCount) { Array.Resize(ref array2, vertexCount * 2); for (int i = 0; i < vertexCount; i++) { array2[vertexCount + i] = -array2[i]; } } if (array3.Length == vertexCount) { Array.Resize(ref array3, vertexCount * 2); Array.Copy(array3, 0, array3, vertexCount, vertexCount); } if (array4.Length == vertexCount) { Array.Resize(ref array4, vertexCount * 2); Array.Copy(array4, 0, array4, vertexCount, vertexCount); } int[][] array5 = new int[mesh.subMeshCount][]; for (int j = 0; j < array5.Length; j++) { int[] triangles = mesh.GetTriangles(j); int[] array6 = new int[triangles.Length * 2]; Array.Copy(triangles, array6, triangles.Length); for (int k = 0; k < triangles.Length; k += 3) { array6[triangles.Length + k] = triangles[k] + vertexCount; array6[triangles.Length + k + 1] = triangles[k + 2] + vertexCount; array6[triangles.Length + k + 2] = triangles[k + 1] + vertexCount; } array5[j] = array6; } if (vertexCount * 2 > 65535) { mesh.indexFormat = (IndexFormat)1; } mesh.vertices = array; if (array2.Length == vertexCount * 2) { mesh.normals = array2; } if (array3.Length == vertexCount * 2) { mesh.uv = array3; } if (array4.Length == vertexCount * 2) { mesh.boneWeights = array4; } for (int l = 0; l < array5.Length; l++) { mesh.SetTriangles(array5[l], l); } mesh.RecalculateBounds(); Plugin.Log.LogInfo((object)$"[Kazuya] {((Object)mesh).name}: two-sided ({vertexCount} -> {vertexCount * 2} vertices)."); } private static Material Opaque(Material baseMat, Texture2D albedo, string name) { //IL_001a: 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_0020: Expected O, but got Unknown //IL_00b0: 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) Material val = (Object.op_Implicit((Object)(object)baseMat) ? new Material(baseMat) : new Material(Shader.Find("Standard"))); ((Object)val).name = "Kazuya " + name; string[] array = new string[4] { "_BaseTexture", "_MainTex", "_BaseMap", "_AlbedoTexture" }; foreach (string text in array) { if (val.HasProperty(text)) { val.SetTexture(text, (Texture)(object)albedo); } } array = new string[3] { "_BaseColor", "_Color", "_AlbedoColor" }; foreach (string text2 in array) { if (val.HasProperty(text2)) { val.SetColor(text2, Color.white); } } if (val.HasProperty("_NormalTexture")) { val.SetTexture("_NormalTexture", (Texture)null); } if (val.HasProperty("_BumpMap")) { val.SetTexture("_BumpMap", (Texture)null); } if (val.HasProperty("_NormalStrength")) { val.SetFloat("_NormalStrength", 0f); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", Color.black); } if (val.HasProperty("_EmissionTexture")) { val.SetTexture("_EmissionTexture", (Texture)(object)Texture2D.blackTexture); } if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", (Texture)(object)Texture2D.blackTexture); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_MetallicTexture")) { val.SetTexture("_MetallicTexture", (Texture)(object)Texture2D.blackTexture); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0.3f); } if (val.HasProperty("_SmoothnessTexture")) { val.SetTexture("_SmoothnessTexture", (Texture)(object)Texture2D.whiteTexture); } if (val.HasProperty("_FresnelAmount")) { val.SetFloat("_FresnelAmount", 0.1f); } if (val.HasProperty("_TilingX")) { val.SetFloat("_TilingX", 1f); val.SetFloat("_TilingY", 1f); } if (val.HasProperty("_OffsetX")) { val.SetFloat("_OffsetX", 0f); val.SetFloat("_OffsetY", 0f); } return val; } private static Material Cutout(Texture2D albedo, string name, bool glow) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_00ec: 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) Material val = new Material(Shader.Find("Standard")) { name = "Kazuya " + name, mainTexture = (Texture)(object)albedo }; val.SetFloat("_Mode", 1f); val.SetFloat("_Cutoff", 0.4f); val.EnableKeyword("_ALPHATEST_ON"); val.DisableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.SetOverrideTag("RenderType", "TransparentCutout"); val.SetInt("_SrcBlend", 1); val.SetInt("_DstBlend", 0); val.SetInt("_ZWrite", 1); val.SetInt("_Cull", 0); val.SetFloat("_Glossiness", 0.25f); val.SetFloat("_Metallic", 0f); if (glow) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", new Color(1f, 0.2f, 0.2f) * 1.5f); val.SetTexture("_EmissionMap", (Texture)(object)albedo); } val.renderQueue = 2450; return val; } private static void RebuildBody(EnemyRigidbody erb, float height) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00f0: 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_0160: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)erb).transform; int num = -1; PhysicsMaterial sharedMaterial = null; Collider[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { if (val.isTrigger || (Object)(object)val == (Object)(object)erb.playerCollision || !((Component)val).CompareTag("Phys Grab Object") || Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<SkinnedMeshRenderer>())) { continue; } if (num < 0) { num = ((Component)val).gameObject.layer; sharedMaterial = val.sharedMaterial; } GameObject gameObject = ((Component)val).gameObject; Object.DestroyImmediate((Object)(object)val); if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<Collider>())) { PhysGrabObjectCollider component = gameObject.GetComponent<PhysGrabObjectCollider>(); if (Object.op_Implicit((Object)(object)component)) { Object.DestroyImmediate((Object)(object)component); } } } if (num < 0) { num = LayerMask.NameToLayer("PhysGrabObject"); } GameObject val2 = new GameObject("Kazuya Body Collider") { layer = num, tag = "Phys Grab Object" }; val2.transform.SetParent(transform, false); CapsuleCollider obj = val2.AddComponent<CapsuleCollider>(); obj.direction = 1; obj.radius = 0.32f; obj.height = Mathf.Clamp(height * 0.85f, 1f, 2.6f); obj.center = Vector3.zero; ((Collider)obj).sharedMaterial = sharedMaterial; val2.AddComponent<PhysGrabObjectCollider>(); erb.gravity = true; erb.stunFromFall = false; erb.grabStun = true; Rigidbody component2 = ((Component)transform).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component2)) { component2.centerOfMass = Vector3.zero; } } private static void AddLimbColliders(SkinnedMeshRenderer skin) { //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) int num = LayerMask.NameToLayer("StaticGrabObject"); if (num < 0 || !Object.op_Implicit((Object)(object)skin)) { return; } Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform[] bones = skin.bones; foreach (Transform val in bones) { if (Object.op_Implicit((Object)(object)val) && !dictionary.ContainsKey(((Object)val).name)) { dictionary[((Object)val).name] = val; } } string[,] array = new string[11, 2] { { "Hip", "Spine2" }, { "Spine2", "Neck" }, { "Neck", "ATH_Head_Top" }, { "L_Arm", "L_Elbow" }, { "L_Elbow", "L_Hand" }, { "R_Arm", "R_Elbow" }, { "R_Elbow", "R_Hand" }, { "L_UpLeg", "L_Leg" }, { "L_Leg", "L_Foot" }, { "R_UpLeg", "R_Leg" }, { "R_Leg", "R_Foot" } }; for (int j = 0; j < array.GetLength(0); j++) { if (dictionary.TryGetValue(array[j, 0], out var value) && dictionary.TryGetValue(array[j, 1], out var value2)) { Vector3 val2 = value.InverseTransformPoint(value2.position); float num2 = Mathf.Max(0.0001f, value.lossyScale.x); if (!(((Vector3)(ref val2)).magnitude * num2 < 0.12f)) { GameObject val3 = new GameObject("Grab " + ((Object)value).name) { layer = num, tag = "Phys Grab Object" }; val3.transform.SetParent(value, false); val3.AddComponent<PhysGrabObjectCollider>(); val3.transform.localRotation = Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref val2)).normalized); float num3 = Mathf.Clamp(((Vector3)(ref val2)).magnitude * num2 * 0.2f, 0.06f, 0.15f) / num2; CapsuleCollider obj = val3.AddComponent<CapsuleCollider>(); obj.direction = 1; obj.radius = num3; obj.height = ((Vector3)(ref val2)).magnitude + num3 * 2f; obj.center = new Vector3(0f, ((Vector3)(ref val2)).magnitude * 0.5f, 0f); } } } } private static float ColliderFloor(Transform body) { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d6: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; Collider[] componentsInChildren = ((Component)body).GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { if (val.isTrigger) { continue; } Transform transform = ((Component)val).transform; CapsuleCollider val2 = (CapsuleCollider)(object)((val is CapsuleCollider) ? val : null); IEnumerable<Vector3> enumerable; if (val2 != null) { Vector3 val3 = ((val2.direction == 0) ? Vector3.right : ((val2.direction == 1) ? Vector3.up : Vector3.forward)); float num2 = Mathf.Max(val2.height * 0.5f, val2.radius); enumerable = (IEnumerable<Vector3>)(object)new Vector3[3] { val2.center - val3 * num2, val2.center + val3 * num2, val2.center - Vector3.up * val2.radius }; } else { BoxCollider val4 = (BoxCollider)(object)((val is BoxCollider) ? val : null); if (val4 != null) { Vector3 val5 = val4.size * 0.5f; List<Vector3> list = new List<Vector3>(); for (int j = 0; j < 8; j++) { list.Add(val4.center + Vector3.Scale(val5, new Vector3((float)((j & 1) * 2 - 1), (float)((j & 2) - 1), (float)(((j & 4) >> 1) - 1)))); } enumerable = list; } else { SphereCollider val6 = (SphereCollider)(object)((val is SphereCollider) ? val : null); if (val6 == null) { continue; } enumerable = (IEnumerable<Vector3>)(object)new Vector3[1] { val6.center - Vector3.up * val6.radius }; } } foreach (Vector3 item in enumerable) { num = Mathf.Min(num, body.InverseTransformPoint(transform.TransformPoint(item)).y); } } if (num != float.MaxValue) { return num; } return 0f; } private static AudioSource NewSource(Transform parent, string name, AudioMixerGroup mixer, bool loop, float maxDistance) { //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) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); AudioSource obj = val.AddComponent<AudioSource>(); obj.playOnAwake = false; obj.loop = loop; obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 2f; obj.maxDistance = maxDistance; obj.dopplerLevel = 0f; obj.outputAudioMixerGroup = mixer; return obj; } } internal class KazFx { private const string Thunder = "fx/T_EF_COL_kazthunder02_purple_tss"; private const string BeamCore = "fx/T_EF_COL_kazthunder00_tss"; private const string BeamWisp = "fx/T_EF_COL_kazbeam03_tss"; private const string Flare = "fx/T_EF_MSK_flare_kazbeam01_tss"; private const string Glow = "fx/T_EF_MSK_light00_ss_mip"; private static readonly Color Electric = new Color(0.85f, 0.7f, 1f); private static readonly Color ElectricPurple = new Color(0.62f, 0.22f, 1f); private static readonly Color DevilPurple = new Color(0.8f, 0.25f, 1f); private static readonly Color DevilPink = new Color(1f, 0.55f, 0.95f); private static Shader blended; private static Texture2D scorchTex; private readonly Transform root; private readonly float s; private ParticleSystem arcs; private ParticleSystem ewgfFlash; private ParticleSystem ewgfSparks; private Light fistLight; private Light ewgfHitLight; private float ewgfHitLightT; private ParticleSystem charge; private ParticleSystem impactSparks; private ParticleSystem impactFlare; private LineRenderer core; private LineRenderer wisp; private Light chargeLight; private Light impactLight; private Transform scorch; private Material scorchMat; private Material scorchGlowMat; private AudioSource beamAudio; private float scorchAlpha; private float beamWidth; private static readonly string[] TexProps = new string[4] { "_MainTex", "_BaseMap", "_BaseTexture", "_AlbedoTexture" }; private static Material template; private static bool templateTried; private static Material Template { get { if (templateTried) { return template; } templateTried = true; List<Material> list = new List<Material>(); string[] array = new string[4] { "Items/Item Gun Laser", "Items/Item Gun Handgun", "Items/Item Gun Shotgun", "Items/Item Melee Stun Baton" }; for (int i = 0; i < array.Length; i++) { GameObject val = Resources.Load<GameObject>(array[i]); if (!Object.op_Implicit((Object)(object)val)) { continue; } ItemGun component = val.GetComponent<ItemGun>(); List<GameObject> list2 = new List<GameObject> { val }; if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.muzzleFlashPrefab)) { list2.Add(component.muzzleFlashPrefab); } if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.bulletPrefab)) { list2.Add(component.bulletPrefab); } foreach (GameObject item in list2) { ParticleSystemRenderer[] componentsInChildren = item.GetComponentsInChildren<ParticleSystemRenderer>(true); for (int j = 0; j < componentsInChildren.Length; j++) { Material sharedMaterial = ((Renderer)componentsInChildren[j]).sharedMaterial; if (Object.op_Implicit((Object)(object)sharedMaterial) && Object.op_Implicit((Object)(object)sharedMaterial.shader) && sharedMaterial.shader.isSupported && HasTex(sharedMaterial) && !list.Contains(sharedMaterial)) { list.Add(sharedMaterial); } } } } if (list.Count == 0) { Plugin.Log.LogWarning((object)"[Kazuya] FX: no REPO particle material found, building one."); return null; } list.Sort((Material a, Material b) => Score(b).CompareTo(Score(a))); template = list[0]; Plugin.Log.LogInfo((object)("[Kazuya] FX draw with REPO's \"" + ((Object)template).name + "\" (shader " + ((Object)template.shader).name + ", " + ((template.HasProperty("_DstBlend") && Mathf.Approximately(template.GetFloat("_DstBlend"), 1f)) ? "additive" : "blended") + ").")); return template; static int Score(Material m) { int num = 0; if (((Object)m.shader).name.Contains("Unlit")) { num += 4; } if (m.HasProperty("_DstBlend") && Mathf.Approximately(m.GetFloat("_DstBlend"), 1f)) { num += 2; } if (((Object)m.shader).name.Contains("Surface")) { num -= 4; } return num; } } } public KazFx(Transform parent, float scale, AudioMixerGroup mixer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) s = scale; root = new GameObject("Kazuya FX").transform; root.SetParent(parent, false); FindShaders(parent); BuildEwgf(); BuildBeam(mixer); } private static bool HasTex(Material m) { string[] texProps = TexProps; foreach (string text in texProps) { if (m.HasProperty(text)) { return true; } } return false; } private static void FindShaders(Transform parent) { if (!Object.op_Implicit((Object)(object)blended)) { blended = Shader.Find("Sprites/Default"); } } private static Material Mat(string tex, Color c, bool add = true) { //IL_0242: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_002a: 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_0041: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_0231: Unknown result type (might be due to invalid IL or missing references) Texture2D val = KazAssets.Texture(tex); if (Object.op_Implicit((Object)(object)val)) { ((Texture)val).wrapMode = (TextureWrapMode)0; } Material val2; if (Object.op_Implicit((Object)(object)Template)) { val2 = new Material(Template) { name = "Kazuya FX " + tex }; string[] texProps = TexProps; foreach (string text in texProps) { if (val2.HasProperty(text)) { val2.SetTexture(text, (Texture)(object)val); val2.SetTextureScale(text, Vector2.one); val2.SetTextureOffset(text, Vector2.zero); } } Shader shader = val2.shader; for (int j = 0; j < shader.GetPropertyCount(); j++) { if ((int)shader.GetPropertyType(j) == 0) { string propertyName = shader.GetPropertyName(j); if (!propertyName.Contains("Emission")) { Color color = val2.GetColor(propertyName); float num = Mathf.Max(color.r, Mathf.Max(color.g, color.b)); val2.SetColor(propertyName, new Color(num, num, num, color.a)); } } } if (val2.HasProperty("_EmissionColor")) { val2.SetColor("_EmissionColor", Color.black); } val2.DisableKeyword("_EMISSION"); if (val2.HasProperty("_Mode")) { val2.SetFloat("_Mode", 4f); } if (val2.HasProperty("_SrcBlend")) { val2.SetFloat("_SrcBlend", 5f); } if (val2.HasProperty("_DstBlend")) { val2.SetFloat("_DstBlend", 1f); } if (val2.HasProperty("_ZWrite")) { val2.SetFloat("_ZWrite", 0f); } val2.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val2.EnableKeyword("_ALPHABLEND_ON"); if (val2.HasProperty("_ColorMode")) { val2.SetFloat("_ColorMode", 0f); } val2.DisableKeyword("_COLOROVERLAY_ON"); val2.DisableKeyword("_COLORCOLOR_ON"); val2.DisableKeyword("_COLORADDSUBDIFF_ON"); if (val2.HasProperty("_Color")) { val2.SetColor("_Color", c); } if (val2.HasProperty("_TintColor")) { val2.SetColor("_TintColor", c * 0.5f); } } else { val2 = new Material(blended) { name = "Kazuya FX " + tex, mainTexture = (Texture)(object)val, color = c }; } val2.renderQueue = 3100; return val2; } private ParticleSystem NewPs(string name, Transform parent, string tex, Color tint, bool world) { //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_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_0057: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)(world ? 1 : 0); ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)2; ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = Mat(tex, tint); ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = false; return val2; } private static Light NewLight(string name, Transform parent, Color c, float range) { //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_0020: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); Light obj = val.AddComponent<Light>(); obj.type = (LightType)2; obj.color = c; obj.range = range; obj.intensity = 0f; obj.shadows = (LightShadows)0; ((Behaviour)obj).enabled = false; return obj; } private static void SetSize(ParticleSystem ps, float min, float max) { //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_000b: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; ((MainModule)(ref main)).startSize = new MinMaxCurve(min, max); } private void BuildEwgf() { //IL_0012: 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_002d: 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_0057: 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_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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01c3: 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_020d: 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_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0277: 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_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) arcs = NewPs("EWGF Arcs", root, "fx/T_EF_COL_kazthunder02_purple_tss", Color.white, world: false); MainModule main = arcs.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.05f, 0.12f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0f, 0.4f * s); ((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f); ((MainModule)(ref main)).startColor = new MinMaxGradient(Electric, ElectricPurple); ((MainModule)(ref main)).maxParticles = 40; SetSize(arcs, 0.22f * s, 0.5f * s); ShapeModule shape = arcs.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.07f * s; EmissionModule emission = arcs.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(55f); fistLight = NewLight("EWGF Fist Light", ((Component)arcs).transform, ElectricPurple, 2.5f * s); Transform transform = new GameObject("EWGF Hit").transform; transform.SetParent(root, false); ewgfFlash = NewPs("EWGF Flash", transform, "fx/T_EF_MSK_flare_kazbeam01_tss", Color.white, world: true); main = ewgfFlash.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.1f, 0.16f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f); ((MainModule)(ref main)).startColor = new MinMaxGradient(Color.white, ElectricPurple); SetSize(ewgfFlash, 1.2f * s, 1.8f * s); Fade(ewgfFlash); ewgfSparks = NewPs("EWGF Sparks", transform, "fx/T_EF_COL_kazthunder02_purple_tss", Color.white, world: true); main = ewgfSparks.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.12f, 0.3f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(2f * s, 6f * s); ((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f); ((MainModule)(ref main)).startColor = new MinMaxGradient(Electric, ElectricPurple); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.3f); SetSize(ewgfSparks, 0.25f * s, 0.6f * s); shape = ewgfSparks.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.15f * s; Fade(ewgfSparks); ewgfHitLight = NewLight("EWGF Hit Light", transform, ElectricPurple, 6f * s); } private static void Fade(ParticleSystem ps) { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_001e: 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_002d: 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_003e: 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_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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0098: Unknown result type (might be due to invalid IL or missing references) ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.8f, 0.4f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val); } public void EwgfArcs(Transform fist, bool on) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)fist)) { ((Component)arcs).transform.position = fist.position; } if (on && !arcs.isPlaying) { arcs.Play(true); } else if (!on && arcs.isPlaying) { arcs.Stop(true, (ParticleSystemStopBehavior)1); } ((Behaviour)fistLight).enabled = on; if (on) { fistLight.intensity = 1.5f + Mathf.PingPong(Time.time * 30f, 1.5f); } if (((Behaviour)ewgfHitLight).enabled) { ewgfHitLightT -= Time.deltaTime; ewgfHitLight.intensity = Mathf.Max(0f, ewgfHitLightT / 0.25f) * 8f; if (ewgfHitLightT <= 0f) { ((Behaviour)ewgfHitLight).enabled = false; } } } public void EwgfHit(Vector3 at, AudioMixerGroup mixer, string sound) { //IL_0010: 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) ((Component)ewgfFlash).transform.parent.position = at; ewgfFlash.Emit(2); ewgfSparks.Emit(28); ((Behaviour)ewgfHitLight).enabled = true; ewgfHitLightT = 0.25f; KazSounds.PlayAt(sound, at, mixer); } private void BuildBeam(AudioMixerGroup mixer) { //IL_0012: 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_002d: 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_004b: 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_006d: 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_00b3: 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_00c0: 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_010d: 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_013c: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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_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_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Expected O, but got Unknown //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Expected O, but got Unknown charge = NewPs("Beam Charge", root, "fx/T_EF_MSK_flare_kazbeam01_tss", Color.white, world: true); MainModule main = charge.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.08f, 0.16f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f); ((MainModule)(ref main)).startColor = new MinMaxGradient(DevilPurple, DevilPink); ((MainModule)(ref main)).maxParticles = 30; SetSize(charge, 0.1f * s, 0.2f * s); EmissionModule emission = charge.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(45f); Fade(charge); chargeLight = NewLight("Beam Charge Light", ((Component)charge).transform, DevilPurple, 3f * s); core = NewLine("Beam Core", "fx/T_EF_COL_kazthunder00_tss", DevilPink); wisp = NewLine("Beam Wisps", "fx/T_EF_COL_kazbeam03_tss", DevilPurple); Transform transform = new GameObject("Beam Impact").transform; transform.SetParent(root, false); impactFlare = NewPs("Beam Impact Flare", transform, "fx/T_EF_MSK_flare_kazbeam01_tss", Color.white, world: true); main = impactFlare.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.06f, 0.12f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f); ((MainModule)(ref main)).startColor = new MinMaxGradient(DevilPurple, DevilPink); SetSize(impactFlare, 0.6f * s, 1.1f * s); emission = impactFlare.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(40f); Fade(impactFlare); impactSparks = NewPs("Beam Impact Sparks", transform, "fx/T_EF_MSK_light00_ss_mip", Color.white, world: true); main = impactSparks.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.2f, 0.45f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(2f * s, 5f * s); ((MainModule)(ref main)).startColor = new MinMaxGradient(DevilPink, Color.white); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).maxParticles = 200; SetSize(impactSparks, 0.04f * s, 0.09f * s); ShapeModule shape = impactSparks.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)2; ((ShapeModule)(ref shape)).radius = 0.1f * s; emission = impactSparks.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(90f); ParticleSystemRenderer component = ((Component)impactSparks).GetComponent<ParticleSystemRenderer>(); component.renderMode = (ParticleSystemRenderMode)1; component.velocityScale = 0.06f; component.lengthScale = 1f; Fade(impactSparks); impactLight = NewLight("Beam Impact Light", transform, DevilPurple, 5f * s); if (!Object.op_Implicit((Object)(object)scorchTex)) { scorchTex = MakeScorch(); } scorch = new GameObject("Beam Scorch").transform; scorch.SetParent(root, false); scorchMat = new Material(blended) { mainTexture = (Texture)(object)scorchTex, renderQueue = 3050, name = "Kazuya FX scorch" }; scorchGlowMat = Mat("fx/T_EF_MSK_light00_ss_mip", DevilPurple); Quad(scorch, scorchMat, 1.4f * s, 0.01f); Quad(scorch, scorchGlowMat, 1.1f * s, 0.02f); ((Component)scorch).gameObject.SetActive(false); GameObject val = new GameObject("Beam Audio"); val.transform.SetParent(root, false); beamAudio = val.AddComponent<AudioSource>(); beamAudio.playOnAwake = false; beamAudio.spatialBlend = 1f; beamAudio.rolloffMode = (AudioRolloffMode)1; beamAudio.minDistance = 2f; beamAudio.maxDistance = 35f; beamAudio.dopplerLevel = 0f; beamAudio.outputAudioMixerGroup = mixer; } private LineRenderer NewLine(string name, string tex, Color c) { //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_0042: 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_0056: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(root, false); LineRenderer obj = val.AddComponent<LineRenderer>(); obj.positionCount = 2; obj.useWorldSpace = true; ((Renderer)obj).enabled = false; obj.textureMode = (LineTextureMode)0; obj.alignment = (LineAlignment)0; ((Renderer)obj).material = Mat(tex, c); obj.startColor = c; obj.endColor = c; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; return obj; } private static void Quad(Transform parent, Material m, float size, float lift) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_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_0074: Expected O, but got Unknown //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) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00b8: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Quad"); val.transform.SetParent(parent, false); val.transform.localPosition = Vector3.up * lift; val.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); val.transform.localScale = Vector3.one * size; Mesh val2 = new Mesh { name = "Kazuya FX quad" }; val2.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f), new Vector3(0.5f, -0.5f), new Vector3(-0.5f, 0.5f), new Vector3(0.5f, 0.5f) }; val2.uv = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f) }; val2.triangles = new int[6] { 0, 2, 1, 2, 3, 1 }; val2.RecalculateNormals(); val.AddComponent<MeshFilter>().sharedMesh = val2; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = m; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; } private static Texture2D MakeScorch() { //IL_0006: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_011e: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { name = "Kazuya FX scorch", wrapMode = (TextureWrapMode)1 }; Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = ((float)j + 0.5f) / 64f * 2f - 1f; float num2 = ((float)i + 0.5f) / 64f * 2f - 1f; float num3 = Mathf.Atan2(num2, num); float num4 = Mathf.Sqrt(num * num + num2 * num2); float num5 = Mathf.Clamp01((0.8f + 0.12f * Mathf.Sin(num3 * 5f) + 0.06f * Mathf.Sin(num3 * 13f + 1f) - num4) / 0.35f); array[i * 64 + j] = new Color(0.06f, 0.02f, 0.06f, num5 * 0.85f); } } val.SetPixels(array); val.Apply(); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x20); return val; } public void Beam(bool active, float charging, bool firing, Vector3 from, Vector3 to, bool hitSomething, Vector3 scorchAt, bool scorchOk) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) bool num = active && (charging > 0f || firing); ((Component)charge).transform.position = from; if (num) { float num2 = (firing ? 1.3f : Mathf.Lerp(0.3f, 1f, charging)); SetSize(charge, 0.25f * s * num2, 0.55f * s * num2); if (!charge.isPlaying) { charge.Play(true); } ((Behaviour)chargeLight).enabled = true; chargeLight.intensity = (firing ? 5f : (3f * charging)) + Mathf.PingPong(Time.time * 25f, 1f); } else { if (charge.isPlaying) { charge.Stop(true, (ParticleSystemStopBehavior)1); } ((Behaviour)chargeLight).enabled = false; } beamWidth = Mathf.MoveTowards(beamWidth, firing ? 1f : 0f, Time.deltaTime * (firing ? 12f : 6f)); bool flag = beamWidth > 0.01f; ((Renderer)core).enabled = flag; ((Renderer)wisp).enabled = flag; if (flag) { float num3 = Vector3.Distance(from, to); float num4 = 0.12f * s * beamWidth; float num5 = 0.42f * s * beamWidth * (1f + 0.08f * Mathf.Sin(Time.time * 40f)); core.startWidth = num4 * 1.3f; core.endWidth = num4; wisp.startWidth = num5 * 0.8f; wisp.endWidth = num5; core.SetPosition(0, from); core.SetPosition(1, to); wisp.SetPosition(0, from); wisp.SetPosition(1, to); ((Renderer)core).material.mainTextureScale = new Vector2(num3 / Mathf.Max(0.05f, num4 * 6f), 1f); ((Renderer)core).material.mainTextureOffset = new Vector2((0f - Time.time) * 6f, 0f); ((Renderer)wisp).material.mainTextureScale = new Vector2(num3 / Mathf.Max(0.05f, num5 * 3f), 1f); ((Renderer)wisp).material.mainTextureOffset = new Vector2((0f - Time.time) * 3.5f, 0f); } ((Component)impactFlare).transform.parent.position = to; ((Component)impactFlare).transform.parent.rotation = Quaternion.LookRotation(from - to); bool flag2 = firing && hitSomething; if (flag2 && !impactSparks.isPlaying) { impactSparks.Play(true); impactFlare.Play(true); } else if (!flag2 && impactSparks.isPlaying) { impactSparks.Stop(true, (ParticleSystemStopBehavior)1); impactFlare.Stop(true, (ParticleSystemStopBehavior)1); } ((Behaviour)impactLight).enabled = flag2; if (flag2) { impactLight.intensity = 4f + Mathf.PingPong(Time.time * 30f, 2f); } float num6 = ((!(active && scorchOk)) ? 0f : (firing ? 1f : Mathf.Clamp01(charging * 1.5f))); scorchAlpha = Mathf.MoveTowards(scorchAlpha, num6, Time.deltaTime * ((num6 > scorchAlpha) ? 3f : 0.7f)); ((Component)scorch).gameObject.SetActive(scorchAlpha > 0.01f); if (scorchAlpha > 0.01f) { if (active && !firing && scorchOk) { scorch.position = scorchAt; } scorchMat.color = new Color(1f, 1f, 1f, scorchAlpha); string[] array = new string[2] { "_TintColor", "_Color" }; foreach (string text in array) { if (scorchGlowMat.HasProperty(text)) { scorchGlowMat.SetColor(text, DevilPurple * ((text == "_TintColor") ? 0.5f : 1f) * scorchAlpha * (0.7f + 0.3f * Mathf.PingPong(Time.time * 4f, 1f))); } } } ((Component)beamAudio).transform.position = from; if (firing && !beamAudio.isPlaying) { AudioClip val = KazSounds.Get("beam", 0); if (Object.op_Implicit((Object)(object)val)) { beamAudio.clip = val; beamAudio.volume = 1f; beamAudio.time = 0f; beamAudio.Play(); } } else if (!firing && beamAudio.isPlaying) { beamAudio.volume = Mathf.MoveTowards(beamAudio.volume, 0f, Time.deltaTime * 4f); if (beamAudio.volume <= 0f) { beamAudio.Stop(); } } } public void StopAll() { arcs.Stop(true, (ParticleSystemStopBehavior)0); charge.Stop(true, (ParticleSystemStopBehavior)0); impactSparks.Stop(true, (ParticleSystemStopBehavior)0); impactFlare.Stop(true, (ParticleSystemStopBehavior)0); Light obj = fistLight; Light obj2 = chargeLight; Light obj3 = impactLight; bool flag = (((Behaviour)ewgfHitLight).enabled = false); bool flag3 = (((Behaviour)obj3).enabled = flag); bool enabled = (((Behaviour)obj2).enabled = flag3); ((Behaviour)obj).enabled = enabled; LineRenderer obj4 = core; enabled = (((Renderer)wisp).enabled = false); ((Renderer)obj4).enabled = enabled; beamWidth = 0f; scorchAlpha = 0f; ((Component)scorch).gameObject.SetActive(false); if (beamAudio.isPlaying) { beamAudio.Stop(); } } } internal static class KazSounds { private static readonly Dictionary<string, List<AudioClip>> groups = new Dictionary<string, List<AudioClip>>(); private static readonly Regex Numbered = new Regex("^(.+?)_\\d+$"); public static bool Loaded { get; private set; } public static IEnumerator LoadAll() { string dir; try { dir = Path.Combine(KazAssets.Folder, "sounds"); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Kazuya] No sounds: " + ex.Message)); yield break; } if (!Directory.Exists(dir)) { Plugin.Log.LogWarning((object)("[Kazuya] No sounds folder at " + dir)); yield break; } int n = 0; string[] files = Directory.GetFiles(dir, "*.ogg"); foreach (string text in files) { string name = Path.GetFileNameWithoutExtension(text); Match match = Numbered.Match(name); string group = (match.Success ? match.Groups[1].Value : name).ToLowerInvariant(); UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip(new Uri(text).AbsoluteUri, (AudioType)14); try { ((DownloadHandlerAudioClip)req.downloadHandler).streamAudio = false; yield return req.SendWebRequest(); if ((int)req.result != 1) { Plugin.Log.LogWarning((object)("[Kazuya] Sound " + name + " didn't load: " + req.error)); continue; } AudioClip content = DownloadHandlerAudioClip.GetContent(req); if (Object.op_Implicit((Object)(object)content)) { ((Object)content).name = "Kazuya " + name; ((Object)content).hideFlags = (HideFlags)(((Object)content).hideFlags | 0x20); if (!groups.TryGetValue(group, out var value)) { value = (groups[group] = new List<AudioClip>()); } value.Add(content); n++; } } finally { ((IDisposable)req)?.Dispose(); } } Loaded = true; Plugin.Log.LogInfo((object)$"[Kazuya] Loaded {n} sounds in {groups.Count} groups from {dir}."); } public static AudioClip Get(string group, int index = -1) { if (!groups.TryGetValue(group, out var value) || value.Count == 0) { return null; } return value[(index >= 0) ? (index % value.Count) : Random.Range(0, value.Count)]; } public static int Count(string group) { if (!groups.TryGetValue(group, out var value)) { return 0; } return value.Count; } public static void PlayAt(string group, Vector3 at, AudioMixerGroup mixer, float volume = 1f, float maxDistance = 25f) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown AudioClip val = Get(group); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = new GameObject("Kazuya " + group); val2.transform.position = at; AudioSource obj = val2.AddComponent<AudioSource>(); obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 2f; obj.maxDistance = maxDistance; obj.dopplerLevel = 0f; obj.outputAudioMixerGroup = mixer; obj.volume = volume; obj.PlayOneShot(val); Object.Destroy((Object)val2, val.length + 0.2f); } } } public class KazuyaAI : MonoBehaviour { public enum State { Spawn, Idle, Roam, Investigate, Chase, Sweep, Ewgf, Transform, Beam, Revert, Recover, Stun, Getup, Leave, Despawn, Combo, Taunt, Footsies, Grab, Throw, Dead } private class WingBone { public Transform t; public Transform lever; public Quaternion rest; public float degrees; public float sign; } private class Step { public string clip; public float length; public float travel; public float side; public float start; public bool reverse; } private class Move { public Step[] steps; public float active; public float slow = 1f; public float hold; public float stretch; public float ClipLength { get { float num = 0f; Step[] array = steps; foreach (Step step in array) { num += step.length; } return num; } } public float Duration => active / slow + hold + Mathf.Max(0f, ClipLength - active - stretch); public float ClipTime(float e) { float num = active / slow; if (e < num) { return e * slow; } if (e < num + hold) { if (!(hold > 0f) || !(stretch > 0f)) { return active; } return active + stretch * (e - num) / hold; } return Mathf.Min(ClipLength, active + stretch + (e - num - hold)); } public Step At(float ct, out float local) { Step[] array = steps; foreach (Step step in array) { if (ct <= step.length) { local = (step.reverse ? (step.start + step.length - ct) : (ct + step.start)); return step; } ct -= step.length; } Step step2 = steps[steps.Length - 1]; local = (step2.reverse ? step2.start : (step2.length + step2.start)); return step2; } public float Travelled(float ct) { float num = 0f; Step[] array = steps; foreach (Step step in array) { float num2 = Mathf.Clamp01(ct / Mathf.Max(0.0001f, step.length)); num += step.travel * num2; ct -= step.length; if (ct <= 0f) { break; } } return num; } public Vector2 Travelled2(float ct) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0069: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector2.zero; Step[] array = steps; foreach (Step step in array) { float num = Mathf.Clamp01(ct / Mathf.Max(0.0001f, step.length)); val += new Vector2(step.side, step.travel) * num; ct -= step.length; if (ct <= 0f) { break; } } return val; } } public Transform model; public Transform head; public Transform eyeL; public Transform eyeR; public Transform handR; public Transform handL; public Transform[] contacts; public RigKazuya.Result rig; public Animation anim; public AudioSource voice; public AudioSource sfx; public AudioSource steps; public AudioMixerGroup mixer; public SemiLaser laser; public LineRenderer telegraph; public float sole; public float scale = 1f; public Vector3 modelHome; private Enemy enemy; private PhotonView photonView; private EnemyStateInvestigate investigate; private readonly SpringQuaternion rotationSpring = new SpringQuaternion { damping = 0.6f, speed = 10f }; private Quaternion rotationTarget = Quaternion.identity; public State state; private int variant; private Vector3 focus; private float stateStart; private bool impulse = true; private float timer; private float sightTick; private float aimSend; private float beamCooldown = 6f; private float attackCooldown; private float tauntCooldown = 10f; private PlayerAvatar target; private float lastSeen = -99f; private Vector3 lastSeenAt; private Vector3 destination; private Vector3 attackStart; private Vector3 attackDir; private float travelDone; private float footsiesEnd; private float footsiesCooldown; private int footSerial; private int footDashes; private Vector2 footDone; private int dashStreak; private float dashReadyAt; private float approachReadyAt; private bool struck; private const float CloseRange = 2.1f; private const float BeamMin = 5f; private const float BeamSweepFrom = 0.45f; private const float BeamSweepTo = 19f / 30f; internal static RigKazuya.Result SharedRig; private SkinnedMeshRenderer[] devilOn; private SkinnedMeshRenderer[] devilOff; private KazFx fx; private Vector3 faceLocal = Vector3.forward; private bool faceCalibrated; private WingBone[] wingBones; private float wingSpread; private static readonly (string bone, string lever, float degrees)[] WingSpread = new(string, string, float)[4] { ("ATH_pinion{0}_top", "SWG_pinion{0}_2nd__swing", 35f), ("SWG_pinion{0}_3rd__swing", "SWG_pinion{0}__null", 100f), ("SWG_pinion{0}_top__swing", "SWG_pinion{0}_top01__null", 50f), ("SWG_pinion{0}_topD__swing", "SWG_pinion{0}_topD01__null", 25f) }; private State soundState = (State)(-1); private int soundVariant; private float soundCt; private Vector3 stepFrom; private float stepDist; private Move sweepMove; private Move ewgfMove; private Move transformMove; private Move beamMove; private readonly Move[] comboMoves = new Move[2]; private Move[] tauntMoves; private static readonly string[] FootClips = new string[5] { "BackDash", "DashF", "SideStepL", "SideStepR", "CrouchDash" }; private static readonly string[] FootNames = new string[5] { "backdash", "forward dash", "sidestep left", "sidestep right", "crouch dash" }; private const int KindBack = 0; private const int KindDash = 1; private const int KindCrouchDash = 4; private Move[] footMoves; private Move ewgfNoDash; private Move grabMove; private Move throwMove; private Move deathMove; private const float DeathHold = 1.2f; private const float ThrowSlamTime = 1.5f; private static readonly string[] TauntClips = new string[3] { "TauntCharge", "TauntPower", "TauntStand" }; private static readonly float[] TauntStarts = new float[3] { 0f, 0f, 1f }; private static readonly int[][] ComboHitFrames = new int[2][] { new int[10] { 22, 36, 46, 63, 81, 118, 142, 171, 196, 246 }, new int[9] { 22, 36, 53, 69, 93, 109, 139, 164, 212 } }; private static readonly string[] ComboClips = new string[2] { "TenHitA", "TenHitB" }; private Move revertMove; private const float TransformFlash = 17f / 60f; private const float RevertFlash = 0.35f; private PlayerAvatar hurtBy; private float hurtAt; private float switchReadyAt; private const float SwitchCooldown = 5f; private float followBase = float.NaN; private bool climbing; private float throwReadyAt; private PlayerAvatar throwVictim; private bool throwSlammed; private float lunge; private float lungeDone; private bool thrown; private float thrownStart; private float thrownRefresh; private static readonly int[] DemonHitFrames = new int[3] { 16, 40, 66 }; private int demonHit; private bool tauntAfter; private PlayerAvatar chaseTarget; private PlayerAvatar ignored; private float chaseSince; private float ignoredUntil; private bool givingUp; private const int GiveUpTaunt = 3; private const float BackTurnFrames = 95f; private Vector3 walkAwayFrom; private bool walkAway; private PlayerAvatar comboVictim; private int comboHit; private float comboAt; private bool locked; private int lockCombo; private int lockHit; private float lockStart; private float lockRefresh; private float pop; private static readonly RaycastHit[] beamHits = (RaycastHit[])(object)new RaycastHit[16]; private readonly Dictionary<int, float> strikes = new Dictionary<int, float>(); private static readonly string[][] ComboHitSounds = new string[2][] { new string[10] { "hit_p_med", "hit_p_light", "hit_p_light", "hit_p_light", "hit_k_light", "hit_k_med", "hit_k_light", "hit_k_light", "hit_p_heavy", "hit_p_heavy" }, new string[9] { "hit_p_med", "hit_p_light", "hit_k_light", "hit_k_med", "hit_p_light", "hit_k_light", "hit_k_light", "hit_p_heavy", "hit_p_heavy" } }; private static readonly RaycastHit[] hits = (RaycastHit[])(object)new RaycastHit[16]; private float flinchUntil; private bool flinchHigh; private float hurtVoiceAt; private bool deathDespawned; private State animState = (State)(-1); private int animVariant; private string timelineClip; private bool flinchShown; private bool devilShown; private Vector3 lastPos; private float speed; private float locoHoldUntil; private bool locoMoving; private static readonly RaycastHit[] floorHits = (RaycastHit[])(object)new RaycastHit[8]; private float planted = float.NaN; private bool HasCrouchDash { get { if (rig != null && rig.Clips.ContainsKey("CrouchDash")) { return rig.Clips.ContainsKey("CrouchDash_tsshoryu"); } return false; } } private bool HasThrow { get { if (rig != null && (Object)(object)handR != (Object)null && rig.Clips.ContainsKey("ThrowGrab")) { return rig.Clips.ContainsKey("ThrowR"); } return false; } } private int FootKind => Mathf.Clamp(variant & 7, 0, FootClips.Length - 1); private bool HasFootsies { get { if (rig != null && rig.Clips.ContainsKey("BackDash") && rig.Clips.ContainsKey("SideStepL")) { return rig.Clips.ContainsKey("SideStepR"); } return false; } } private float Elapsed => Time.time - stateStart; private bool HasDemon { get { if (rig != null) { return rig.Clips.ContainsKey("SpinningDemon"); } return false; } } private string TauntName { get { if ((variant & 3) != 3) { return TauntClips[Mathf.Clamp(variant & 3, 0, TauntClips.Length - 1)]; } return "BackTurn"; } } private float WalkSpeed => ClipSpeed("WalkF", 2.08f) * scale * Plugin.SpeedScale.Value; private float RunSpeed => ClipSpeed("Run", 6f) * scale * Plugin.SpeedScale.Value; private void SetDevil(bool devil) { SkinnedMeshRenderer[] componentsInChildren; if (devilOn == null && Object.op_Implicit((Object)(object)model)) { List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>(); List<SkinnedMeshRenderer> list2 = new List<SkinnedMeshRenderer>(); componentsInChildren = ((Component)model).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { if (((Object)val).name.Contains("fac_devil") || ((Object)val).name.Contains("exp_devil")) { list.Add(val); val.updateWhenOffscreen = true; } else if (((Object)val).name.EndsWith("kaz_fac")) { list2.Add(val); } } devilOn = list.ToArray(); devilOff = list2.ToArray(); Plugin.Log.LogInfo((object)("[Kazuya] Devil parts: " + string.Join(", ", list.Select((SkinnedMeshRenderer r) => ((Object)r).name)) + " / normal face: " + string.Join(", ", list2.Select((SkinnedMeshRenderer r) => ((Object)r).name)) + ".")); } if (devilOn == null) { return; } componentsInChildren = devilOn; foreach (SkinnedMeshRenderer val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2)) { ((Renderer)val2).enabled = devil; } } componentsInChildren = devilOff; foreach (SkinnedMeshRenderer val3 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val3)) { ((Renderer)val3).enabled = !devil; } } Plugin.Log.LogInfo((object)string.Format("[Kazuya] Devil {0} ({1} devil parts {2}, state {3}).", devil ? "on" : "off", devilOn.Length, devil ? "shown" : "hidden", state)); } private void WingPose() { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: 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 (!Object.op_Implicit((Object)(object)model)) { return; } if (wingBones == null && rig != null) { Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform[] componentsInChildren = ((Component)model).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { dictionary[((Object)val).name] = val; } List<WingBone> list = new List<WingBone>(); string[] array = new string[2] { "L", "R" }; foreach (string arg in array) { (string, string, float)[] array2 = WingSpread; for (int j = 0; j < array2.Length; j++) { (string, string, float) tuple = array2[j]; if (dictionary.TryGetValue("Chest_" + string.Format(tuple.Item1, arg), out var value) && dictionary.TryGetValue("Chest_" + string.Format(tuple.Item2, arg), out var value2)) { list.Add(new WingBone { t = value, lever = value2, rest = value.localRotation, degrees = tuple.Item3 }); } } } wingBones = list.ToArray(); if (wingBones.Length != 2 * WingSpread.Length) { Plugin.Log.LogWarning((object)$"[Kazuya] Found {wingBones.Length} of {2 * WingSpread.Length} wing bones."); } } if (wingBones == null || wingBones.Length == 0) { return; } float num = (devilShown ? 1f : 0f); if (wingSpread != 0f || num != 0f) { wingSpread = Mathf.MoveTowards(wingSpread, num, Time.deltaTime * (devilShown ? 2.5f : 4f)); if (wingBones[0].sign == 0f) { WingSigns(); } float num2 = Mathf.SmoothStep(0f, 1f, wingSpread); WingBone[] array3 = wingBones; foreach (WingBone wingBone in array3) { wingBone.t.localRotation = wingBone.rest; } array3 = wingBones; foreach (WingBone wingBone2 in array3) { wingBone2.t.rotation = Quaternion.AngleAxis(wingBone2.sign * wingBone2.degrees * num2, model.forward) * wingBone2.t.rotation; } } } private void WingSigns() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) WingBone[] array = wingBones; foreach (WingBone wingBone in array) { wingBone.t.localRotation = wingBone.rest; } array = wingBones; foreach (WingBone b in array) { float side = Mathf.Sign(model.InverseTransformPoint(b.t.position).x); Quaternion before = b.t.rotation; float num = Out(1f); float num2 = Out(-1f); b.sign = ((num >= num2) ? 1f : (-1f)); b.t.rotation = Quaternion.AngleAxis(b.sign * b.degrees, model.forward) * before; float Out(float sg) { //IL_001e: 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_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_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) b.t.rotation = Quaternion.AngleAxis(sg * b.degrees, model.forward) * before; return side * model.InverseTransformPoint(b.lever.position).x; } } array = wingBones; foreach (WingBone wingBone2 in array) { wingBone2.t.localRotation = wingBone2.rest; } } private void Awake() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown if (rig == null) { rig = SharedRig; } if (Object.op_Implicit((Object)(object)laser)) { laser.laserEnd = true; HideLaser(); } CalibrateFace(); if (Object.op_Implicit((Object)(object)model)) { fx = new KazFx(((Component)this).transform, scale, mixer); } enemy = ((Component)this).GetComponent<Enemy>(); photonView = ((Component)this).GetComponent<PhotonView>(); investigate = ((Component)this).GetComponent<EnemyStateInvestigate>(); EnemyStateSpawn component = ((Component)this).GetComponent<EnemyStateSpawn>(); if (Object.op_Implicit((Object)(object)component)) { component.OnSpawn.AddListener(new UnityAction(OnSpawn)); } if (Object.op_Implicit((Object)(object)investigate)) { investigate.onInvestigateTriggered.AddListener(new UnityAction(OnInvestigate)); } EnemyVision component2 = ((Component)this).GetComponent<EnemyVision>(); if (Object.op_Implicit((Object)(object)component2)) { component2.onVisionTriggered.AddListener(new UnityAction(OnVision)); } EnemyHealth health = ((Component)this).GetComponent<EnemyHealth>(); if (Object.op_Implicit((Object)(object)health)) { health.onDeath.AddListener(new UnityAction(OnDeath)); health.onHurt.AddListener(new UnityAction(OnHurt)); health.onObjectHurt.AddListener((UnityAction)delegate { HurtBy(health.onObjectHurtPlayer); }); } } private void HideLaser() { Renderer[] componentsInChildren = ((Component)laser).GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].forceRenderingOff = true; } Light[] componentsInChildren2 = ((Component)laser).GetComponentsInChildren<Light>(true); foreach (Light obj in componentsInChildren2) { obj.cullingMask = 0; obj.shadows = (LightShadows)0; } AudioSource[] componentsInChildren3 = ((Component)laser).GetComponentsInChildren<AudioSource>(true); foreach (AudioSource obj2 in componentsInChildren3) { obj2.mute = true; obj2.playOnAwake = false; } FieldInfo[] fields = typeof(SemiLaser).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(Sound)) { object? value = fieldInfo.GetValue(laser); Sound val = (Sound)((value is Sound) ? value : null); if (val != null) { val.Sounds = (AudioClip[])(object)new AudioClip[0]; } } } } private void CalibrateFace() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or