aboutsummaryrefslogtreecommitdiff
path: root/JamHelper/Assets/JamUtils/Scripts/Utils
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-07-02 18:23:46 +0800
committerchai <chaifix@163.com>2022-07-02 18:23:46 +0800
commitf0f1d830651f3737030e258dc86b42a37baa1bca (patch)
tree386946c608ec02094c81253872e890615e0c3807 /JamHelper/Assets/JamUtils/Scripts/Utils
parente7e9156b0e4d180f8f9e291eb5ccfb08847e6269 (diff)
* change directory
Diffstat (limited to 'JamHelper/Assets/JamUtils/Scripts/Utils')
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs59
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs72
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/CustomExecutionOrder.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs42
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs21
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta11
9 files changed, 0 insertions, 246 deletions
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<Vector3> s_Vertices = new List<Vector3>();
-
- private static readonly List<int> s_Triangles = new List<int>();
-
- 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<CustomExecutionOrder>();
- }
- 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<MeshRenderer>();
- 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: