Decompiled source of Fort Bratwurst 2 v1.0.0
Fort_Bratwurst_2.dll
Decompiled 9 months 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.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using Atlas; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using Sodalite.Api; using Sodalite.Utilities; using Technie.PhysicsCreator.QHull; using UnityEditor; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] public class CameraRange : MonoBehaviour { public float minDistance = 0.02f; public float maxDistance = 2000f; private Camera[] cameras; private GameObject[] dndObjects; private void Start() { ((MonoBehaviour)this).Invoke("DelayedStart", 5f); } private void DelayedStart() { Debug.Log((object)"Attempting to find cameras"); dndObjects = GetDontDestroyOnLoadObjects(); cameras = Object.FindObjectsOfType<Camera>(); for (int i = 0; i < cameras.Length; i++) { Debug.Log((object)("Camera " + i + " default Near/Far values: " + cameras[i].nearClipPlane + " / " + cameras[i].farClipPlane)); cameras[i].nearClipPlane = minDistance; cameras[i].farClipPlane = maxDistance; } if (dndObjects == null) { return; } for (int j = 0; j < dndObjects.Length; j++) { Camera component = dndObjects[j].GetComponent<Camera>(); if ((Object)(object)component != (Object)null) { Debug.Log((object)("Camera " + j + " default Near/Far values: " + component.nearClipPlane + " / " + component.farClipPlane)); component.nearClipPlane = minDistance; component.farClipPlane = maxDistance; } } } public static GameObject[] GetDontDestroyOnLoadObjects() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //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) GameObject val = null; try { val = new GameObject(); Object.DontDestroyOnLoad((Object)(object)val); Scene scene = val.scene; Object.DestroyImmediate((Object)(object)val); val = null; return ((Scene)(ref scene)).GetRootGameObjects(); } finally { if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)val); } } } } namespace MeatKit { public class HideInNormalInspectorAttribute : PropertyAttribute { } } namespace Andr3a.Fort_Bratwurst_2 { [BepInPlugin("Andr3a.Fort_Bratwurst_2", "Fort_Bratwurst_2", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("nrgill28.Atlas", "1.0.1")] public class Fort_Bratwurst_2Plugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Andr3a.Fort_Bratwurst_2"); AtlasPlugin.RegisterScene(Path.Combine(BasePath, "fb2")); } } } public class NavMeshCleaner : MonoBehaviour { private class Tri { public int i1; public int i2; public int i3; public int min; public int max; public Tri(int i1, int i2, int i3) { this.i1 = i1; this.i2 = i2; this.i3 = i3; min = Mathf.Min(new int[3] { i1, i2, i3 }); max = Mathf.Max(new int[3] { i1, i2, i3 }); } } private class Edge { public int i1; public int i2; public Edge(int i1, int i2) { this.i1 = i1; this.i2 = i2; } } [CustomEditor(typeof(NavMeshCleaner))] public class NavMeshCleanerEditor : Editor { private static class Styles { private static Dictionary<string, GUIStyle> texture = new Dictionary<string, GUIStyle>(); public static GUIStyle Get(string id) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (!texture.TryGetValue(id, out var value)) { value = new GUIStyle(GUIStyle.op_Implicit(id)); texture.Add(id, value); } return value; } } private NavMeshCleaner m_Target; private int m_OverPoint = -1; private static float kEpsilon = 1E-06f; private void OnEnable() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown m_Target = (NavMeshCleaner)(object)((Editor)this).target; Undo.undoRedoPerformed = (UndoRedoCallback)Delegate.Combine((Delegate?)(object)Undo.undoRedoPerformed, (Delegate?)new UndoRedoCallback(OnUndoOrRedo)); } private void OnDisable() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Undo.undoRedoPerformed = (UndoRedoCallback)Delegate.Remove((Delegate?)(object)Undo.undoRedoPerformed, (Delegate?)new UndoRedoCallback(OnUndoOrRedo)); } private void OnUndoOrRedo() { ((Editor)this).Repaint(); } public override void OnInspectorGUI() { //IL_007c: 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_00f2: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) EditorGUILayout.HelpBox((m_OverPoint == -1) ? "Press Control and click to add a walkable point." : "Press Control and click to remove the point.", (MessageType)((m_Target.m_WalkablePoint.Count != 0) ? 1 : 2)); ((Editor)this).OnInspectorGUI(); NavMeshCleaner navMeshCleaner = (NavMeshCleaner)(object)((Editor)this).target; if (navMeshCleaner.m_Child.Count > 0) { EditorGUI.BeginChangeCheck(); bool flag = EditorGUILayout.Toggle("Hide Temp Mesh Object In Hierarchy", ((((Object)navMeshCleaner.m_Child[0].gameObject).hideFlags & 1) != 0) ? true : false, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { for (int i = 0; i < navMeshCleaner.m_Child.Count; i++) { ((Object)navMeshCleaner.m_Child[i].gameObject).hideFlags = (HideFlags)((!flag) ? (((Object)navMeshCleaner.m_Child[i].gameObject).hideFlags & -2) : (((Object)navMeshCleaner.m_Child[i].gameObject).hideFlags | 1)); } try { EditorApplication.RepaintHierarchyWindow(); EditorApplication.DirtyHierarchyWindowSorting(); } catch { } } } if (GUILayout.Button((!navMeshCleaner.HasMesh()) ? "Calculate" : "Recalculate", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { navMeshCleaner.Build(); navMeshCleaner.SetMeshVisible(visible: true); SceneView.RepaintAll(); } if (navMeshCleaner.HasMesh() && GUILayout.Button((!navMeshCleaner.MeshVisible()) ? "Show Mesh" : "Hide Mesh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { bool meshVisible = !navMeshCleaner.MeshVisible(); navMeshCleaner.SetMeshVisible(meshVisible); SceneView.RepaintAll(); } if (navMeshCleaner.HasMesh() && GUILayout.Button("Reset Mesh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { navMeshCleaner.Reset(); SceneView.RepaintAll(); } if (navMeshCleaner.HasMesh() && GUILayout.Button("Reset WalkablePoints", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { Undo.RecordObject(((Editor)this).target, "reset"); m_Target.m_WalkablePoint.Clear(); SceneView.RepaintAll(); } } private void DrawDisc(Vector3 p, Vector3 n, float radius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0067: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[20]; Matrix4x4 val = Matrix4x4.TRS(p, Quaternion.LookRotation(n), Vector3.one * radius); for (int i = 0; i < 20; i++) { ref Vector3 reference = ref array[i]; reference = ((Matrix4x4)(ref val)).MultiplyPoint3x4(new Vector3(Mathf.Cos((float)Math.PI * 2f * (float)i / 19f), Mathf.Sin((float)Math.PI * 2f * (float)i / 19f), 0f)); } Handles.DrawAAPolyLine(array); } private void OnSceneGUI() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Invalid comparison between Unknown and I4 //IL_008b: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Invalid comparison between Unknown and I4 //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00aa: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Invalid comparison between Unknown and I4 SceneView currentDrawingSceneView = SceneView.currentDrawingSceneView; Event current = Event.current; if ((int)current.type == 7) { for (int i = 0; i < m_Target.m_WalkablePoint.Count; i++) { Vector3 val = ((Component)m_Target).transform.TransformPoint(m_Target.m_WalkablePoint[i]); float num = WorldSize(1f, currentDrawingSceneView.camera, val); Handles.color = Color.black; DrawDisc(val, Vector3.up, num * 15f); Handles.color = ((i != m_OverPoint) ? Color.green : Color.red); Handles.DrawSolidDisc(val, Vector3.up, num * 10f); Handles.DrawLine(val, val + Vector3.up * (num * 200f)); } } if ((int)current.type == 8 && current.control) { HandleUtility.AddDefaultControl(GUIUtility.GetControlID((FocusType)2)); } if (current.control) { EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (MouseCursor)((m_OverPoint != -1) ? 12 : 11)); } if (((int)current.type == 0 || (int)current.type == 3 || (int)current.type == 2 || (int)current.type == 1) && current.button == 0) { MouseEvent(current.type, current.mousePosition, (int)current.modifiers == 2); } } private void MouseEvent(EventType type, Vector2 mouseposition, bool controldown) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0010: Invalid comparison between Unknown and I4 //IL_00aa: 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_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_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_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) SceneView currentDrawingSceneView = SceneView.currentDrawingSceneView; Ray val = HandleUtility.GUIPointToWorldRay(mouseposition); if ((int)type == 2) { int num = -1; for (int i = 0; i < m_Target.m_WalkablePoint.Count; i++) { Vector3 val2 = ((Component)m_Target).transform.TransformPoint(m_Target.m_WalkablePoint[i]); float num2 = WorldSize(10f, currentDrawingSceneView.camera, val2) * 1.5f; if (DistanceRayVsPoint(val, val2) < num2) { num = i; break; } } if (num != m_OverPoint) { m_OverPoint = num; HandleUtility.Repaint(); } } if ((int)type != 0 || !controldown) { return; } if (m_OverPoint != -1) { Undo.RecordObject((Object)(object)m_Target, "Remove Point"); m_Target.m_WalkablePoint.RemoveAt(m_OverPoint); m_OverPoint = -1; } else { float num3 = 1000f; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val, ref val3, num3)) { Undo.RecordObject((Object)(object)m_Target, "Add Point"); m_Target.m_WalkablePoint.Add(((Component)m_Target).transform.InverseTransformPoint(((RaycastHit)(ref val3)).point)); } else { NavMeshTriangulation val4 = NavMesh.CalculateTriangulation(); Vector3[] vertices = val4.vertices; int[] indices = val4.indices; Vector3 outNormal = Vector3.up; for (int j = 0; j < indices.Length; j += 3) { num3 = IntersectTest(val, vertices[indices[j]], vertices[indices[j + 1]], vertices[indices[j + 2]], num3, ref outNormal); } if (num3 < 1000f) { Undo.RecordObject((Object)(object)m_Target, "Add Point"); Vector3 val5 = ((Ray)(ref val)).origin + ((Ray)(ref val)).direction * num3; m_Target.m_WalkablePoint.Add(((Component)m_Target).transform.InverseTransformPoint(val5)); } } } HandleUtility.Repaint(); } private static float IntersectTest(Ray ray, Vector3 v0, Vector3 v1, Vector3 v2, float mint, ref Vector3 outNormal) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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_0058: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0106: 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) Vector3 val = v1 - v0; Vector3 val2 = v2 - v0; Vector3 val3 = Vector3.Cross(((Ray)(ref ray)).direction, val2); float num = Vector3.Dot(val, val3); if (num > 0f - kEpsilon && num < kEpsilon) { return mint; } float num2 = 1f / num; Vector3 val4 = ((Ray)(ref ray)).origin - v0; float num3 = num2 * Vector3.Dot(val4, val3); if (num3 < 0f || num3 > 1f) { return mint; } Vector3 val5 = Vector3.Cross(val4, val); float num4 = num2 * Vector3.Dot(((Ray)(ref ray)).direction, val5); if (num4 < 0f || num3 + num4 > 1f) { return mint; } float num5 = num2 * Vector3.Dot(val2, val5); if (num5 > kEpsilon && num5 < mint) { outNormal = Vector3.Normalize(Vector3.Cross(((Vector3)(ref val)).normalized, ((Vector3)(ref val2)).normalized)); return num5; } return mint; } private static float WorldSize(float screensize, Camera camera, Vector3 p) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!camera.orthographic) { Vector3 val = ((Component)camera).transform.InverseTransformPoint(p); float num = Mathf.Tan(camera.fieldOfView * ((float)Math.PI / 180f) * 0.5f) * val.z; return num * screensize / (float)camera.pixelHeight; } return camera.orthographicSize * screensize / (float)camera.pixelHeight; } private static float DistanceRayVsPoint(Ray mouseRay, Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) Vector3 val = pos - ((Ray)(ref mouseRay)).origin; return Mathf.Sqrt(Vector3.Dot(val, val) - Vector3.Dot(((Ray)(ref mouseRay)).direction, val) * Vector3.Dot(((Ray)(ref mouseRay)).direction, val)); } private static Vector3 IntersectPlane(Vector3 inNormal, Vector3 inPoint, Ray mouseRay) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_001b: 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_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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) Plane val = default(Plane); ((Plane)(ref val))..ctor(inNormal, inPoint); float distanceToPoint = ((Plane)(ref val)).GetDistanceToPoint(((Ray)(ref mouseRay)).origin); return ((Ray)(ref mouseRay)).origin + ((Ray)(ref mouseRay)).direction * (distanceToPoint / Vector3.Dot(-((Plane)(ref val)).normal, ((Ray)(ref mouseRay)).direction)); } } public List<Vector3> m_WalkablePoint = new List<Vector3>(); public float m_Height = 1f; public float m_Offset = 0f; public int m_MidLayerCount = 3; private List<GameObject> m_Child = new List<GameObject>(); private void Awake() { SetMeshVisible(visible: false); } private void Reset() { Undo.RecordObject((Object)(object)this, "Reset"); for (int i = 0; i < m_Child.Count; i++) { Undo.DestroyObjectImmediate((Object)(object)m_Child[i]); } m_Child.Clear(); } private void SetMeshVisible(bool visible) { for (int i = 0; i < m_Child.Count; i++) { m_Child[i].SetActive(visible); } } public bool HasMesh() { return (m_Child.Count != 0) ? true : false; } public bool MeshVisible() { if (m_Child.Count > 0) { return m_Child[0].activeSelf; } return false; } private void Build() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c->IL011c: Incompatible stack types: O vs I4 //IL_0106->IL011c: Incompatible stack types: I4 vs O //IL_0106->IL011c: Incompatible stack types: O vs I4 Mesh[] array = CreateMesh(); Undo.RegisterCreatedObjectUndo((Object)(object)this, "build"); for (int i = 0; i < array.Length || i == 0; i++) { GameObject val; if (i >= m_Child.Count) { val = new GameObject(); ((Object)val).name = ((Object)((Component)this).gameObject).name + "_Mesh(DontSave)"; val.AddComponent<MeshFilter>(); MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).sharedMaterial = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat"); val.transform.parent = ((Component)this).transform; val.transform.localScale = Vector3.one; val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; GameObjectUtility.SetStaticEditorFlags(val, (StaticEditorFlags)(GameObjectUtility.GetStaticEditorFlags(((Component)this).gameObject) | 8)); GameObjectUtility.SetNavMeshArea(val, 1); m_Child.Add(val); Undo.RegisterCreatedObjectUndo((Object)(object)val, ""); } else { val = m_Child[i].gameObject; } object obj = val; int num; if (i == 0) { num = 53; obj = num; num = (int)obj; } else { obj = ((Object)m_Child[0].gameObject).hideFlags; num = (int)obj; } ((Object)num).hideFlags = (HideFlags)obj; MeshFilter component = m_Child[i].GetComponent<MeshFilter>(); Undo.RecordObject((Object)(object)component, "MeshUpdate"); component.sharedMesh = ((array.Length != 0) ? array[i] : null); } while (m_Child.Count > array.Length) { Undo.DestroyObjectImmediate((Object)(object)m_Child[m_Child.Count - 1]); m_Child.RemoveAt(m_Child.Count - 1); } } private static int Find(Vector3[] vtx, int left, int right, Vector3 v, float key) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) int num = (left + right) / 2; if (num == left) { for (int i = left; i < vtx.Length && vtx[i].x <= key + 0.002f; i++) { if (Vector3.Magnitude(vtx[i] - v) <= 0.01f) { return i; } } return -1; } if (key <= vtx[num].x) { return Find(vtx, left, num, v, key); } return Find(vtx, num, right, v, key); } private static bool Find(Edge[] edge, int left, int right, int i1, int i2) { int num = (left + right) / 2; if (num == left) { for (int j = left; j < edge.Length && edge[j].i1 <= i1; j++) { if (edge[j].i1 == i1 && edge[j].i2 == i2) { return true; } } return false; } if (i1 <= edge[num].i1) { return Find(edge, left, num, i1, i2); } return Find(edge, num, right, i1, i2); } private Mesh[] CreateMesh() { //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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_072b: 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_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_0a2d: Unknown result type (might be due to invalid IL or missing references) //IL_0a32: Unknown result type (might be due to invalid IL or missing references) //IL_0a42: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a57: Unknown result type (might be due to invalid IL or missing references) //IL_0a5c: Unknown result type (might be due to invalid IL or missing references) //IL_0a5e: Unknown result type (might be due to invalid IL or missing references) //IL_0a63: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a78: Unknown result type (might be due to invalid IL or missing references) //IL_0a7a: Unknown result type (might be due to invalid IL or missing references) //IL_0a7f: Unknown result type (might be due to invalid IL or missing references) NavMeshTriangulation val = NavMesh.CalculateTriangulation(); Vector3[] vertices = val.vertices; List<Vector3> list = new List<Vector3>(); list.AddRange(vertices); list.Sort((Vector3 v1, Vector3 v2) => (v1.x == v2.x) ? ((v1.z != v2.z) ? ((!(v1.z < v2.z)) ? 1 : (-1)) : 0) : ((!(v1.x < v2.x)) ? 1 : (-1))); Vector3[] vtx = list.ToArray(); int[] array = new int[val.vertices.Length]; for (int i = 0; i < array.Length; i++) { array[i] = Find(vtx, 0, list.Count, vertices[i], vertices[i].x - 0.001f); if (i % 100 == 0) { EditorUtility.DisplayProgressBar($"Export Nav-Mesh (Phase #1/3) {i}/{array.Length}", "Weld Vertex", Mathf.InverseLerp(0f, (float)array.Length, (float)i)); } } int[] indices = val.indices; List<Tri> list2 = new List<Tri>(); for (int j = 0; j < indices.Length; j += 3) { list2.Add(new Tri(array[indices[j]], array[indices[j + 1]], array[indices[j + 2]])); } list2.Sort((Tri t1, Tri t2) => (t1.min != t2.min) ? ((t1.min >= t2.min) ? 1 : (-1)) : 0); int[] array2 = new int[(list2.Count + 127) / 128]; int[] array3 = new int[array2.Length]; int num = 0; int num2 = 0; while (num < list2.Count) { int num3 = list2[num].min; int num4 = list2[num].max; for (int k = 1; k < 128 && num + k < list2.Count; k++) { num3 = Mathf.Min(list2[num + k].min, num3); num4 = Mathf.Max(list2[num + k].max, num4); } array2[num2] = num3; array3[num2] = num4; num += 128; num2++; } int[] array4 = new int[indices.Length]; for (int l = 0; l < array4.Length; l += 3) { array4[l] = list2[l / 3].i1; array4[l + 1] = list2[l / 3].i2; array4[l + 2] = list2[l / 3].i3; } List<int> list3 = new List<int>(); List<int> list4 = new List<int>(); int[] array5 = new int[array4.Length / 3]; for (int m = 0; m < array4.Length; m += 3) { int num5 = -1; int num6 = Mathf.Max(new int[3] { array4[m], array4[m + 1], array4[m + 2] }); int num7 = Mathf.Min(new int[3] { array4[m], array4[m + 1], array4[m + 2] }); int num8 = 0; int num9 = 0; while (num8 < m) { if (array2[num9] <= num6 && array3[num9] >= num7) { for (int n = num8; n < m && n < num8 + 384 && list2[n / 3].min <= num6; n += 3) { if (list2[n / 3].max < num7 || list3[array5[n / 3]] == num5) { continue; } for (int num10 = 0; num10 < 3; num10++) { int num11 = array4[n + num10]; if (array4[m] != num11 && array4[m + 1] != num11 && array4[m + 2] != num11) { continue; } if (num5 == -1) { num5 = list3[array5[n / 3]]; array5[m / 3] = num5; break; } int num12 = list3[array5[n / 3]]; for (int num13 = 0; num13 < list3.Count; num13++) { if (list3[num13] == num12) { list3[num13] = num5; } } break; } } } num8 += 384; num9++; } if (num5 == -1) { num5 = list3.Count; array5[m / 3] = num5; list3.Add(num5); list4.Add(0); } if (m / 3 % 100 == 0) { EditorUtility.DisplayProgressBar("Collect (Phase #2/3)", "Classification Group", Mathf.InverseLerp(0f, (float)array4.Length, (float)m)); } } for (int num14 = 0; num14 < array4.Length; num14 += 3) { array5[num14 / 3] = list3[array5[num14 / 3]]; list4[array5[num14 / 3]]++; } List<Mesh> list5 = new List<Mesh>(); List<Vector3> list6 = new List<Vector3>(); List<int> list7 = new List<int>(); int[] array6 = new int[list.Count]; for (int num15 = 0; num15 < array6.Length; num15++) { array6[num15] = -1; } Vector3[] points = m_WalkablePoint.ToArray(); for (int num16 = 0; num16 < list4.Count; num16++) { if (list4[num16] == 0) { continue; } List<Vector3> list8 = new List<Vector3>(); List<int> list9 = new List<int>(); for (int num17 = 0; num17 < array4.Length; num17 += 3) { if (array5[num17 / 3] != num16) { continue; } for (int num18 = 0; num18 < 3; num18++) { int num19 = array4[num17 + num18]; if (array6[num19] == -1) { array6[num19] = list8.Count; list8.Add(((Component)this).transform.InverseTransformPoint(list[num19] + Vector3.up * m_Offset)); } } list9.Add(array6[array4[num17]]); list9.Add(array6[array4[num17 + 1]]); list9.Add(array6[array4[num17 + 2]]); } if (Contains(list8.ToArray(), list9.ToArray(), points)) { continue; } int num20 = 32768; if (list6.Count > num20 || list6.Count + list8.Count * (2 + m_MidLayerCount) >= 65536) { list5.Add(CreateMesh(list6.ToArray(), list7.ToArray())); list6.Clear(); list7.Clear(); } Vector3 val2 = ((Component)this).transform.InverseTransformVector(Vector3.up * m_Height); int count = list6.Count; int num21 = 2 + m_MidLayerCount; for (int num22 = 0; num22 < list8.Count; num22++) { for (int num23 = 0; num23 < num21; num23++) { list6.Add(list8[num22] + val2 * ((float)num23 / (float)(num21 - 1))); } } for (int num24 = 0; num24 < list9.Count; num24 += 3) { for (int num25 = 0; num25 < num21; num25++) { if (num25 == 0) { list7.AddRange(new int[3] { count + list9[num24] * num21 + num25, count + list9[num24 + 2] * num21 + num25, count + list9[num24 + 1] * num21 + num25 }); } else { list7.AddRange(new int[3] { count + list9[num24] * num21 + num25, count + list9[num24 + 1] * num21 + num25, count + list9[num24 + 2] * num21 + num25 }); } } } if (m_Height > 0f) { List<Edge> list10 = new List<Edge>(); for (int num26 = 0; num26 < list9.Count; num26 += 3) { list10.Add(new Edge(list9[num26], list9[num26 + 1])); list10.Add(new Edge(list9[num26 + 1], list9[num26 + 2])); list10.Add(new Edge(list9[num26 + 2], list9[num26])); } list10.Sort((Edge e1, Edge e2) => (e1.i1 != e2.i1) ? ((e1.i1 >= e2.i1) ? 1 : (-1)) : 0); Edge[] edge = list10.ToArray(); for (int num27 = 0; num27 < list9.Count; num27 += 3) { int num28 = 2; int num29 = 0; while (num29 < 3) { int num30 = list9[num27 + num28]; int num31 = list9[num27 + num29]; if (!Find(edge, 0, list10.Count, num31, num30)) { if (list6.Count + 4 >= 65536) { list5.Add(CreateMesh(list6.ToArray(), list7.ToArray())); list6.Clear(); list7.Clear(); } list7.AddRange(new int[6] { list6.Count, list6.Count + 1, list6.Count + 3, list6.Count, list6.Count + 3, list6.Count + 2 }); list6.AddRange((IEnumerable<Vector3>)(object)new Vector3[4] { list8[num30], list8[num31], list8[num30] + val2, list8[num31] + val2 }); } num28 = num29++; } if (num27 % 600 == 0) { EditorUtility.DisplayProgressBar("Collect (Phase #3/3)", "Create Mesh", Mathf.InverseLerp(0f, (float)(list4.Count * 100), (float)(num16 * 100 + num27 * 100 / (num27 - list9.Count)))); } } } EditorUtility.DisplayProgressBar("Collect (Phase #3/3)", "Create Mesh", Mathf.InverseLerp(0f, (float)list4.Count, (float)num16)); } if (list6.Count > 0) { list5.Add(CreateMesh(list6.ToArray(), list7.ToArray())); } EditorUtility.ClearProgressBar(); return list5.ToArray(); } private static Mesh CreateMesh(Vector3[] vtx, int[] indices) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Mesh val = new Mesh(); ((Object)val).hideFlags = (HideFlags)52; val.vertices = vtx; val.SetIndices(indices, (MeshTopology)0, 0); val.RecalculateNormals(); val.RecalculateBounds(); return val; } private static bool Contains(Vector3[] vtx, int[] indices, Vector3[] points) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) foreach (Vector3 p in points) { for (int j = 0; j < indices.Length; j += 3) { if (indices[j] != indices[j + 1] && indices[j] != indices[j + 2] && indices[j + 1] != indices[j + 2] && PointInTriangle(vtx[indices[j]], vtx[indices[j + 2]], vtx[indices[j + 1]], p)) { return true; } } } return false; } private static bool PointInTriangle(Vector3 v1, Vector3 v2, Vector3 v3, Vector3 p) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) Vector3 val = Vector3.Cross(v3 - v1, v2 - v1); if (Vector3.Dot(Vector3.Cross(p - v1, v2 - v1), val) > 0f && Vector3.Dot(Vector3.Cross(p - v2, v3 - v2), val) > 0f && Vector3.Dot(Vector3.Cross(p - v3, v1 - v3), val) > 0f) { return true; } return false; } } namespace SimpleLightProbePlacer { [RequireComponent(typeof(LightProbeGroup))] [AddComponentMenu("Rendering/Light Probe Group Control")] public class LightProbeGroupControl : MonoBehaviour { [SerializeField] private float m_mergeDistance = 0.5f; [SerializeField] private bool m_usePointLights = true; [SerializeField] private float m_pointLightRange = 1f; private int m_mergedProbes; private LightProbeGroup m_lightProbeGroup; public float MergeDistance { get { return m_mergeDistance; } set { m_mergeDistance = value; } } public int MergedProbes => m_mergedProbes; public bool UsePointLights { get { return m_usePointLights; } set { m_usePointLights = value; } } public float PointLightRange { get { return m_pointLightRange; } set { m_pointLightRange = value; } } public LightProbeGroup LightProbeGroup { get { if ((Object)(object)m_lightProbeGroup != (Object)null) { return m_lightProbeGroup; } return m_lightProbeGroup = ((Component)this).GetComponent<LightProbeGroup>(); } } public void DeleteAll() { LightProbeGroup.probePositions = null; m_mergedProbes = 0; } public void Create() { DeleteAll(); List<Vector3> list = CreatePositions(); list.AddRange(CreateAroundPointLights(m_pointLightRange)); list = MergeClosestPositions(list, m_mergeDistance, out m_mergedProbes); ApplyPositions(list); } public void Merge() { if (LightProbeGroup.probePositions != null) { List<Vector3> source = MergeClosestPositions(LightProbeGroup.probePositions.ToList(), m_mergeDistance, out m_mergedProbes); source = source.Select((Vector3 x) => ((Component)this).transform.TransformPoint(x)).ToList(); ApplyPositions(source); } } private void ApplyPositions(List<Vector3> positions) { LightProbeGroup.probePositions = positions.Select((Vector3 x) => ((Component)this).transform.InverseTransformPoint(x)).ToArray(); } private static List<Vector3> CreatePositions() { LightProbeVolume[] array = Object.FindObjectsOfType<LightProbeVolume>(); if (array.Length == 0) { return new List<Vector3>(); } List<Vector3> list = new List<Vector3>(); for (int i = 0; i < array.Length; i++) { list.AddRange(array[i].CreatePositions()); } return list; } private static List<Vector3> CreateAroundPointLights(float range) { List<Light> list = (from x in Object.FindObjectsOfType<Light>() where (int)x.type == 2 select x).ToList(); if (list.Count == 0) { return new List<Vector3>(); } List<Vector3> list2 = new List<Vector3>(); for (int i = 0; i < list.Count; i++) { list2.AddRange(CreatePositionsAround(((Component)list[i]).transform, range)); } return list2; } private static List<Vector3> MergeClosestPositions(List<Vector3> positions, float distance, out int mergedCount) { //IL_00a2: 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_0127: 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_0153: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) if (positions == null) { mergedCount = 0; return new List<Vector3>(); } int count = positions.Count; bool flag = false; while (!flag) { Dictionary<Vector3, List<Vector3>> dictionary = new Dictionary<Vector3, List<Vector3>>(); for (int i = 0; i < positions.Count; i++) { List<Vector3> list = positions.Where(delegate(Vector3 x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val2 = x - positions[i]; return ((Vector3)(ref val2)).magnitude < distance; }).ToList(); if (list.Count > 0 && !dictionary.ContainsKey(positions[i])) { dictionary.Add(positions[i], list); } } positions.Clear(); List<Vector3> list2 = dictionary.Keys.ToList(); for (int j = 0; j < list2.Count; j++) { Vector3 center = dictionary[list2[j]].Aggregate(Vector3.zero, (Vector3 result, Vector3 target) => result + target) / (float)dictionary[list2[j]].Count; if (!positions.Exists((Vector3 x) => x == center)) { positions.Add(center); } } flag = positions.Select((Vector3 x) => positions.Where(delegate(Vector3 y) { //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_0011: 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_0018: 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) int result2; if (y != x) { Vector3 val = y - x; result2 = ((((Vector3)(ref val)).magnitude < distance) ? 1 : 0); } else { result2 = 0; } return (byte)result2 != 0; })).All((IEnumerable<Vector3> x) => !x.Any()); } mergedCount = count - positions.Count; return positions; } public static List<Vector3> CreatePositionsAround(Transform transform, float range) { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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) Vector3[] source = (Vector3[])(object)new Vector3[8] { new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, -0.5f) }; return source.Select((Vector3 x) => transform.TransformPoint(x * range)).ToList(); } } public enum LightProbeVolumeType { Fixed, Float } [AddComponentMenu("Rendering/Light Probe Volume")] public class LightProbeVolume : TransformVolume { [SerializeField] private LightProbeVolumeType m_type = LightProbeVolumeType.Fixed; [SerializeField] private Vector3 m_densityFixed = Vector3.one; [SerializeField] private Vector3 m_densityFloat = Vector3.one; public LightProbeVolumeType Type { get { return m_type; } set { m_type = value; } } public Vector3 Density { get { //IL_0018: 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_001d: 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) return (m_type != 0) ? m_densityFloat : m_densityFixed; } set { //IL_0019: 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_000d: 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) if (m_type == LightProbeVolumeType.Fixed) { m_densityFixed = value; } else { m_densityFloat = value; } } } public static Color EditorColor => new Color(1f, 0.9f, 0.25f); public List<Vector3> CreatePositions() { return CreatePositions(m_type); } public List<Vector3> CreatePositions(LightProbeVolumeType type) { //IL_0030: 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_003c: 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_0014: 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) return (type != 0) ? CreatePositionsFloat(((Component)this).transform, base.Origin, base.Size, Density) : CreatePositionsFixed(((Component)this).transform, base.Origin, base.Size, Density); } public static List<Vector3> CreatePositionsFixed(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a1: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); Vector3 val = origin; float num = size.x / (float)Mathf.FloorToInt(density.x); float num2 = size.y / (float)Mathf.FloorToInt(density.y); float num3 = size.z / (float)Mathf.FloorToInt(density.z); val -= size * 0.5f; for (int i = 0; (float)i <= density.x; i++) { for (int j = 0; (float)j <= density.y; j++) { for (int k = 0; (float)k <= density.z; k++) { Vector3 val2 = val + new Vector3((float)i * num, (float)j * num2, (float)k * num3); val2 = volumeTransform.TransformPoint(val2); list.Add(val2); } } } return list; } public static List<Vector3> CreatePositionsFloat(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0122: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); Vector3 val = origin; int num = Mathf.FloorToInt(size.x / density.x); int num2 = Mathf.FloorToInt(size.y / density.y); int num3 = Mathf.FloorToInt(size.z / density.z); val -= size * 0.5f; val.x += (size.x - (float)num * density.x) * 0.5f; val.y += (size.y - (float)num2 * density.y) * 0.5f; val.z += (size.z - (float)num3 * density.z) * 0.5f; for (int i = 0; i <= num; i++) { for (int j = 0; j <= num2; j++) { for (int k = 0; k <= num3; k++) { Vector3 val2 = val + new Vector3((float)i * density.x, (float)j * density.y, (float)k * density.z); val2 = volumeTransform.TransformPoint(val2); list.Add(val2); } } } return list; } } [AddComponentMenu("")] public class TransformVolume : MonoBehaviour { [SerializeField] private Volume m_volume = new Volume(Vector3.zero, Vector3.one); public Volume Volume { get { return m_volume; } set { m_volume = value; } } public Vector3 Origin => m_volume.Origin; public Vector3 Size => m_volume.Size; public bool IsInBounds(Vector3[] points) { //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) Bounds bounds = GetBounds(); return ((Bounds)(ref bounds)).Intersects(GetBounds(points)); } public bool IsOnBorder(Vector3[] points) { if (points.All((Vector3 x) => !IsInVolume(x))) { return false; } return !points.All(IsInVolume); } public bool IsInVolume(Vector3[] points) { return points.All(IsInVolume); } public bool IsInVolume(Vector3 position) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) Plane val = default(Plane); for (int i = 0; i < 6; i++) { ((Plane)(ref val))..ctor(GetSideDirection(i), GetSidePosition(i)); if (((Plane)(ref val)).GetSide(position)) { return false; } } return true; } public Vector3[] GetCorners() { //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_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_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, -0.5f) }; for (int i = 0; i < array.Length; i++) { ref Vector3 reference = ref array[i]; reference.x *= m_volume.Size.x; ref Vector3 reference2 = ref array[i]; reference2.y *= m_volume.Size.y; ref Vector3 reference3 = ref array[i]; reference3.z *= m_volume.Size.z; ref Vector3 reference4 = ref array[i]; reference4 = ((Component)this).transform.TransformPoint(m_volume.Origin + array[i]); } return array; } public Bounds GetBounds() { //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_0013: Unknown result type (might be due to invalid IL or missing references) return GetBounds(GetCorners()); } public Bounds GetBounds(Vector3[] points) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0051: 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_006a: 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) Vector3 val = points.Aggregate(Vector3.zero, (Vector3 result, Vector3 point) => result + point) / (float)points.Length; Bounds result2 = default(Bounds); ((Bounds)(ref result2))..ctor(val, Vector3.zero); for (int i = 0; i < points.Length; i++) { ((Bounds)(ref result2)).Encapsulate(points[i]); } return result2; } public GameObject[] GetGameObjectsInBounds(LayerMask layerMask) { //IL_000e: 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_007f: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] array = Object.FindObjectsOfType<MeshRenderer>(); List<GameObject> list = new List<GameObject>(); Bounds bounds = GetBounds(); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)((Component)array[i]).gameObject == (Object)(object)((Component)((Component)this).transform).gameObject) && !((Object)(object)((Component)array[i]).GetComponent<TransformVolume>() != (Object)null) && ((1 << ((Component)array[i]).gameObject.layer) & ((LayerMask)(ref layerMask)).value) != 0 && ((Bounds)(ref bounds)).Intersects(((Renderer)array[i]).bounds)) { list.Add(((Component)array[i]).gameObject); } } return list.ToArray(); } public Vector3 GetSideDirection(int side) { //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_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_0034: 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_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[6]; Vector3 right = Vector3.right; Vector3 up = Vector3.up; Vector3 forward = Vector3.forward; array[0] = right; ref Vector3 reference = ref array[1]; reference = -right; array[2] = up; ref Vector3 reference2 = ref array[3]; reference2 = -up; array[4] = forward; ref Vector3 reference3 = ref array[5]; reference3 = -forward; return ((Component)this).transform.TransformDirection(array[side]); } public Vector3 GetSidePosition(int side) { //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_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_0034: 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_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[6]; Vector3 right = Vector3.right; Vector3 up = Vector3.up; Vector3 forward = Vector3.forward; array[0] = right; ref Vector3 reference = ref array[1]; reference = -right; array[2] = up; ref Vector3 reference2 = ref array[3]; reference2 = -up; array[4] = forward; ref Vector3 reference3 = ref array[5]; reference3 = -forward; return ((Component)this).transform.TransformPoint(array[side] * GetSizeAxis(side) + m_volume.Origin); } public float GetSizeAxis(int side) { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) switch (side) { case 0: case 1: return m_volume.Size.x * 0.5f; case 2: case 3: return m_volume.Size.y * 0.5f; default: return m_volume.Size.z * 0.5f; } } public static Volume EditorVolumeControl(TransformVolume transformVolume, float handleSize, Color color) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_009e: 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_0076: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0102: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_01b6: 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_018e: Expected O, but got Unknown //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_01f2: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: 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_026c: 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_027d: 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_0291: 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_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: 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_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035a: 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_01d4: Expected O, but got Unknown Vector3[] array = (Vector3[])(object)new Vector3[6]; Transform transform = ((Component)transformVolume).transform; Handles.color = color; for (int i = 0; i < array.Length; i++) { ref Vector3 reference = ref array[i]; reference = transformVolume.GetSidePosition(i); } ref Vector3 reference2 = ref array[0]; reference2 = Handles.Slider(array[0], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference3 = ref array[1]; reference3 = Handles.Slider(array[1], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference4 = ref array[2]; reference4 = Handles.Slider(array[2], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference5 = ref array[3]; reference5 = Handles.Slider(array[3], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference6 = ref array[4]; reference6 = Handles.Slider(array[4], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference7 = ref array[5]; reference7 = Handles.Slider(array[5], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f); Vector3 origin = default(Vector3); origin.x = transform.InverseTransformPoint((array[0] + array[1]) * 0.5f).x; origin.y = transform.InverseTransformPoint((array[2] + array[3]) * 0.5f).y; origin.z = transform.InverseTransformPoint((array[4] + array[5]) * 0.5f).z; Vector3 size = default(Vector3); size.x = transform.InverseTransformPoint(array[0]).x - transform.InverseTransformPoint(array[1]).x; size.y = transform.InverseTransformPoint(array[2]).y - transform.InverseTransformPoint(array[3]).y; size.z = transform.InverseTransformPoint(array[4]).z - transform.InverseTransformPoint(array[5]).z; return new Volume(origin, size); } } [Serializable] public struct Volume { [SerializeField] private Vector3 m_origin; [SerializeField] private Vector3 m_size; public Vector3 Origin => m_origin; public Vector3 Size => m_size; public Volume(Vector3 origin, Vector3 size) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_000a: Unknown result type (might be due to invalid IL or missing references) m_origin = origin; m_size = size; } public static bool operator ==(Volume left, Volume right) { return left.Equals(right); } public static bool operator !=(Volume left, Volume right) { return !left.Equals(right); } public bool Equals(Volume other) { //IL_0002: 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_0019: 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) return Origin == other.Origin && Size == other.Size; } public override bool Equals(object obj) { if (object.ReferenceEquals(null, obj)) { return false; } return obj is Volume && Equals((Volume)obj); } public override int GetHashCode() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 origin = Origin; int num = ((object)(Vector3)(ref origin)).GetHashCode() * 397; Vector3 size = Size; return num ^ ((object)(Vector3)(ref size)).GetHashCode(); } public override string ToString() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) return $"Origin: {Origin}, Size: {Size}"; } } } namespace nrgill28.AtlasSampleScene { public class CTF_CaptureZone : MonoBehaviour { public CTF_Manager Manager; public CTF_Team Team; public void OnTriggerEnter(Collider other) { CTF_Flag component = ((Component)other).GetComponent<CTF_Flag>(); if (Object.op_Implicit((Object)(object)component) && component.Team != Team) { Manager.FlagCaptured(component); } } } public class CTF_Flag : FVRPhysicalObject { [Header("Flag stuffs")] public CTF_Team Team; public float RespawnDelay = 10f; public Vector3 FloorOffset = new Vector3(0f, 0.25f, 0f); private Vector3 _resetPosition; private Quaternion _resetRotation; private Transform _followTransform; private bool _isHeld; private bool _isTaken; private float _timer; private CTF_Sosig _heldBy; public override void Awake() { //IL_000e: 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_0024: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).Awake(); _resetPosition = ((Component)this).transform.position; _resetRotation = ((Component)this).transform.rotation; } private void Update() { if (_isTaken && !_isHeld) { _timer -= Time.deltaTime; if (_timer < 0f) { ReturnFlag(); } } } public void Take() { _isHeld = true; _isTaken = true; } public void Drop() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).IsHeld = false; _timer = RespawnDelay; NavMeshHit val = default(NavMeshHit); NavMesh.SamplePosition(((Component)this).transform.position, ref val, 100f, -1); ((Component)this).transform.position = ((NavMeshHit)(ref val)).position + FloorOffset; ((Component)this).transform.rotation = Quaternion.identity; } public void ReturnFlag() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (((FVRInteractiveObject)this).IsHeld) { ((FVRInteractiveObject)this).ForceBreakInteraction(); } if (Object.op_Implicit((Object)(object)_heldBy)) { _heldBy.HeldFlag = null; } ((Component)this).transform.SetPositionAndRotation(_resetPosition, _resetRotation); _isTaken = false; } private void OnTriggerEnter(Collider other) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (_isHeld) { return; } CTF_Sosig componentInParent = ((Component)other).GetComponentInParent<CTF_Sosig>(); if (Object.op_Implicit((Object)(object)componentInParent) && (int)componentInParent.Sosig.BodyState == 0) { if (componentInParent.Team == Team) { ReturnFlag(); return; } _heldBy = componentInParent; componentInParent.HeldFlag = this; Take(); } } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); Take(); } public override void EndInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).EndInteraction(hand); Drop(); } } public class CTF_Manager : MonoBehaviour { [Header("References")] public Text[] ScoreTexts; public Transform[] AttackPoints; public Text StartButtonText; [Header("Red Team")] public CTF_Flag RedFlag; public int RedTeamSize; public Transform[] RedSpawns; public SosigEnemyID[] RedTeam; [Header("Blue Team")] public CTF_Flag BlueFlag; public int BlueTeamSize; public Transform[] BlueSpawns; public SosigEnemyID[] BlueTeam; private int _blueScore; private int _redScore; private bool _running; private readonly List<CTF_Sosig> _sosigs = new List<CTF_Sosig>(); private readonly SpawnOptions _spawnOptions; public CTF_Manager() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown SpawnOptions val = new SpawnOptions(); val.SpawnState = (SosigOrder)7; val.SpawnActivated = true; val.EquipmentMode = (EquipmentSlots)7; val.SpawnWithFullAmmo = true; _spawnOptions = val; ((MonoBehaviour)this)..ctor(); } private void Start() { UpdateScoreText(); } public void ToggleGame() { if (_running) { EndGame(); StartButtonText.text = "Start Game"; } else { StartGame(); StartButtonText.text = "Stop Game"; } } private void StartGame() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown ResetGame(); _running = true; GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(CurrentSceneSettingsOnSosigKillEvent); ((MonoBehaviour)this).StartCoroutine(DoInitialSpawns()); } private void EndGame() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown GM.CurrentSceneSettings.SosigKillEvent -= new SosigKill(CurrentSceneSettingsOnSosigKillEvent); foreach (CTF_Sosig sosig in _sosigs) { sosig.Sosig.ClearSosig(); } _running = false; } private void CurrentSceneSettingsOnSosigKillEvent(Sosig s) { CTF_Sosig cTF_Sosig = _sosigs.FirstOrDefault((CTF_Sosig x) => (Object)(object)x.Sosig == (Object)(object)s); if (Object.op_Implicit((Object)(object)cTF_Sosig)) { ((MonoBehaviour)this).StartCoroutine(RespawnSosig(cTF_Sosig)); } } private void SpawnSosig(CTF_Team team) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_008e: Unknown result type (might be due to invalid IL or missing references) _spawnOptions.IFF = (int)team; _spawnOptions.SosigTargetPosition = SodaliteUtils.GetRandom<Transform>((IList<Transform>)AttackPoints).position; Transform transform; SosigEnemyID random; if (team == CTF_Team.Red) { transform = ((Component)SodaliteUtils.GetRandom<Transform>((IList<Transform>)RedSpawns)).transform; random = SodaliteUtils.GetRandom<SosigEnemyID>((IList<SosigEnemyID>)RedTeam); } else { transform = ((Component)SodaliteUtils.GetRandom<Transform>((IList<Transform>)BlueSpawns)).transform; random = SodaliteUtils.GetRandom<SosigEnemyID>((IList<SosigEnemyID>)BlueTeam); } Sosig val = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[random], _spawnOptions, transform.position, transform.rotation); CTF_Sosig cTF_Sosig = ((Component)val).gameObject.AddComponent<CTF_Sosig>(); _sosigs.Add(cTF_Sosig); cTF_Sosig.Sosig = val; cTF_Sosig.Team = team; } private IEnumerator DoInitialSpawns() { int i = 0; while (i < Mathf.Max(RedTeamSize, BlueTeamSize)) { if (i < RedTeamSize) { SpawnSosig(CTF_Team.Red); } if (i < BlueTeamSize) { SpawnSosig(CTF_Team.Blue); } i++; yield return (object)new WaitForSeconds(2.5f); } } private IEnumerator RespawnSosig(CTF_Sosig sosig) { yield return (object)new WaitForSeconds(5f); sosig.Sosig.ClearSosig(); _sosigs.Remove(sosig); yield return (object)new WaitForSeconds(5f); if (_running) { int sosigsLeft = _sosigs.Count((CTF_Sosig x) => x.Team == sosig.Team); int teamSize = ((sosig.Team != 0) ? BlueTeamSize : RedTeamSize); if (sosigsLeft < teamSize) { SpawnSosig(sosig.Team); } } } public void ResetGame() { _blueScore = 0; _redScore = 0; UpdateScoreText(); if (Object.op_Implicit((Object)(object)RedFlag)) { RedFlag.ReturnFlag(); } if (Object.op_Implicit((Object)(object)BlueFlag)) { BlueFlag.ReturnFlag(); } } public void FlagCaptured(CTF_Flag flag) { if (flag.Team == CTF_Team.Red) { _blueScore++; } else { _redScore++; } UpdateScoreText(); flag.ReturnFlag(); } public void UpdateScoreText() { Text[] scoreTexts = ScoreTexts; foreach (Text val in scoreTexts) { val.text = "<color=red>" + _redScore + "</color> - <color=blue>" + _blueScore + "</color>"; } } private void OnDrawGizmos() { //IL_0001: 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_003b: 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_007d: 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) Gizmos.color = Color.red; Transform[] redSpawns = RedSpawns; foreach (Transform val in redSpawns) { Gizmos.DrawSphere(val.position, 0.15f); } Gizmos.color = Color.blue; Transform[] blueSpawns = BlueSpawns; foreach (Transform val2 in blueSpawns) { Gizmos.DrawSphere(val2.position, 0.15f); } Gizmos.color = Color.green; Transform[] attackPoints = AttackPoints; foreach (Transform val3 in attackPoints) { Gizmos.DrawSphere(val3.position, 0.15f); } } } public class CTF_Sosig : MonoBehaviour { public CTF_Team Team; public CTF_Flag HeldFlag; public Sosig Sosig; private void Awake() { Sosig = ((Component)this).GetComponent<Sosig>(); } private void Update() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: 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) if (Object.op_Implicit((Object)(object)HeldFlag)) { Vector3 val = ((Component)Sosig).transform.position - ((Component)Sosig).transform.forward * 0.1f; ((Component)HeldFlag).transform.SetPositionAndRotation(val, ((Component)Sosig).transform.rotation); } } } public enum CTF_Team { Red, Blue } public class PopupTarget : MonoBehaviour, IFVRDamageable { [Flags] public enum TargetRange { Near = 1, Mid = 2, Far = 4, All = 7 } public PopupTargetManager Manager; public TargetRange Range; public Transform Pivot; public Vector3 SetRotation; private Quaternion _startRotation; private Quaternion _endRotation; private bool _set; public bool Set { get { return _set; } set { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (_set != value) { _set = value; ((MonoBehaviour)this).StartCoroutine((!_set) ? RotateTo(_endRotation, _startRotation) : RotateTo(_startRotation, _endRotation)); } } } private void Awake() { //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_0014: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) _startRotation = Pivot.rotation; _endRotation = Quaternion.Euler(SetRotation + ((Quaternion)(ref _startRotation)).eulerAngles); } void IFVRDamageable.Damage(Damage dam) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 if (Set && (int)dam.Class == 1) { Set = false; Manager.TargetHit(this); } } private IEnumerator RotateTo(Quaternion from, Quaternion to) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) float elapsed = 0f; while (elapsed < 0.25f) { yield return null; elapsed += Time.deltaTime; Pivot.localRotation = Quaternion.Slerp(from, to, elapsed / 0.25f); } Pivot.rotation = to; } } public class PopupTargetManager : MonoBehaviour { public List<PopupTarget> Targets; private readonly List<PopupTarget> _setTargets = new List<PopupTarget>(); private void Awake() { ((MonoBehaviour)this).StartCoroutine(StartSetAsync(3f, 8f, 5, PopupTarget.TargetRange.All)); } private IEnumerator StartSetAsync(float minDelay, float maxDelay, int numTargets, PopupTarget.TargetRange ranges) { yield return (object)new WaitForSeconds(Random.Range(minDelay, maxDelay)); IListExtensions.Shuffle<PopupTarget>((IList<PopupTarget>)Targets); _setTargets.Clear(); foreach (PopupTarget target in Targets) { if ((target.Range & ranges) != 0) { target.Set = true; _setTargets.Add(target); numTargets--; } if (numTargets == 0) { break; } } } public void TargetHit(PopupTarget target) { if (_setTargets.Contains(target)) { _setTargets.Remove(target); if (_setTargets.Count == 0) { ((MonoBehaviour)this).StartCoroutine(StartSetAsync(3f, 8f, 5, PopupTarget.TargetRange.All)); } } } } } namespace Packer { [ExecuteInEditMode] public class GameObjectReplacer : MonoBehaviour { public enum ReplaceModeEnum { ReplaceAndDestroy, HideAndKeepOld } public ReplaceModeEnum mode = ReplaceModeEnum.ReplaceAndDestroy; public GameObject prefab; public GameObject[] replaceGameObjects; public void ReplaceGameObjects() { //IL_0055: 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) if ((Object)(object)prefab == (Object)null) { Debug.LogError((object)"GAMEOBJECT REPLACER IS MISSING A PREFAB"); return; } for (int i = 0; i < replaceGameObjects.Length; i++) { if (!((Object)(object)replaceGameObjects[i] == (Object)null)) { GameObject val = Object.Instantiate<GameObject>(prefab, replaceGameObjects[i].transform.position, replaceGameObjects[i].transform.rotation, replaceGameObjects[i].transform.parent); switch (mode) { case ReplaceModeEnum.ReplaceAndDestroy: val.SetActive(replaceGameObjects[i].activeSelf); Object.DestroyImmediate((Object)(object)replaceGameObjects[i]); break; case ReplaceModeEnum.HideAndKeepOld: replaceGameObjects[i].SetActive(false); break; } } } replaceGameObjects = (GameObject[])(object)new GameObject[0]; } } } namespace Technie.PhysicsCreator { public class AxisAlignedBoxFitter { public void Fit(Hull hull, Vector3[] meshVertices, int[] meshIndices) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Vector3[] selectedVertices = FaceAlignmentBoxFitter.GetSelectedVertices(hull, meshVertices, meshIndices); ConstructionPlane plane = new ConstructionPlane(Vector3.zero, Vector3.up, Vector3.right); RotatedBox computedBox = RotatedBoxFitter.FindTightestBox(plane, selectedVertices); RotatedBoxFitter.ApplyToHull(computedBox, hull); } } public class Pose { public Vector3 forward; public Vector3 up; public Vector3 right; } public class Triangle { public Vector3 normal; public float area; public Vector3 center; public Triangle(Vector3 p0, Vector3 p1, Vector3 p2) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_000f: 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_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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_003a: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) Vector3 val = p1 - p0; Vector3 val2 = p2 - p0; Vector3 val3 = Vector3.Cross(val, val2); area = ((Vector3)(ref val3)).magnitude * 0.5f; normal = ((Vector3)(ref val3)).normalized; center = (p0 + p1 + p2) / 3f; } } public class TriangleBucket { private List<Triangle> triangles; private Vector3 averagedNormal;