mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-09-18 01:54:37 +08:00
update sample
This commit is contained in:
parent
4b709366d9
commit
9e966edb31
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
|
@ -8,6 +8,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,6 +52,8 @@ 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(Inverse(GetColor(WarrningPoint))).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)
|
||||||
@ -57,11 +61,16 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
Vector3 pos = pos1.localPosition;
|
Vector3 pos = pos1.localPosition;
|
||||||
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
||||||
pos += Vector3.one * 0.5f;
|
pos += Vector3.one * 0.5f;
|
||||||
//float t = pos.x + pos.y + pos.z;
|
|
||||||
//t /= 3f;
|
|
||||||
float t = pos.x + pos.z;
|
float t = pos.x + pos.z;
|
||||||
t /= 2f;
|
t /= 2f;
|
||||||
return Gradient.Evaluate(Mathf.Clamp01(t));
|
return Gradient.Evaluate(Mathf.Clamp01(t));
|
||||||
}
|
}
|
||||||
|
private Color Inverse(Color c)
|
||||||
|
{
|
||||||
|
var a = c.a;
|
||||||
|
c = Color.white - c;
|
||||||
|
c.a = a;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,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,6 +54,8 @@ 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(Inverse(GetColor(WarrningPoint))).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)
|
||||||
@ -61,9 +63,16 @@ namespace DCFApixels.DebugXCore.Samples
|
|||||||
Vector3 pos = pos1.localPosition;
|
Vector3 pos = pos1.localPosition;
|
||||||
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
|
||||||
pos += Vector3.one * 0.5f;
|
pos += Vector3.one * 0.5f;
|
||||||
float t = pos.x + pos.y + pos.z;
|
float t = pos.x + pos.z;
|
||||||
t /= 3f;
|
t /= 2f;
|
||||||
return Gradient.Evaluate(Mathf.Clamp01(t));
|
return Gradient.Evaluate(Mathf.Clamp01(t));
|
||||||
}
|
}
|
||||||
|
private Color Inverse(Color c)
|
||||||
|
{
|
||||||
|
var a = c.a;
|
||||||
|
c = Color.white - c;
|
||||||
|
c.a = a;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user