From f0f1d830651f3737030e258dc86b42a37baa1bca Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 2 Jul 2022 18:23:46 +0800 Subject: * change directory --- .../JamUtils/Scripts/Utils/ColliderUtility.cs | 59 ------------------ .../JamUtils/Scripts/Utils/ColliderUtility.cs.meta | 11 ---- .../JamUtils/Scripts/Utils/CustomExecutionOrder.cs | 72 ---------------------- .../Scripts/Utils/CustomExecutionOrder.cs.meta | 11 ---- .../Assets/JamUtils/Scripts/Utils/Editor.meta | 8 --- .../Assets/JamUtils/Scripts/Utils/GizmosHandle.cs | 42 ------------- .../JamUtils/Scripts/Utils/GizmosHandle.cs.meta | 11 ---- .../Scripts/Utils/MeshRendererOrderModifier.cs | 21 ------- .../Utils/MeshRendererOrderModifier.cs.meta | 11 ---- 9 files changed, 246 deletions(-) delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs.meta delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs delete mode 100644 JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta (limited to 'JamHelper/Assets/JamUtils/Scripts/Utils') diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs b/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs deleted file mode 100644 index 8c8225c..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace JamUtils -{ - - public static class ColliderUtility - { - private static readonly List s_Vertices = new List(); - - private static readonly List s_Triangles = new List(); - - private static Plane GetWorldTriangle(Transform collider, int index) - { - Vector3 position = ColliderUtility.s_Vertices[ColliderUtility.s_Triangles[3 * index]]; - Vector3 position2 = ColliderUtility.s_Vertices[ColliderUtility.s_Triangles[3 * index + 1]]; - Vector3 position3 = ColliderUtility.s_Vertices[ColliderUtility.s_Triangles[3 * index + 2]]; - return new Plane(collider.TransformPoint(position), collider.TransformPoint(position2), collider.TransformPoint(position3)); - } - - public static Vector3 FindClosestPoint(Collider collider, Vector3 position) - { - return ColliderUtility.FindClosestPoint(collider, position, false); - } - - public static Vector3 FindClosestPoint(Collider collider, Vector3 position, bool ignoreVerticalTriangles) - { - MeshCollider meshCollider; - if ((meshCollider = (collider as MeshCollider)) != null && !meshCollider.convex) - { - Mesh sharedMesh = meshCollider.sharedMesh; - sharedMesh.GetVertices(ColliderUtility.s_Vertices); - Plane plane = default(Plane); - float num = float.PositiveInfinity; - for (int i = 0; i < sharedMesh.subMeshCount; i++) - { - sharedMesh.GetTriangles(ColliderUtility.s_Triangles, i); - int j = 0; - int num2 = ColliderUtility.s_Triangles.Count / 3; - while (j < num2) - { - Plane worldTriangle = ColliderUtility.GetWorldTriangle(meshCollider.transform, j); - float num3 = Mathf.Abs(worldTriangle.GetDistanceToPoint(position)); - if ((!ignoreVerticalTriangles || (!(worldTriangle.normal == Vector3.up) && !(worldTriangle.normal == Vector3.down))) && ((i == 0 && j == 0) || num3 < num)) - { - plane = worldTriangle; - num = num3; - } - j++; - } - } - return plane.ClosestPointOnPlane(position); - } - return collider.ClosestPoint(position); - } - } - -} diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta deleted file mode 100644 index 4d828ca..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 17d16ee713041694bb7486e050909dd8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs b/JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs deleted file mode 100644 index acef40f..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace JamUtils -{ - [DefaultExecutionOrder(ORDER_EXECUTION)] - public class CustomExecutionOrder : MonoBehaviour - { - private const int ORDER_EXECUTION = -98; - - static CustomExecutionOrder _instance; - - public static CustomExecutionOrder Instance - { - get - { - if (_instance == null) - { - GameObject inst = new GameObject("CustomExecutionOrder"); - inst.hideFlags = HideFlags.DontSave; - DontDestroyOnLoad(inst); - - _instance = inst.AddComponent(); - } - return _instance; - } - } - - public event Action beforeFixedUpdate; - public event Action afterFixedUpdate; - - public event Action beforeUpdate; - public event Action afterUpdate; - - private void Awake() - { - StartCoroutine(WaitForEndOfFrame()); - StartCoroutine(WaitForFixedUpdate()); - } - - private IEnumerator WaitForEndOfFrame() - { - while (true) - { - yield return new WaitForEndOfFrame(); - if (afterUpdate != null) - afterUpdate(); - if (beforeFixedUpdate != null) - beforeFixedUpdate(); - } - } - - private IEnumerator WaitForFixedUpdate() - { - while (true) - { - yield return new WaitForFixedUpdate(); - if (afterFixedUpdate != null) - afterFixedUpdate(); - } - } - - private void Update() - { - if (beforeUpdate != null) - beforeUpdate(); - } - - } -} \ No newline at end of file diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs.meta deleted file mode 100644 index a8e4dfc..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fbaff1c60f455164fbaf0b027c216022 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: -98 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta deleted file mode 100644 index 292ca3d..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f0d601d32de9dd74aa29e699ca3bb0ba -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs b/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs deleted file mode 100644 index 1c4c205..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace JamUtils -{ - - public class GizmosHandle : MonoBehaviour - { - public Action onDrawGizmos; - - private static GizmosHandle m_Instance; - - public static GizmosHandle Instance - { - get - { - return m_Instance; - } - } - - public void DoGizmos(Action doGizmos) - { - onDrawGizmos += doGizmos; - } - - private void Awake() - { - m_Instance = this; - } - - private void OnDrawGizmos() - { - if (onDrawGizmos != null) - onDrawGizmos(); - onDrawGizmos = null; - } - - } - -} diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta deleted file mode 100644 index 43d7e19..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8790b951567cc8942a748fde536a3fe0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs b/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs deleted file mode 100644 index 40fe5bd..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class MeshRendererOrderModifier : MonoBehaviour -{ - [SerializeField] private string m_RenderLayer; - [SerializeField] private int m_RenderOrder; - - private MeshRenderer m_MeshRenderer; - - void Start() - { - m_MeshRenderer = GetComponent(); - if(m_MeshRenderer != null) - { - m_MeshRenderer.sortingLayerID = SortingLayer.NameToID(m_RenderLayer); - m_MeshRenderer.sortingOrder = m_RenderOrder; - } - } -} diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta deleted file mode 100644 index 18fab3b..0000000 --- a/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bbbbac06de34c484daaf3d065f8fe527 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: -- cgit v1.1-26-g67d0