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 TobiramaSenju v0.25.1
plugins/TobiramaSenju/TobiramaSenju.dll
Decompiled a week 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.Serialization.Json; 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 EntityStates; using ExtraSkillSlots; using KinematicCharacterController; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using Rewired; using RoR2; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2.SurvivorMannequins; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TobiramaSenju")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+eb2256b72ec6875df56e4b80aa5379592b1c13a2")] [assembly: AssemblyProduct("TobiramaSenju")] [assembly: AssemblyTitle("TobiramaSenju")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TobiramaSenju; public static class DefaultAppearance { public static void Build(GameObject model) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[2] { "HENRY_TOBIRAMA_ENGLISH", "HENRY_TOBIRAMA_STORM" }; string[] array2 = new string[2] { "skin i paid a guy for", "Storm 4" }; string[] array3 = new string[2] { "Skin-Purchased.png", "Skin-Storm.png" }; string[] array4 = new string[2] { "HenryTobiramaVoiceSkin0", "HenryTobiramaStormSkin" }; SkinDef[] array5 = (SkinDef[])(object)new SkinDef[2]; for (int i = 0; i < 2; i++) { SkinDef val = ScriptableObject.CreateInstance<SkinDef>(); ((Object)val).name = array4[i]; val.nameToken = array[i]; LanguageAPI.Add(val.nameToken, array2[i]); Texture2D val2 = new Texture2D(2, 2); ImageConversion.LoadImage(val2, File.ReadAllBytes(Path.Combine(Visual.Assets, "Icons", array3[i]))); val.icon = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f)); val.rootObject = model; val.baseSkins = Array.Empty<SkinDef>(); val.rendererInfos = model.GetComponent<CharacterModel>().baseRendererInfos; val.gameObjectActivations = Array.Empty<GameObjectActivation>(); val.meshReplacements = Array.Empty<MeshReplacement>(); val.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); val.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); MethodInfo methodInfo = typeof(SkinDef).Assembly.GetType("RoR2.SkinDefParams")?.GetMethod("FromSkinDef", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (methodInfo != null) { typeof(SkinDef).GetField("skinDefParams").SetValue(val, methodInfo.Invoke(null, new object[1] { val })); } array5[i] = val; } (model.GetComponent<ModelSkinController>() ?? model.AddComponent<ModelSkinController>()).skins = array5; } public static void BuildDisplay(GameObject display, GameObject body) { CharacterModel componentInChildren = display.GetComponentInChildren<CharacterModel>(true); if (!Object.op_Implicit((Object)(object)componentInChildren)) { throw new InvalidOperationException("Survivor display is missing its CharacterModel."); } ModelSkinController componentInChildren2 = body.GetComponentInChildren<ModelSkinController>(true); ModelSkinController val = ((Component)componentInChildren).GetComponent<ModelSkinController>() ?? ((Component)componentInChildren).gameObject.AddComponent<ModelSkinController>(); SkinDef[] array = (SkinDef[])(object)new SkinDef[componentInChildren2.skins.Length]; for (int i = 0; i < array.Length; i++) { SkinDef val2 = componentInChildren2.skins[i]; SkinDef val3 = ScriptableObject.CreateInstance<SkinDef>(); ((Object)val3).name = ((Object)val2).name; val3.nameToken = val2.nameToken; val3.icon = val2.icon; val3.unlockableDef = val2.unlockableDef; val3.rootObject = ((Component)componentInChildren).gameObject; val3.baseSkins = Array.Empty<SkinDef>(); val3.rendererInfos = Array.Empty<RendererInfo>(); val3.gameObjectActivations = Array.Empty<GameObjectActivation>(); val3.meshReplacements = Array.Empty<MeshReplacement>(); val3.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); val3.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); MethodInfo methodInfo = typeof(SkinDef).Assembly.GetType("RoR2.SkinDefParams")?.GetMethod("FromSkinDef", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (methodInfo != null) { typeof(SkinDef).GetField("skinDefParams").SetValue(val3, methodInfo.Invoke(null, new object[1] { val3 })); } array[i] = val3; } val.skins = array; } } public static class DragonRig { public class Built { public Transform[] whiskers; public Quaternion trallRest; public Vector3 trallRestPos; public Vector3 headRestPos; public SkinnedMeshRenderer headR; public SkinnedMeshRenderer beardR; public Transform root; public Transform[] bones; public Animation anim; public SkinnedMeshRenderer[] renderers; public Quaternion[] restRot; public int[] chain; public int trall; public int head; } private static ModelData data; private static Mesh[] meshes; private static Material[] mats; private static AnimationClip[] clips; private static Matrix4x4[] restRel; private static Quaternion[] restRot; public static Material tubeBody; public static Material tubeRim; public static Material eye; public static Mesh headMesh; public static Mesh beardMesh; public static float[] headTip; public static float[] beardTip; public static Vector3[] headSmooth; public static Vector3[] beardSmooth; public static int SnoutTipIndex = -1; public static int SkullBackIndex = -1; public static float[] headManeW; public static Vector3[] headManeBase; public static Vector3[] headManeTip; public const float HeadScale = 4.4f; public const float BodyLength = 21f; public const float BodyBoneScale = 0.94838095f; private static Vector3 V(float[] a) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) return new Vector3(a[0], a[1], a[2]); } private static Quaternion Q(float[] a) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(a[0], a[1], a[2], a[3]); } public static void Prepare() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Expected O, but got Unknown //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_038b: 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_039b: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_084e: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_088e: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_08a1: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_08dd: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_0651: 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) data = TobiramaPack.Model("DragonRig.json"); Material val = StormFx.Mat((Texture)(object)StormFx.Tex("Water/srd00.png", (TextureWrapMode)1), additive: false, new Color(0.5f, 0.78f, 1f, 0.96f), 1.05f, 3004); Material val2 = StormFx.Mat((Texture)(object)StormFx.Tex("Water/srd01.png", (TextureWrapMode)0), additive: false, new Color(0.92f, 0.98f, 1f, 0.75f), 1.3f, 3005); Material val3 = StormFx.Mat((Texture)(object)StormFx.Tex("Water/srd00.png", (TextureWrapMode)1), additive: false, new Color(0.45f, 0.74f, 1f, 0.38f), 1f, 3003); eye = StormFx.Mat((Texture)(object)StormFx.soft, additive: true, new Color(0.85f, 1f, 1f, 1f), 3f, 3006); tubeBody = StormFx.Mat((Texture)(object)DragonWaterLook.Soft(StormFx.Tex("Water/srd07.png", (TextureWrapMode)0), 0.4f), additive: false, new Color(0.55f, 0.83f, 1f, 1f), 1.15f, 3002); tubeRim = StormFx.Mat((Texture)(object)DragonWaterLook.FoamTex(StormFx.Tex("Water/sjh_wtr02.png", (TextureWrapMode)0)), additive: true, new Color(0.95f, 0.99f, 1f, 1f), 1.4f, 3003); int n = data.bones.Length; Matrix4x4[] array = (Matrix4x4[])(object)new Matrix4x4[n]; restRel = (Matrix4x4[])(object)new Matrix4x4[n]; restRot = (Quaternion[])(object)new Quaternion[n]; for (int i = 0; i < n; i++) { BoneData boneData = data.bones[i]; Matrix4x4 val4 = Matrix4x4.TRS(V(boneData.rest.p), Q(boneData.rest.q), V(boneData.rest.s)); array[i] = ((boneData.parent < 0) ? val4 : (array[boneData.parent] * val4)); restRel[i] = array[i]; restRot[i] = ((Matrix4x4)(ref array[i])).rotation; } meshes = (Mesh[])(object)new Mesh[data.meshes.Length]; mats = (Material[])(object)new Material[data.meshes.Length]; for (int j = 0; j < data.meshes.Length; j++) { MeshData meshData = data.meshes[j]; Mesh val5 = new Mesh(); ((Object)val5).name = "Storm srd00 " + meshData.name; int num = meshData.v.Length / 3; Vector3[] array2 = (Vector3[])(object)new Vector3[num]; Vector3[] array3 = (Vector3[])(object)new Vector3[num]; Vector2[] array4 = (Vector2[])(object)new Vector2[num]; BoneWeight[] array5 = (BoneWeight[])(object)new BoneWeight[num]; for (int k = 0; k < num; k++) { array2[k] = new Vector3(meshData.v[k * 3], meshData.v[k * 3 + 1], meshData.v[k * 3 + 2]); array3[k] = new Vector3(meshData.n[k * 3], meshData.n[k * 3 + 1], meshData.n[k * 3 + 2]); array4[k] = new Vector2(meshData.uv[k * 2], meshData.uv[k * 2 + 1]); int num2 = k; BoneWeight val6 = default(BoneWeight); ((BoneWeight)(ref val6)).boneIndex0 = meshData.bi[k * 4]; ((BoneWeight)(ref val6)).boneIndex1 = meshData.bi[k * 4 + 1]; ((BoneWeight)(ref val6)).boneIndex2 = meshData.bi[k * 4 + 2]; ((BoneWeight)(ref val6)).boneIndex3 = meshData.bi[k * 4 + 3]; ((BoneWeight)(ref val6)).weight0 = meshData.bw[k * 4]; ((BoneWeight)(ref val6)).weight1 = meshData.bw[k * 4 + 1]; ((BoneWeight)(ref val6)).weight2 = meshData.bw[k * 4 + 2]; ((BoneWeight)(ref val6)).weight3 = meshData.bw[k * 4 + 3]; array5[num2] = val6; } val5.vertices = array2; val5.normals = array3; val5.uv = array4; val5.triangles = meshData.tri; val5.boneWeights = array5; val5.bindposes = array.Select((Matrix4x4 x) => ((Matrix4x4)(ref x)).inverse).ToArray(); StormFx.White(val5); if (meshData.name == "body01") { Vector3 ctr = Vector3.zero; Vector3[] array6 = array2; foreach (Vector3 val7 in array6) { ctr += val7; } ctr /= (float)Mathf.Max(1, num); float num4 = array2.Max(delegate(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 val12 = p - ctr; return ((Vector3)(ref val12)).magnitude; }); headManeW = new float[num]; headManeBase = (Vector3[])(object)new Vector3[num]; headManeTip = (Vector3[])(object)new Vector3[num]; Color32[] array7 = (Color32[])(object)new Color32[num]; for (int num5 = 0; num5 < num; num5++) { Vector3 val8 = array2[num5] - ctr; float magnitude = ((Vector3)(ref val8)).magnitude; float num6 = ((magnitude > 0.4f * num4) ? Mathf.SmoothStep(0f, 1f, (magnitude / num4 - 0.4f) / 0.5f) : 0f); headManeW[num5] = num6; if (num6 > 0f) { Vector3 val9 = val8 / magnitude; headManeBase[num5] = ctr + val9 * (0.4f * num4); headManeTip[num5] = ctr + val9 * (0.4f * num4 + (magnitude - 0.4f * num4) * 0.3f); } array7[num5] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(255f * (1f - 0.92f * Mathf.SmoothStep(0f, 1f, (num6 - 0.1f) / 0.6f)))); } val5.colors32 = array7; } val5.RecalculateBounds(); meshes[j] = val5; if (meshData.name == "body01" || meshData.name == "beard") { Vector3[] array8 = SmoothNormals(array2); float[] array9 = new float[num]; if (meshData.name == "body01") { Color32[] colors = val5.colors32; for (int num7 = 0; num7 < num; num7++) { array9[num7] = (float)(int)colors[num7].a / 255f; } headMesh = val5; headTip = array9; headSmooth = array8; int num8 = Array.FindIndex(data.bones, (BoneData b) => b.name.EndsWith("_head00")); float num9 = -99f; float num10 = 99f; for (int num11 = 0; num11 < num; num11++) { if (((BoneWeight)(ref array5[num11])).boneIndex0 == num8 && !(((BoneWeight)(ref array5[num11])).weight0 < 0.9f)) { if (array2[num11].y > num9) { num9 = array2[num11].y; SnoutTipIndex = num11; } if (array2[num11].y < num10) { num10 = array2[num11].y; SkullBackIndex = num11; } } } } else { Vector3 ctr2 = Vector3.zero; Vector3[] array6 = array2; foreach (Vector3 val10 in array6) { ctr2 += val10; } ctr2 /= (float)Mathf.Max(1, num); float num12 = array2.Max(delegate(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 val12 = p - ctr2; return ((Vector3)(ref val12)).magnitude; }); for (int num13 = 0; num13 < num; num13++) { int num14 = num13; Vector3 val11 = array2[num13] - ctr2; array9[num14] = 1f - 0.95f * Mathf.SmoothStep(0f, 1f, (((Vector3)(ref val11)).magnitude / num12 - 0.3f) / 0.6f); } beardMesh = val5; beardTip = array9; beardSmooth = array8; } } mats[j] = (meshData.name.EndsWith("_eye") ? eye : ((meshData.name == "body01" || meshData.name == "beard") ? val : ((meshData.name == "body03") ? val3 : val2))); } clips = data.clips.Select(delegate(ClipData c) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown AnimationClip val12 = new AnimationClip { legacy = true, frameRate = 30f, wrapMode = (WrapMode)2 }; for (int l = 0; l < n; l++) { string text = data.bones[l].name; for (int parent = data.bones[l].parent; parent >= 0; parent = data.bones[parent].parent) { text = data.bones[parent].name + "/" + text; } for (int m = 0; m < 7; m++) { Keyframe[] array10 = (Keyframe[])(object)new Keyframe[c.frames.Length]; for (int num15 = 0; num15 < array10.Length; num15++) { PoseData poseData = c.frames[num15].bones[l]; array10[num15] = new Keyframe((float)num15 / 30f, (m < 3) ? poseData.p[m] : poseData.q[m - 3]); } val12.SetCurve(text, typeof(Transform), (m < 3) ? ("localPosition." + "xyz"[m]) : ("localRotation." + "xyzw"[m - 3]), new AnimationCurve(array10)); } } val12.EnsureQuaternionContinuity(); ((Object)val12).name = c.name; return val12; }).ToArray(); } private static Vector3[] SmoothNormals(Vector3[] v) { //IL_001a: 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_0026: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c2: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) Dictionary<Vector3Int, Vector3> dictionary = new Dictionary<Vector3Int, Vector3>(); Vector3Int[] array = (Vector3Int[])(object)new Vector3Int[v.Length]; Vector3Int val2 = default(Vector3Int); for (int i = 0; i + 2 < v.Length; i += 3) { Vector3 val = Vector3.Cross(v[i + 1] - v[i], v[i + 2] - v[i]); for (int j = 0; j < 3; j++) { ((Vector3Int)(ref val2))..ctor(Mathf.RoundToInt(v[i + j].x * 500f), Mathf.RoundToInt(v[i + j].y * 500f), Mathf.RoundToInt(v[i + j].z * 500f)); array[i + j] = val2; dictionary.TryGetValue(val2, out var value); dictionary[val2] = value + val; } } Vector3[] array2 = (Vector3[])(object)new Vector3[v.Length]; for (int k = 0; k < v.Length; k++) { dictionary.TryGetValue(array[k], out var value2); array2[k] = ((((Vector3)(ref value2)).sqrMagnitude > 1E-12f) ? ((Vector3)(ref value2)).normalized : Vector3.up); } return array2; } public static Built Build(Transform parent) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) Built r = new Built(); Transform transform = new GameObject("StormWaterDragonRig").transform; transform.SetParent(parent, false); transform.localScale = Vector3.one * 4.4f; r.root = transform; int num = data.bones.Length; r.bones = (Transform[])(object)new Transform[num]; for (int i = 0; i < num; i++) { r.bones[i] = new GameObject(data.bones[i].name).transform; } for (int j = 0; j < num; j++) { BoneData boneData = data.bones[j]; r.bones[j].SetParent((boneData.parent < 0) ? transform : r.bones[boneData.parent], false); r.bones[j].localPosition = V(boneData.rest.p); r.bones[j].localRotation = Q(boneData.rest.q); r.bones[j].localScale = V(boneData.rest.s); } List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>(); for (int k = 0; k < meshes.Length; k++) { GameObject val = new GameObject(data.meshes[k].name); val.transform.SetParent(transform, false); SkinnedMeshRenderer val2 = val.AddComponent<SkinnedMeshRenderer>(); val2.sharedMesh = meshes[k]; val2.bones = r.bones; val2.rootBone = r.bones[0]; ((Renderer)val2).sharedMaterial = mats[k]; val2.updateWhenOffscreen = true; if (data.meshes[k].name == "body02" || data.meshes[k].name == "body03" || data.meshes[k].name == "body04") { val.SetActive(false); } ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; list.Add(val2); if (data.meshes[k].name == "body01") { r.headR = val2; } if (data.meshes[k].name == "beard") { r.beardR = val2; } } r.renderers = list.ToArray(); r.anim = ((Component)transform).gameObject.AddComponent<Animation>(); r.anim.cullingType = (AnimationCullingType)0; AnimationClip[] array = clips; foreach (AnimationClip val3 in array) { r.anim.AddClip(val3, ((Object)val3).name); } r.restRot = restRot; r.trall = Array.FindIndex(data.bones, (BoneData b) => b.name.EndsWith("_trall")); r.trallRest = r.bones[r.trall].localRotation; r.trallRestPos = r.bones[r.trall].localPosition; r.whiskers = (Transform[])(object)new Transform[4] { B("_beard_l01"), B("_beard_l03"), B("_beard_r01"), B("_beard_r03") }; r.head = Array.FindIndex(data.bones, (BoneData b) => b.name.EndsWith("_head00")); if (r.head >= 0) { r.headRestPos = r.bones[r.head].localPosition; } r.chain = (from num2 in Enumerable.Range(1, 12) select Array.FindIndex(data.bones, (BoneData b) => b.name.EndsWith("_bone" + num2.ToString("00")))).ToArray(); return r; Transform B(string s) { int num2 = Array.FindIndex(data.bones, (BoneData b) => b.name.EndsWith(s)); if (num2 < 0) { return null; } return r.bones[num2]; } } } public class WaterSkin { private readonly SkinnedMeshRenderer src; private readonly Mesh body; private readonly Mesh rim; private readonly MeshRenderer bodyR; private readonly MeshRenderer rimR; private readonly Vector3[] restV; private readonly Vector3[] restN; private readonly Vector3[] outV; private readonly Vector3[] outN; private readonly Color[] bc; private readonly Color[] rc; private readonly float[] tip; private readonly BoneWeight[] w; private readonly Matrix4x4[] bind; private readonly Matrix4x4[] skin; private readonly float baseAlpha; private readonly float[] maneW; private readonly Vector3[] maneBase; private readonly Vector3[] maneTip; private bool valid; public WaterSkin(Transform parent, string name, SkinnedMeshRenderer s, Mesh m, Vector3[] smooth, float[] tips, float alpha, float[] mW = null, Vector3[] mBase = null, Vector3[] mTip = null) { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown src = s; tip = tips; baseAlpha = alpha; maneW = mW; maneBase = mBase; maneTip = mTip; if (Object.op_Implicit((Object)(object)s) && Object.op_Implicit((Object)(object)m)) { ((Renderer)s).forceRenderingOff = true; restV = m.vertices; restN = smooth; w = m.boneWeights; bind = m.bindposes; skin = (Matrix4x4[])(object)new Matrix4x4[bind.Length]; outV = (Vector3[])(object)new Vector3[restV.Length]; outN = (Vector3[])(object)new Vector3[restV.Length]; bc = (Color[])(object)new Color[restV.Length]; rc = (Color[])(object)new Color[restV.Length]; body = new Mesh(); body.vertices = restV; body.uv = m.uv; body.triangles = m.triangles; body.colors = bc; body.MarkDynamic(); rim = new Mesh(); rim.vertices = restV; rim.uv = m.uv; rim.triangles = m.triangles; rim.colors = rc; rim.MarkDynamic(); GameObject val = new GameObject(name); val.transform.SetParent(parent, false); bodyR = StormFx.Part(val, "Water", body, DragonRig.tubeBody); rimR = StormFx.Part(val, "Rim", rim, DragonRig.tubeRim); } } public bool Centroid(out Vector3 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) c = Vector3.zero; if (outV == null || !valid) { return false; } for (int i = 0; i < outV.Length; i++) { c += outV[i]; } c /= (float)outV.Length; return true; } public bool Point(int index, out Vector3 p) { //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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) p = Vector3.zero; if (outV == null || !valid || index < 0 || index >= outV.Length) { return false; } p = outV[index]; return true; } private Vector3 Skin(Vector3 p, BoneWeight bw) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Matrix4x4)(ref skin[((BoneWeight)(ref bw)).boneIndex0])).MultiplyPoint3x4(p) * ((BoneWeight)(ref bw)).weight0 + ((Matrix4x4)(ref skin[((BoneWeight)(ref bw)).boneIndex1])).MultiplyPoint3x4(p) * ((BoneWeight)(ref bw)).weight1; if (((BoneWeight)(ref bw)).weight2 > 0f) { val += ((Matrix4x4)(ref skin[((BoneWeight)(ref bw)).boneIndex2])).MultiplyPoint3x4(p) * ((BoneWeight)(ref bw)).weight2; } return val; } public void Update(Vector3 cam, float time, float tipPow = 1f, float mul = 1f, Vector3? comb = null, Vector3 axisO = default(Vector3), Vector3 axisD = default(Vector3), float maxR = 0f) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: 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_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: 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_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0283: 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_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028d: 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_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: 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_02e3: 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_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)src) || restV == null) { return; } Transform[] bones = src.bones; for (int i = 0; i < skin.Length; i++) { skin[i] = (Object.op_Implicit((Object)(object)bones[i]) ? (bones[i].localToWorldMatrix * bind[i]) : Matrix4x4.identity); } valid = true; MeshRenderer obj = bodyR; bool enabled = (((Renderer)rimR).enabled = mul > 0.01f); ((Renderer)obj).enabled = enabled; for (int j = 0; j < restV.Length; j++) { BoneWeight bw = w[j]; Matrix4x4 val = skin[((BoneWeight)(ref bw)).boneIndex0]; Matrix4x4 val2 = skin[((BoneWeight)(ref bw)).boneIndex1]; Vector3 val3 = ((Matrix4x4)(ref val)).MultiplyPoint3x4(restV[j]) * ((BoneWeight)(ref bw)).weight0 + ((Matrix4x4)(ref val2)).MultiplyPoint3x4(restV[j]) * ((BoneWeight)(ref bw)).weight1; Vector3 val4 = ((Matrix4x4)(ref val)).MultiplyVector(restN[j]) * ((BoneWeight)(ref bw)).weight0 + ((Matrix4x4)(ref val2)).MultiplyVector(restN[j]) * ((BoneWeight)(ref bw)).weight1; if (((BoneWeight)(ref bw)).weight2 > 0f) { val3 += ((Matrix4x4)(ref skin[((BoneWeight)(ref bw)).boneIndex2])).MultiplyPoint3x4(restV[j]) * ((BoneWeight)(ref bw)).weight2; val4 += ((Matrix4x4)(ref skin[((BoneWeight)(ref bw)).boneIndex2])).MultiplyVector(restN[j]) * ((BoneWeight)(ref bw)).weight2; } if (maneW != null && comb.HasValue && maneW[j] > 0f) { Vector3 val5 = Skin(maneBase[j], bw); Vector3 val6 = Skin(maneTip[j], bw) - val5; float magnitude = ((Vector3)(ref val6)).magnitude; if (magnitude > 0.0001f) { val3 = val5 + Vector3.Slerp(val6 / magnitude, comb.Value, 0.95f * maneW[j]) * magnitude; } if (maxR > 0f) { Vector3 val7 = val3 - axisO; float num = Vector3.Dot(val7, axisD); Vector3 val8 = val7 - axisD * num; float magnitude2 = ((Vector3)(ref val8)).magnitude; float num2 = Mathf.Lerp(magnitude2, Mathf.Min(magnitude2, maxR), Mathf.Clamp01(maneW[j] * 2.5f)); if (magnitude2 > 0.0001f) { val3 = axisO + axisD * num + val8 * (num2 / magnitude2); } } } ((Vector3)(ref val4)).Normalize(); outV[j] = val3; outN[j] = val4; Vector3 val9 = cam - val3; float magnitude3 = ((Vector3)(ref val9)).magnitude; val9 /= Mathf.Max(0.001f, magnitude3); float fres = 1f - Mathf.Abs(Vector3.Dot(val4, val9)); float num3 = Mathf.SmoothStep(0f, 1f, (magnitude3 - 3f) / 4f); float num4 = Mathf.SmoothStep(0f, 1f, (Mathf.Pow(tip[j], tipPow) - 0.1f) / 0.45f) * num3; num4 *= mul; float num5 = ((maneW != null) ? maneW[j] : 0f); Vector3 val10 = restV[j]; DragonWaterLook.Shade(val4, val9, fres, baseAlpha, num4, num5 * 0.55f, val10.x * 3f + val10.z * 2f, val10.y * 3f + val10.z, time, out bc[j], out rc[j]); if (num5 > 0.25f) { float num6 = Mathf.Clamp01((num5 - 0.25f) * 2f) * num3 * mul * 0.6f; rc[j] = Color.Lerp(rc[j], new Color(1f, 1f, 1f, 1f) * num6 * Mathf.SmoothStep(0f, 1f, (Mathf.PerlinNoise(val10.x * 4f, val10.y * 4f - time * 2f) - 0.35f) / 0.2f), 0.7f); } } body.vertices = outV; body.normals = outN; body.colors = bc; body.RecalculateBounds(); rim.vertices = outV; rim.normals = outN; rim.colors = rc; rim.bounds = body.bounds; StormFx.Scroll((Renderer)(object)bodyR, new Vector2(time * 0.07f, (0f - time) * 1.3f), Vector2.one * 2f); StormFx.Scroll((Renderer)(object)rimR, new Vector2((0f - time) * 0.1f, (0f - time) * 2f), Vector2.one * 2f); } } public class DragonFlight : MonoBehaviour { private DragonBody body; public static int Built; private void OnEnable() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { body = new GameObject("TobiramaDragonBody").AddComponent<DragonBody>(); Built++; } body.Feed(((Component)this).transform.position, ((Component)this).transform.forward); } private void LateUpdate() { //IL_0019: 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) if (Object.op_Implicit((Object)(object)body)) { body.Feed(((Component)this).transform.position, ((Component)this).transform.forward); } } private void OnDisable() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { body.Crash(((Component)this).transform.position); body = null; } } } public class DragonBody : MonoBehaviour { private WaterSkin headSkin; private WaterSkin beardSkin; private DragonRig.Built rig; private Transform tubeT; private Mesh bodyMesh; private Mesh rimMesh; private MeshRenderer bodyR; private MeshRenderer rimR; private ParticleSystem spray; private const int Rings = 32; private const int Sides = 14; private Vector3[] bv; private Vector3[] bn; private Color[] bc; private Color[] rc; private readonly List<Vector3> path = new List<Vector3>(); private readonly List<float> arc = new List<float>(); private Vector3 origin; private Vector3 forward; private Vector3 right; private Vector3 source; private Vector3 sourceTop; private Vector3 shoulder; private Vector3 lastHead; private Vector3 headDir; private Vector3 proj; private Vector3 projFwd; private float born; private float sprayAcc; private float grow = 1f; private float emerge = 1f; private bool begun; private bool fed; private bool crashed; private bool done; private string clipName; private Vector3 crashFrom; private Vector3 crashPoint; private Vector3 comb; private float crashAt; private float advance; private float lastSpeed = 34f; private float pourAcc; private float diveTime = 0.12f; public const float SwayA = 1.5f; public const float SwayW = 8.5f; public const float SwayV = 0.5f; public const float SwayFade = 0.5f; public const float Rise = 0.4f; public const float MinCamDist = 6.5f; public const float NoseDown = 0f; public const float HuntA1 = 0.9f; public const float HuntW1 = 2.1f; public const float HuntA2 = 0.35f; public const float HuntW2 = 3.7f; public const float HuntV = 0.35f; public const float HuntWV = 1.7f; public const float MaxPitch = 50f; public const float ThrashA = 2.4f; private float ph1; private float ph2; private float ph3; private float ph4; private float seed; private float nextLash; private const int MaxLash = 4; private readonly float[] lashT0 = new float[4]; private readonly float[] lashAmp = new float[4]; private readonly Vector2[] lashDir = (Vector2[])(object)new Vector2[4]; private Vector3[] ringP; private Vector3[] ringT; private float[] ringS; private float prevYaw = float.NaN; private float yawRate; private float prevYawRate; private float logRoll; private float logPitch; private int yawFlips; private Vector3 feedRaw; private Vector3 feedVel; private float feedAt = -1f; private static readonly Quaternion RigToForward = Quaternion.LookRotation(Vector3.down, Vector3.forward); private int clamps; private float minCam; private float latMax; public const float SwayAmp = 0.6f; public const float SwayPeriodMin = 0.75f; public const float SwayPeriodMax = 0.9f; public const float LungeMul = 1.4f; public const float LungeDur = 0.15f; public const float HoverAboveProj = 1.6f; private Vector2 dashFrom; private Vector2 dashTo; private Vector2 dashH; private float snapT0 = -1f; private float offL; private float offV; private float fwdOff; private float lungeT0 = -9f; private float lastLunge = -9f; private float nextLunge = -1f; private float nextBite = -1f; private float swayPh; private float swayW = 8f; private float prevOffL; private int snapCount; private int lungeCount; private float snapSum; private float snapMaxDeg; private float snapMinDeg = 999f; private bool commit; private float commitT0; private float commitDur; private Vector3 commitFrom; private Vector3 commitPoint; private string commitWhy; private Vector3 logPrev; private bool logHas; private int jaw = -1; private Quaternion jawRest = Quaternion.identity; private Vector3 jawAxis = Vector3.right; private float jawClipMax; private float logJaw; public const float JawRest = 8f; public const float JawBite = 25f; public const float JawImpact = 30f; private float jawRestOpen; private float logJawMeasured = -1f; private int jawTipI = -1; private int jawChecks; private bool jawFlipped; public const float NeckR = 0.6f; public const float PeakR = 0.72f; public const float PeakU = 0.06f; private int lashCount; private float logNeckR; private float logMaxR; private float logMaxU; private float logThrashTail; private static readonly MaterialPropertyBlock block = new MaterialPropertyBlock(); private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) rig = DragonRig.Build(((Component)this).transform); GameObject val = new GameObject("WaterBody"); val.transform.SetParent(((Component)this).transform, false); tubeT = val.transform; bodyMesh = TubeMesh(); rimMesh = TubeMesh(); bodyMesh.MarkDynamic(); rimMesh.MarkDynamic(); bodyR = StormFx.Part(val, "Body", bodyMesh, DragonRig.tubeBody); rimR = StormFx.Part(val, "Rim", rimMesh, DragonRig.tubeRim); headSkin = new WaterSkin(val.transform, "WaterHead", rig.headR, DragonRig.headMesh, DragonRig.headSmooth, DragonRig.headTip, 0.85f, DragonRig.headManeW, DragonRig.headManeBase, DragonRig.headManeTip); beardSkin = new WaterSkin(val.transform, "WaterWhiskers", rig.beardR, DragonRig.beardMesh, DragonRig.beardSmooth, DragonRig.beardTip, 0.7f); spray = StormFx.System(((Component)this).gameObject, "Spray", Water03.droplet, 220, 1.4f, stretch: true); StormFx.Fade(spray, new Color(0.8f, 0.92f, 1f), new Color(0.65f, 0.88f, 1f), 0.6f, 0.45f, 0.5f); ParticleSystemRenderer component = ((Component)spray).GetComponent<ParticleSystemRenderer>(); component.renderMode = (ParticleSystemRenderMode)1; component.velocityScale = 0.05f; component.lengthScale = 1.3f; component.maxParticleSize = 0.018f; ph1 = Random.Range(0f, 6.28f); ph2 = Random.Range(0f, 6.28f); ph3 = Random.Range(0f, 6.28f); ph4 = Random.Range(0f, 6.28f); seed = Random.Range(0f, 100f); nextLash = Random.Range(0.35f, 0.6f); born = Time.time; clipName = ((Random.value < 0.5f) ? "blt01" : "blt02"); jaw = ((rig.bones == null) ? (-1) : Array.FindIndex(rig.bones, (Transform b) => Object.op_Implicit((Object)(object)b) && ((Object)b).name.EndsWith("_joe00"))); if (jaw >= 0) { jawRest = rig.bones[jaw].localRotation; } if (Object.op_Implicit((Object)(object)rig.anim) && TrackedReference.op_Implicit((TrackedReference)(object)rig.anim[clipName])) { rig.anim[clipName].speed = 1.2f; rig.anim.Play(clipName); if (jaw >= 0) { AnimationState val2 = rig.anim[clipName]; float num = 0f; float num3 = default(float); Vector3 val4 = default(Vector3); for (int num2 = 0; num2 < 16; num2++) { val2.time = (float)num2 / 16f * val2.length; rig.anim.Sample(); Quaternion val3 = Quaternion.Inverse(jawRest) * rig.bones[jaw].localRotation; ((Quaternion)(ref val3)).ToAngleAxis(ref num3, ref val4); if (num3 > 180f) { num3 -= 360f; } if (Mathf.Abs(num3) > Mathf.Abs(num) && ((Vector3)(ref val4)).sqrMagnitude > 0.5f) { num = num3; jawAxis = val4 * Mathf.Sign(num3); } } val2.time = 0f; jawClipMax = Mathf.Abs(num); } } jawRestOpen = JawRestOpening(); if (KitTuning.Verbose != null && KitTuning.Verbose.Value) { Kit.Log("DRAGON_JAW bone=" + jaw + " clipMax=" + jawClipMax.ToString("0") + " restOpen=" + jawRestOpen.ToString("0.0") + " axis=" + ((Vector3)(ref jawAxis)).ToString("F2")); } spray.Clear(); spray.Play(); } private void Spray(Vector3 p, Vector3 v, float size, float life, Color ignored) { //IL_001b: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Camera val = Cam(); float num = (Object.op_Implicit((Object)(object)val) ? Vector3.Distance(((Component)val).transform.position, p) : 99f); if (!(num < 4f)) { float num2 = Mathf.Clamp01((num - 4f) / 4f); StormFx.Emit(spray, p, v, size * 0.6f, life, new Color(0.78f, 0.9f, 1f, 0.5f * num2)); } } private Mesh TubeMesh() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_005c: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh(); int num = 480; val.vertices = (Vector3[])(object)new Vector3[num]; val.colors = (Color[])(object)new Color[num]; Vector2[] array = (Vector2[])(object)new Vector2[num]; for (int i = 0; i < 32; i++) { for (int j = 0; j <= 14; j++) { array[i * 15 + j] = new Vector2((float)j / 14f * 2f, (float)i / 31f * 4.5f); } } val.uv = array; List<int> list = new List<int>(); for (int k = 0; k < 31; k++) { for (int l = 0; l < 14; l++) { int num2 = k * 15 + l; int num3 = num2 + 14 + 1; list.AddRange(new int[6] { num2, num3, num2 + 1, num2 + 1, num3, num3 + 1 }); } } val.triangles = list.ToArray(); val.bounds = new Bounds(Vector3.zero, Vector3.one * 200f); return val; } public void Feed(Vector3 pos, Vector3 fwd) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_00b2: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00f2: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) projFwd = fwd; fed = true; if (feedAt < 0f) { feedRaw = pos; feedAt = Time.time; proj = pos; return; } Vector3 val = pos - feedRaw; if (((Vector3)(ref val)).sqrMagnitude > 1E-06f) { float num = Mathf.Max(Time.time - feedAt, Time.fixedDeltaTime * 0.5f); Vector3 val2 = (pos - feedRaw) / num; feedVel = ((((Vector3)(ref val2)).magnitude < 120f) ? val2 : feedVel); feedRaw = pos; feedAt = Time.time; } Vector3 val3 = feedRaw + feedVel * Mathf.Min(Time.time - feedAt, Time.fixedDeltaTime * 1.2f); float deltaTime = Time.deltaTime; proj += feedVel * deltaTime; proj = Vector3.Lerp(proj, val3, 1f - Mathf.Exp((0f - deltaTime) * 18f)); val = proj - val3; if (((Vector3)(ref val)).sqrMagnitude > 9f) { proj = val3; } } public void Crash(Vector3 at) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: 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_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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) if (crashed || done) { return; } crashed = true; crashAt = Time.time; crashFrom = lastHead; advance = 0f; Vector3 val = ((((Vector3)(ref headDir)).sqrMagnitude > 0.01f) ? headDir : forward); Vector3 val2 = at + val * 1.2f; Vector3 val3 = Vector3.ProjectOnPlane(val, Vector3.up); Vector3 val4 = ((((Vector3)(ref val3)).sqrMagnitude > 0.01f) ? val : forward); RaycastHit val5 = default(RaycastHit); RaycastHit val6 = default(RaycastHit); if (Physics.SphereCast(at, 0.4f, val4, ref val5, 3f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val5)).normal.y <= 0.55f) { val2 = ((RaycastHit)(ref val5)).point + ((RaycastHit)(ref val5)).normal * 0.4f; } else if (Physics.Raycast(at + Vector3.up * 0.5f, Vector3.down, ref val6, 41f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { Vector3 val7 = ((RaycastHit)(ref val6)).point + Vector3.up * 0.35f; val3 = Vector3.ProjectOnPlane(val, Vector3.up); val2 = val7 + ((Vector3)(ref val3)).normalized * 0.8f; } string text = "local"; if (ReliableWaterFlight.RecentSlam(at, 25f, out var r) && !r.reason.StartsWith("wall")) { Vector3 normalized; if (!(((Vector3)(ref r.dir)).sqrMagnitude > 0.01f)) { val3 = Vector3.ProjectOnPlane(val, Vector3.up); normalized = ((Vector3)(ref val3)).normalized; } else { normalized = ((Vector3)(ref r.dir)).normalized; } Vector3 val8 = normalized; val2 = (r.reason.StartsWith("large") ? (r.point + Vector3.up * 0.35f) : (r.point + Vector3.up * 0.35f + val8 * 1.2f)); text = r.reason; } if (KitTuning.Verbose != null && KitTuning.Verbose.Value) { RaycastHit val9 = default(RaycastHit); float num = (Physics.Raycast(lastHead, Vector3.down, ref val9, 60f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) ? (lastHead.y - ((RaycastHit)(ref val9)).point.y) : (-1f)); Kit.Log("DRAGON_SLAM id=" + ((Object)this).GetInstanceID() + " reason=" + text + " head=" + ((Vector3)(ref lastHead)).ToString("F1") + " headHeight=" + num.ToString("0.00") + " point=" + ((Vector3)(ref val2)).ToString("F1") + " headToPoint=" + Vector3.Distance(lastHead, val2).ToString("0.0") + " pointToBurst=" + ((text == "local") ? (-1f) : Vector3.Distance(val2, r.center)).ToString("0.0") + " diveDown=" + (lastHead.y - val2.y).ToString("0.0")); } crashPoint = val2; diveTime = (commit ? Mathf.Clamp(Vector3.Distance(crashFrom, crashPoint) / 70f, 0.04f, 0.12f) : Mathf.Clamp(Vector3.Distance(crashFrom, crashPoint) / 50f, 0.16f, 0.4f)); Kit.Log("DRAGON_CRASH id=" + ((Object)this).GetInstanceID() + " at=" + ((Vector3)(ref at)).ToString("F1") + " point=" + ((Vector3)(ref val2)).ToString("F1") + " clamps=" + clamps + " minCamDist=" + minCam.ToString("0.0") + " lateralMax=" + latMax.ToString("0.00") + " snaps=" + snapCount + " snapMean=" + ((snapCount > 0) ? (snapSum / (float)snapCount) : 0f).ToString("0.0") + " snapMin=" + ((snapCount > 0) ? snapMinDeg : 0f).ToString("0.0") + " snapMax=" + snapMaxDeg.ToString("0.0") + " lunges=" + lungeCount + " cracks=" + lashCount); } private void Begin() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00ca: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) begun = true; origin = proj; forward = projFwd; Vector3 val = Vector3.ProjectOnPlane(forward, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); right = Vector3.Cross(Vector3.up, val); Vector3 val2 = origin - Vector3.up * 1.1f; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(origin + Vector3.up * 0.5f, Vector3.down, ref val3, 4f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { val2 = ((RaycastHit)(ref val3)).point; } source = WaterDragonCast.SourcePoint(origin, val2, val); sourceTop = source + Vector3.up * 2.4f + val * 2.6f; shoulder = val2 + Vector3.up * 3.6f + val * 4f + right * 1.2f; path.Add(source - Vector3.up * 0.6f); path.Add(source + Vector3.up * 0.8f); path.Add(sourceTop); arc.Add(0f); arc.Add(1.4f); arc.Add(1.4f + Vector3.Distance(path[1], path[2])); lastHead = sourceTop; Vector3 val4 = shoulder - sourceTop; headDir = ((Vector3)(ref val4)).normalized; clamps = 0; minCam = 999f; latMax = 0f; born = Time.time; } private static Vector3 Bezier(Vector3 a, Vector3 b, Vector3 c, float u) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) float num = 1f - u; return num * num * a + 2f * num * u * b + u * u * c; } private Vector3 ProjDir() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!(((Vector3)(ref feedVel)).sqrMagnitude > 1f)) { if (!(((Vector3)(ref projFwd)).sqrMagnitude > 0.01f)) { return forward; } return ((Vector3)(ref projFwd)).normalized; } return ((Vector3)(ref feedVel)).normalized; } private Vector3 ProjFlat() { //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) //IL_0010: 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_0020: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(ProjDir(), Vector3.up); if (!(((Vector3)(ref val)).sqrMagnitude > 0.01f)) { return forward; } return ((Vector3)(ref val)).normalized; } private Vector3 ProjSlope() { //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ProjDir(); val.y = Mathf.Clamp(val.y, -0.6f, 0.6f); return ((Vector3)(ref val)).normalized; } private float ProjSpeed() { return Mathf.Clamp(((Vector3)(ref feedVel)).magnitude, 20f, 80f); } private void UpdateDash(float t, float dt) { if (crashed || t < 0.4f) { return; } float num = ProjSpeed(); float num2 = Mathf.SmoothStep(0f, 1f, (t - 0.4f) / 0.3f); if (nextLunge < 0f) { nextLunge = t + Random.Range(0.15f, 0.3f); nextBite = t + Random.Range(0.4f, 0.6f); swayPh = Random.Range(0f, 6.28f); } swayPh += swayW * dt; if (swayPh > MathF.PI * 2f) { swayPh -= MathF.PI * 2f; swayW = MathF.PI * 2f / Random.Range(0.75f, 0.9f); } float num3 = 0.6f * (0.75f + 0.25f * Mathf.Sin(t * 1.3f + seed)); prevOffL = offL; offL = num3 * Mathf.Sin(swayPh) * num2; offV = 0f; if (t >= nextLunge) { lungeT0 = t; lastLunge = t; lungeCount++; nextLunge = t + Random.Range(0.55f, 1.1f); snapT0 = t; nextBite = t + Random.Range(0.3f, 0.45f); LungeSpray(); if (KitTuning.Verbose != null && KitTuning.Verbose.Value) { Kit.Log("DRAGON_LUNGE id=" + ((Object)this).GetInstanceID() + " t=" + t.ToString("0.000") + " n=" + lungeCount); } } else if (t >= nextBite) { snapT0 = t; snapCount++; nextBite = t + Random.Range(0.45f, 0.8f); } if (t >= lungeT0 && t < lungeT0 + 0.15f) { fwdOff += 0.39999998f * num * dt; } else { fwdOff = Mathf.MoveTowards(fwdOff, 0f, 0.14f * num * dt); } } private void TryCommit(float t) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_027c: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) float num = ProjSpeed(); Vector3 val = ProjFlat(); float num2 = num * 0.22f; RaycastHit val5 = default(RaycastHit); foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent) && readOnlyInstances.healthComponent.alive && (!Object.op_Implicit((Object)(object)readOnlyInstances.teamComponent) || (int)readOnlyInstances.teamComponent.teamIndex != 1) && ReliableWaterFlight.IsLarge(readOnlyInstances, out var _)) { Vector3 val2 = readOnlyInstances.corePosition - proj; float num3 = Vector3.Dot(val2, val); Vector3 val3 = val2 - val * num3; val3.y = 0f; float num4 = num3 - readOnlyInstances.radius - 1.7f; if (!(num3 < 0f) && !(num4 > num2) && !(((Vector3)(ref val3)).magnitude > 1.7f + readOnlyInstances.radius)) { Vector3 footPosition = readOnlyInstances.footPosition; Vector3 val4 = (Physics.Raycast(footPosition + Vector3.up * 1.5f, Vector3.down, ref val5, 4f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val5)).point : footPosition); Commit(t, val4 + Vector3.up * 0.35f, Mathf.Clamp(num4 / num + 0.03f, 0.15f, 0.22f), "large"); return; } } } RaycastHit val6 = default(RaycastHit); if (Physics.SphereCast(proj, 0.45f, val, ref val6, num2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val6)).normal.y <= 0.55f) { Commit(t, ((RaycastHit)(ref val6)).point + ((RaycastHit)(ref val6)).normal * 0.4f, Mathf.Clamp(((RaycastHit)(ref val6)).distance / num, 0.12f, 0.22f), "wall"); return; } float num5 = KitTuning.WaterLife.Value - t; if (num5 <= 0.2f && num5 > 0.05f) { Vector3 val7 = proj + val * num * num5; Vector3 val8 = (Physics.Raycast(val7 + Vector3.up * 2f, Vector3.down, ref val5, 40f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val5)).point : (val7 - Vector3.up * 1.1f)); Commit(t, val8 + Vector3.up * 0.35f + val * 1.2f, Mathf.Max(0.15f, num5), "range"); } } private void Commit(float t, Vector3 point, float dur, string why) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) commit = true; commitT0 = t; commitDur = dur; commitFrom = lastHead; commitPoint = point; commitWhy = why; if (KitTuning.Verbose != null && KitTuning.Verbose.Value) { Kit.Log("DRAGON_COMMIT id=" + ((Object)this).GetInstanceID() + " why=" + why + " t=" + t.ToString("0.000") + " dur=" + dur.ToString("0.000") + " from=" + ((Vector3)(ref lastHead)).ToString("F1") + " point=" + ((Vector3)(ref point)).ToString("F1") + " dist=" + Vector3.Distance(lastHead, point).ToString("0.0")); } } private void LungeSpray() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) SnapSpray(new Vector2((offL > 0f) ? (-20f) : 20f, 0f)); } private void SnapSpray(Vector2 d) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0092: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) if (ringP != null) { Vector3 val = ProjDir(); Vector3 val2 = right * (0f - d.x) + Vector3.up * (0f - d.y) * 0.5f; Vector3 normalized = ((Vector3)(ref val2)).normalized; for (int i = 0; i < 10; i++) { Spray(lastHead + normalized * Random.Range(0.6f, 1.4f) * grow + Random.insideUnitSphere * 0.5f, normalized * Random.Range(8f, 15f) + val * Random.Range(-6f, 2f) + Vector3.up * Random.Range(1f, 4f), Random.Range(0.07f, 0.14f), Random.Range(0.3f, 0.55f), Color.white); } } } private Vector3 HeadAt(float t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = right * offL + Vector3.up * 1.6f + ProjSlope() * fwdOff; if (t >= 0.4f) { return proj + val; } float num = t / 0.4f; num = 1f - (1f - num) * (1f - num); return Bezier(sourceTop, shoulder, proj + val, num); } private void LateUpdate() { //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_00f5: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (mig