mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-09-17 17:34:35 +08:00
Compare commits
4 Commits
4b709366d9
...
e470b229bc
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e470b229bc | ||
![]() |
b6ef1b984b | ||
![]() |
aefcdc69ab | ||
![]() |
9e966edb31 |
@ -64,11 +64,15 @@ DebugX.Draw(duration, color).*Gizmo Function*(...);
|
|||||||
# Установка
|
# Установка
|
||||||
Семантика версионирования - [Открыть](https://gist.github.com/DCFApixels/e53281d4628b19fe5278f3e77a7da9e8#file-dcfapixels_versioning_ru-md)
|
Семантика версионирования - [Открыть](https://gist.github.com/DCFApixels/e53281d4628b19fe5278f3e77a7da9e8#file-dcfapixels_versioning_ru-md)
|
||||||
### Unity-Package
|
### Unity-Package
|
||||||
Поддерживается установка в виде Unity-модуля, достаточно скопировать Git-URL [в PackageManager](https://docs.unity3d.com/2023.2/Documentation/Manual/upm-ui-giturl.html) или в `Packages/manifest.json`. Скопируйте этот Git-URL для установки актуальной рабочей версии:
|
Поддерживается установка в виде Unity-модуля, достаточно добавить [в PackageManager](https://docs.unity3d.com/2023.2/Documentation/Manual/upm-ui-giturl.html) этот Git-URL :
|
||||||
```
|
```
|
||||||
https://github.com/DCFApixels/Unity-DebugX.git
|
https://github.com/DCFApixels/Unity-DebugX.git
|
||||||
```
|
```
|
||||||
### 作为源代码
|
Или скопировать в `Packages/manifest.json` эту строчку:
|
||||||
|
```
|
||||||
|
"com.dcfa_pixels.debugx": "https://github.com/DCFApixels/Unity-DebugX.git"
|
||||||
|
```
|
||||||
|
### В виде исходников
|
||||||
Пакет так же может быть напрямую скопирован в папку проекта.
|
Пакет так же может быть напрямую скопирован в папку проекта.
|
||||||
|
|
||||||
</br>
|
</br>
|
||||||
|
@ -63,10 +63,15 @@ DebugX.Draw(duration, color).*Gizmo Function*(...);
|
|||||||
# Installation
|
# Installation
|
||||||
Versioning semantics - [Открыть](https://gist.github.com/DCFApixels/e53281d4628b19fe5278f3e77a7da9e8#file-dcfapixels_versioning_ru-md)
|
Versioning semantics - [Открыть](https://gist.github.com/DCFApixels/e53281d4628b19fe5278f3e77a7da9e8#file-dcfapixels_versioning_ru-md)
|
||||||
### Unity-Package
|
### Unity-Package
|
||||||
Supports installation as a Unity module. Copy the Git-URL [into PackageManager](https://docs.unity3d.com/2023.2/Documentation/Manual/upm-ui-giturl.html) or into `Packages/manifest.json`. Copy this Git-URL to install the latest working version:
|
Supports installation as a Unity module. Copy the Git-URL [into PackageManager](https://docs.unity3d.com/2023.2/Documentation/Manual/upm-ui-giturl.html):
|
||||||
```
|
```
|
||||||
https://github.com/DCFApixels/Unity-DebugX.git
|
https://github.com/DCFApixels/Unity-DebugX.git
|
||||||
```
|
```
|
||||||
|
Alternatively, copy this line into `Packages/manifest.json`:
|
||||||
|
```
|
||||||
|
"com.dcfa_pixels.debugx": "https://github.com/DCFApixels/Unity-DebugX.git"
|
||||||
|
```
|
||||||
|
|
||||||
### Source Code
|
### Source Code
|
||||||
The Package can also be directly copied into the project folder.
|
The Package can also be directly copied into the project folder.
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ MonoBehaviour:
|
|||||||
m_ColorSpace: -1
|
m_ColorSpace: -1
|
||||||
m_NumColorKeys: 3
|
m_NumColorKeys: 3
|
||||||
m_NumAlphaKeys: 2
|
m_NumAlphaKeys: 2
|
||||||
GradientMultiplier: 2
|
GradientMultiplier: 3
|
||||||
Points:
|
Points:
|
||||||
- {fileID: 1728437382}
|
- {fileID: 1728437382}
|
||||||
- {fileID: 54381892}
|
- {fileID: 54381892}
|
||||||
@ -875,6 +875,37 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 2137543453}
|
m_Father: {fileID: 2137543453}
|
||||||
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
|
||||||
|
--- !u!1 &223293503
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 223293504}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Warrning
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &223293504
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 223293503}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: -1.82}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 241950277}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &227658960
|
--- !u!1 &227658960
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -975,6 +1006,7 @@ Transform:
|
|||||||
- {fileID: 629058557}
|
- {fileID: 629058557}
|
||||||
- {fileID: 1190527457}
|
- {fileID: 1190527457}
|
||||||
- {fileID: 607411204}
|
- {fileID: 607411204}
|
||||||
|
- {fileID: 1275004640}
|
||||||
m_Father: {fileID: 2070085917}
|
m_Father: {fileID: 2070085917}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &239565651
|
--- !u!1 &239565651
|
||||||
@ -1096,6 +1128,7 @@ Transform:
|
|||||||
- {fileID: 1968074010}
|
- {fileID: 1968074010}
|
||||||
- {fileID: 1230489027}
|
- {fileID: 1230489027}
|
||||||
- {fileID: 82819859}
|
- {fileID: 82819859}
|
||||||
|
- {fileID: 223293504}
|
||||||
m_Father: {fileID: 700624119}
|
m_Father: {fileID: 700624119}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &290054995
|
--- !u!1 &290054995
|
||||||
@ -1621,7 +1654,7 @@ MonoBehaviour:
|
|||||||
m_ColorSpace: -1
|
m_ColorSpace: -1
|
||||||
m_NumColorKeys: 3
|
m_NumColorKeys: 3
|
||||||
m_NumAlphaKeys: 2
|
m_NumAlphaKeys: 2
|
||||||
GradientMultiplier: 2
|
GradientMultiplier: 1.5
|
||||||
WidthMultiplier: 1
|
WidthMultiplier: 1
|
||||||
StartLines:
|
StartLines:
|
||||||
- {fileID: 1105319542}
|
- {fileID: 1105319542}
|
||||||
@ -2506,6 +2539,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 1968074010}
|
- {fileID: 1968074010}
|
||||||
- {fileID: 1230489027}
|
- {fileID: 1230489027}
|
||||||
- {fileID: 82819859}
|
- {fileID: 82819859}
|
||||||
|
WarrningPoint: {fileID: 223293504}
|
||||||
--- !u!4 &700624119
|
--- !u!4 &700624119
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -3650,6 +3684,37 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 162132448}
|
m_Father: {fileID: 162132448}
|
||||||
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
|
||||||
|
--- !u!1 &1275004639
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1275004640}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Warrning
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1275004640
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1275004639}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0.58000004, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 234433271}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1302158462
|
--- !u!1 &1302158462
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -5514,7 +5579,7 @@ MonoBehaviour:
|
|||||||
m_ColorSpace: -1
|
m_ColorSpace: -1
|
||||||
m_NumColorKeys: 3
|
m_NumColorKeys: 3
|
||||||
m_NumAlphaKeys: 2
|
m_NumAlphaKeys: 2
|
||||||
GradientMultiplier: 2
|
GradientMultiplier: 3
|
||||||
Points:
|
Points:
|
||||||
- {fileID: 1170244042}
|
- {fileID: 1170244042}
|
||||||
- {fileID: 151432312}
|
- {fileID: 151432312}
|
||||||
@ -5727,6 +5792,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 629058557}
|
- {fileID: 629058557}
|
||||||
- {fileID: 1190527457}
|
- {fileID: 1190527457}
|
||||||
- {fileID: 607411204}
|
- {fileID: 607411204}
|
||||||
|
WarrningPoint: {fileID: 1275004640}
|
||||||
--- !u!4 &2070085917
|
--- !u!4 &2070085917
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using DCFApixels.DebugXCore.Samples.Internal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DebugXCore.Samples
|
namespace DCFApixels.DebugXCore.Samples
|
||||||
@ -39,12 +40,7 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
}
|
}
|
||||||
private Color GetColor(Transform pos1, Transform pos2)
|
private Color GetColor(Transform pos1, Transform pos2)
|
||||||
{
|
{
|
||||||
Vector3 pos = (pos1.localPosition + pos2.localPosition) * 0.5f;
|
return Gradient.Evaluate(pos1, pos2, GradientMultiplier);
|
||||||
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
|
||||||
pos += Vector3.one * 0.5f;
|
|
||||||
float t = pos.x + pos.y + pos.z;
|
|
||||||
t /= 3f;
|
|
||||||
return Gradient.Evaluate(Mathf.Clamp01(t));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using DCFApixels.DebugXCore.Samples.Internal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DebugXCore.Samples
|
namespace DCFApixels.DebugXCore.Samples
|
||||||
@ -42,12 +43,7 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
}
|
}
|
||||||
private Color GetColor(Transform pos1)
|
private Color GetColor(Transform pos1)
|
||||||
{
|
{
|
||||||
Vector3 pos = pos1.localPosition;
|
return Gradient.Evaluate(pos1, GradientMultiplier);
|
||||||
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
|
||||||
pos += Vector3.one * 0.5f;
|
|
||||||
float t = pos.x + pos.y + pos.z;
|
|
||||||
t /= 3f;
|
|
||||||
return Gradient.Evaluate(Mathf.Clamp01(t));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using DCFApixels.DebugXCore.Samples.Internal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DebugXCore.Samples
|
namespace DCFApixels.DebugXCore.Samples
|
||||||
@ -43,12 +44,7 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
}
|
}
|
||||||
private Color GetColor(Transform pos1)
|
private Color GetColor(Transform pos1)
|
||||||
{
|
{
|
||||||
Vector3 pos = pos1.localPosition;
|
return Gradient.Evaluate(pos1, GradientMultiplier);
|
||||||
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
|
||||||
pos += Vector3.one * 0.5f;
|
|
||||||
float t = pos.x + pos.y + pos.z;
|
|
||||||
t /= 3f;
|
|
||||||
return Gradient.Evaluate(Mathf.Clamp01(t));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using DCFApixels.DebugXCore.Samples.Internal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DebugXCore.Samples
|
namespace DCFApixels.DebugXCore.Samples
|
||||||
@ -44,12 +45,7 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
}
|
}
|
||||||
private Color GetColor(Transform pos1)
|
private Color GetColor(Transform pos1)
|
||||||
{
|
{
|
||||||
Vector3 pos = pos1.localPosition;
|
return Gradient.Evaluate(pos1, GradientMultiplier);
|
||||||
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
|
||||||
pos += Vector3.one * 0.5f;
|
|
||||||
float t = pos.x + pos.y + pos.z;
|
|
||||||
t /= 3f;
|
|
||||||
return Gradient.Evaluate(Mathf.Clamp01(t));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using DCFApixels.DebugXCore.Samples.Internal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DebugXCore.Samples
|
namespace DCFApixels.DebugXCore.Samples
|
||||||
@ -8,6 +9,8 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
public Gradient Gradient;
|
public Gradient Gradient;
|
||||||
public float GradientMultiplier = 5;
|
public float GradientMultiplier = 5;
|
||||||
public Transform[] Points;
|
public Transform[] Points;
|
||||||
|
public Transform WarrningPoint;
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
private void OnDrawGizmos()
|
private void OnDrawGizmos()
|
||||||
@ -50,18 +53,13 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
ray = new Ray(point.position, point.forward);
|
ray = new Ray(point.position, point.forward);
|
||||||
hit = Physics2D.CapsuleCast(ray.origin, point.localScale, CapsuleDirection2D.Vertical, point.eulerAngles.z, ray.direction, float.PositiveInfinity, int.MaxValue);
|
hit = Physics2D.CapsuleCast(ray.origin, point.localScale, CapsuleDirection2D.Vertical, point.eulerAngles.z, ray.direction, float.PositiveInfinity, int.MaxValue);
|
||||||
DebugX.Draw(GetColor(point)).CapsuleCast2D(ray, point.eulerAngles.z, point.localScale, CapsuleDirection2D.Vertical, hit);
|
DebugX.Draw(GetColor(point)).CapsuleCast2D(ray, point.eulerAngles.z, point.localScale, CapsuleDirection2D.Vertical, hit);
|
||||||
|
#else
|
||||||
|
DebugX.Draw(GetColor(WarrningPoint).Inverse()).Text(WarrningPoint.position, "Add \"DEBUGX_ENABLE_PHYSICS2D\" define", DebugXTextSettings.WorldSpaceScale.SetSize(22).SetAnchor(TextAnchor.MiddleCenter));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
private Color GetColor(Transform pos1)
|
private Color GetColor(Transform pos1)
|
||||||
{
|
{
|
||||||
Vector3 pos = pos1.localPosition;
|
return Gradient.Evaluate(pos1, GradientMultiplier);
|
||||||
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
|
||||||
pos += Vector3.one * 0.5f;
|
|
||||||
//float t = pos.x + pos.y + pos.z;
|
|
||||||
//t /= 3f;
|
|
||||||
float t = pos.x + pos.z;
|
|
||||||
t /= 2f;
|
|
||||||
return Gradient.Evaluate(Mathf.Clamp01(t));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using DCFApixels.DebugXCore.Samples.Internal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DebugXCore.Samples
|
namespace DCFApixels.DebugXCore.Samples
|
||||||
@ -8,7 +9,7 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
public Gradient Gradient;
|
public Gradient Gradient;
|
||||||
public float GradientMultiplier = 5;
|
public float GradientMultiplier = 5;
|
||||||
public Transform[] Points;
|
public Transform[] Points;
|
||||||
|
public Transform WarrningPoint;
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
@ -54,16 +55,13 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
Vector3 point2 = ray.origin + point.up * point.localScale.y * RADIUS_M * -0.5f;
|
Vector3 point2 = ray.origin + point.up * point.localScale.y * RADIUS_M * -0.5f;
|
||||||
Physics.CapsuleCast(point1, point2, point.localScale.x * RADIUS_M, ray.direction, out hit, float.PositiveInfinity, int.MaxValue, QueryTriggerInteraction.UseGlobal);
|
Physics.CapsuleCast(point1, point2, point.localScale.x * RADIUS_M, ray.direction, out hit, float.PositiveInfinity, int.MaxValue, QueryTriggerInteraction.UseGlobal);
|
||||||
DebugX.Draw(GetColor(point)).CapsuleCast(point1, point2, ray.direction, point.localScale.x * RADIUS_M, hit);
|
DebugX.Draw(GetColor(point)).CapsuleCast(point1, point2, ray.direction, point.localScale.x * RADIUS_M, hit);
|
||||||
|
#else
|
||||||
|
DebugX.Draw(GetColor(WarrningPoint).Inverse()).Text(WarrningPoint.position, "Add \"DEBUGX_ENABLE_PHYSICS3D\" define", DebugXTextSettings.WorldSpaceScale.SetSize(22).SetAnchor(TextAnchor.MiddleCenter));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
private Color GetColor(Transform pos1)
|
private Color GetColor(Transform pos1)
|
||||||
{
|
{
|
||||||
Vector3 pos = pos1.localPosition;
|
return Gradient.Evaluate(pos1, GradientMultiplier);
|
||||||
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
|
||||||
pos += Vector3.one * 0.5f;
|
|
||||||
float t = pos.x + pos.y + pos.z;
|
|
||||||
t /= 3f;
|
|
||||||
return Gradient.Evaluate(Mathf.Clamp01(t));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
Samples/Scripts/Utils.cs
Normal file
33
Samples/Scripts/Utils.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DCFApixels.DebugXCore.Samples.Internal
|
||||||
|
{
|
||||||
|
internal static class Utils
|
||||||
|
{
|
||||||
|
public static Color Evaluate(this Gradient gradient, Transform transform, float m)
|
||||||
|
{
|
||||||
|
Vector3 pos = transform.localPosition;
|
||||||
|
pos /= m == 0 ? 1 : m;
|
||||||
|
pos += Vector3.one * 0.5f;
|
||||||
|
float t = pos.x + pos.z;
|
||||||
|
t /= 2f;
|
||||||
|
return gradient.Evaluate(Mathf.Clamp01(t));
|
||||||
|
}
|
||||||
|
public static Color Evaluate(this Gradient gradient, Transform transform0, Transform transform1, float m)
|
||||||
|
{
|
||||||
|
Vector3 pos = (transform0.localPosition + transform1.localPosition) * 0.5f;
|
||||||
|
pos /= m == 0 ? 1 : m;
|
||||||
|
pos += Vector3.one * 0.5f;
|
||||||
|
float t = pos.x + pos.z;
|
||||||
|
t /= 3f;
|
||||||
|
return gradient.Evaluate(Mathf.Clamp01(t));
|
||||||
|
}
|
||||||
|
public static Color Inverse(this Color c)
|
||||||
|
{
|
||||||
|
var a = c.a;
|
||||||
|
c = Color.white - c;
|
||||||
|
c.a = a;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
Samples/Scripts/Utils.cs.meta
Normal file
2
Samples/Scripts/Utils.cs.meta
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 646aedc98b9a6f3458a27f6d43e85990
|
@ -8,7 +8,7 @@
|
|||||||
"displayName": "DebugX",
|
"displayName": "DebugX",
|
||||||
"description": "",
|
"description": "",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
"version": "0.8.11",
|
"version": "0.8.12",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/DCFApixels/DebugX.git"
|
"url": "https://github.com/DCFApixels/DebugX.git"
|
||||||
|
Loading…
Reference in New Issue
Block a user