mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-09-18 01:54:37 +08:00
Compare commits
5 Commits
e470b229bc
...
04453e4d78
Author | SHA1 | Date | |
---|---|---|---|
![]() |
04453e4d78 | ||
![]() |
862d86733d | ||
![]() |
9695037e09 | ||
![]() |
fbdc0fd8d1 | ||
![]() |
48c4753756 |
@ -55,6 +55,15 @@ namespace DCFApixels.DebugXCore.Internal
|
||||
color.a = EditorGUILayout.Slider(DebugX.GlobalColor.a, 0, 1);
|
||||
DebugX.GlobalColor = color;
|
||||
|
||||
|
||||
DebugX.GlobalGreaterPassAlpha = EditorGUILayout.FloatField("GreaterPassAlpha", DebugX.GlobalGreaterPassAlpha);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
tmpValue = EditorGUILayout.Slider(DebugX.GlobalGreaterPassAlpha, 0, 2);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
DebugX.GlobalGreaterPassAlpha = tmpValue;
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Reset"))
|
||||
{
|
||||
DebugX.ResetGlobals();
|
||||
|
@ -23,9 +23,11 @@ namespace DCFApixels
|
||||
private const string GLOBAL_TIME_SCALE_PREF_NAME = "DCFApixels.DebugX.TimeScale";
|
||||
private const string GLOBAL_DOT_SIZE_PREF_NAME = "DCFApixels.DebugX.DotSize";
|
||||
private const string GLOBAL_COLOR_PREF_NAME = "DCFApixels.DebugX.Color";
|
||||
private const string GLOBAL_GREATER_PASS_ALPHA_PREF_NAME = "DCFApixels.DebugX.GreaterPassAlpha";
|
||||
|
||||
private readonly static int GlobalDotSizePropertyID = Shader.PropertyToID("_DebugX_GlobalDotSize");
|
||||
private readonly static int GlobalColorPropertyID = Shader.PropertyToID("_DebugX_GlobalColor");
|
||||
private readonly static int GlobalGreaterPassAlphaPropertyID = Shader.PropertyToID("_DebugX_GlobalGreaterPassAlpha");
|
||||
internal readonly static int ColorPropertyID = Shader.PropertyToID("_Color");
|
||||
|
||||
|
||||
|
@ -49,6 +49,21 @@ namespace DCFApixels
|
||||
var record = *(int*)&c32;
|
||||
#if UNITY_EDITOR
|
||||
EditorPrefs.SetInt(GLOBAL_COLOR_PREF_NAME, record);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
private static float _globalGreaterPassAlphaCache;
|
||||
public static float GlobalGreaterPassAlpha
|
||||
{
|
||||
get { return _globalGreaterPassAlphaCache; }
|
||||
set
|
||||
{
|
||||
if (_globalGreaterPassAlphaCache == value) { return; }
|
||||
_globalGreaterPassAlphaCache = value;
|
||||
Shader.SetGlobalFloat(nameID: GlobalGreaterPassAlphaPropertyID, _globalGreaterPassAlphaCache);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
EditorPrefs.SetFloat(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME, _globalGreaterPassAlphaCache);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -58,22 +73,27 @@ namespace DCFApixels
|
||||
EditorPrefs.DeleteKey(GLOBAL_TIME_SCALE_PREF_NAME);
|
||||
EditorPrefs.DeleteKey(GLOBAL_DOT_SIZE_PREF_NAME);
|
||||
EditorPrefs.DeleteKey(GLOBAL_COLOR_PREF_NAME);
|
||||
EditorPrefs.DeleteKey(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME);
|
||||
#endif
|
||||
_dotSizeCache = default;
|
||||
_timeScaleCache = default;
|
||||
_dotSizeCache = default;
|
||||
_globalColorCache = default;
|
||||
_globalGreaterPassAlphaCache = default;
|
||||
InitGlobals();
|
||||
}
|
||||
private static void InitGlobals()
|
||||
{
|
||||
GlobalTimeScale = 1;
|
||||
GlobalDotSize = 1;
|
||||
GlobalColor = Color.white;
|
||||
#if UNITY_EDITOR
|
||||
GlobalTimeScale = EditorPrefs.GetFloat(GLOBAL_TIME_SCALE_PREF_NAME, 1f);
|
||||
GlobalDotSize = EditorPrefs.GetFloat(GLOBAL_DOT_SIZE_PREF_NAME, 1f);
|
||||
var colorCode = EditorPrefs.GetInt(GLOBAL_COLOR_PREF_NAME, -1);
|
||||
GlobalColor = (Color)(*(Color32*)&colorCode);
|
||||
GlobalGreaterPassAlpha = EditorPrefs.GetFloat(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME, 0.1f);
|
||||
#else
|
||||
GlobalTimeScale = 1;
|
||||
GlobalDotSize = 1;
|
||||
GlobalColor = Color.white;
|
||||
GlobalGreaterPassAlpha = 0.1f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DCFApixels.DebugXCore;
|
||||
using DCFApixels.DebugXCore.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@ -263,24 +264,65 @@ namespace DCFApixels
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Line primitives
|
||||
[IN(LINE)]
|
||||
public DrawHandler LineWireBox(Vector3 start, Vector3 end, Quaternion rotation, Vector3 size)
|
||||
{
|
||||
size *= 2f;
|
||||
WidthOutLine(start, end, size.x);
|
||||
WireCube(start, rotation, size);
|
||||
WireCube(end, rotation, size);
|
||||
Setup(Color.SetAlpha(ShadowAlphaMultiplier)).Line(start, end);
|
||||
return this;
|
||||
}
|
||||
[IN(LINE)]
|
||||
public DrawHandler LineWireSphere(Vector3 start, Vector3 end, float radius)
|
||||
{
|
||||
WidthOutLine(start, end, radius * 2f);
|
||||
WireSphere(start, radius);
|
||||
WireSphere(end, radius);
|
||||
Setup(Color.SetAlpha(ShadowAlphaMultiplier)).Line(start, end);
|
||||
return this;
|
||||
}
|
||||
[IN(LINE)]
|
||||
public DrawHandler LineWireCapsule(Vector3 startPoint1, Vector3 startPoint2, Vector3 end, float radius) => LineWireCapsule_Internal(startPoint1, startPoint1, (startPoint1 + startPoint2) * 0.5f, end, radius);
|
||||
[IN(LINE)]
|
||||
private DrawHandler LineWireCapsule_Internal(Vector3 startPoint1, Vector3 startPoint2, Vector3 startCenter, Vector3 end, float radius)
|
||||
{
|
||||
Quaternion rotation = Quaternion.LookRotation(startPoint2 - startPoint1, Vector3.up);
|
||||
rotation = rotation * Quaternion.Euler(90, 0, 0);
|
||||
LineWireCapsule(startCenter, end, rotation, radius, Vector3.Distance(startPoint1, startPoint2) + radius * 2f);
|
||||
return this;
|
||||
}
|
||||
[IN(LINE)]
|
||||
public DrawHandler LineWireCapsule(Vector3 start, Vector3 end, Quaternion rotation, float radius, float height)
|
||||
{
|
||||
WidthOutLine(start, end, radius * 2f);
|
||||
WireCapsule(start, rotation, radius, height);
|
||||
WireCapsule(end, rotation, radius, height);
|
||||
Setup(Color.SetAlpha(ShadowAlphaMultiplier)).Line(start, end);
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Ray
|
||||
[IN(LINE)] public DrawHandler Ray(Transform origin, Vector3 localVector) => Ray(origin.position, origin.rotation * localVector);
|
||||
[IN(LINE)] public DrawHandler Ray(Vector3 origin, Quaternion rotation) => Ray(origin, rotation * Vector3.forward);
|
||||
[IN(LINE)] public DrawHandler Ray(Transform transform, Vector3 localVector) => Ray(transform.position, transform.rotation * localVector);
|
||||
[IN(LINE)] public DrawHandler Ray(Vector3 origin, Quaternion direction) => Ray(origin, direction * Vector3.forward);
|
||||
[IN(LINE)] public DrawHandler Ray(Ray ray) => Ray(ray.origin, ray.direction);
|
||||
[IN(LINE)] public DrawHandler Ray(Vector3 origin, Vector3 direction) => Line(origin, origin + direction);
|
||||
#endregion
|
||||
|
||||
#region RayFade
|
||||
[IN(LINE)] public DrawHandler RayFade(Transform origin, Vector3 localVector) => RayFade(origin.position, origin.rotation * localVector);
|
||||
[IN(LINE)] public DrawHandler RayFade(Vector3 origin, Quaternion rotation) => RayFade(origin, rotation * Vector3.forward);
|
||||
[IN(LINE)] public DrawHandler RayFade(Transform transform, Vector3 localVector) => RayFade(transform.position, transform.rotation * localVector);
|
||||
[IN(LINE)] public DrawHandler RayFade(Vector3 origin, Quaternion direction) => RayFade(origin, direction * Vector3.forward);
|
||||
[IN(LINE)] public DrawHandler RayFade(Ray ray) => RayFade(ray.origin, ray.direction);
|
||||
[IN(LINE)] public DrawHandler RayFade(Vector3 origin, Vector3 direction) => LineFade(origin, origin + direction);
|
||||
#endregion
|
||||
|
||||
#region RayArrow
|
||||
[IN(LINE)] public DrawHandler RayArrow(Transform origin, Vector3 localVector) => RayArrow(origin.position, origin.rotation * localVector);
|
||||
[IN(LINE)] public DrawHandler RayArrow(Vector3 origin, Quaternion rotation) => RayArrow(origin, rotation * Vector3.forward);
|
||||
[IN(LINE)] public DrawHandler RayArrow(Transform transform, Vector3 localVector) => RayArrow(transform.position, transform.rotation * localVector);
|
||||
[IN(LINE)] public DrawHandler RayArrow(Vector3 origin, Quaternion direction) => RayArrow(origin, direction * Vector3.forward);
|
||||
[IN(LINE)] public DrawHandler RayArrow(Ray ray) => RayArrow(ray.origin, ray.direction);
|
||||
[IN(LINE)] public DrawHandler RayArrow(Vector3 origin, Vector3 direction) => LineArrow(origin, origin + direction);
|
||||
#endregion
|
||||
@ -297,6 +339,37 @@ namespace DCFApixels
|
||||
public DrawHandler Ray(Vector3 origin, Vector3 direction, DebugXLine startType, DebugXLine endType) => Line(origin, origin + direction, startType, endType);
|
||||
#endregion
|
||||
|
||||
#region Ray primitives
|
||||
[IN(LINE)] public DrawHandler RayWireBox(Transform transform, Vector3 localVector, Quaternion rotation, Vector3 size) => RayWireBox(transform.position, transform.rotation * localVector, transform.rotation * rotation, transform.lossyScale.Mult(size));
|
||||
[IN(LINE)] public DrawHandler RayWireBox(Vector3 origin, Quaternion direction, Quaternion rotation, Vector3 size) => RayWireBox(origin, direction * Vector3.forward, rotation, size);
|
||||
[IN(LINE)] public DrawHandler RayWireBox(Ray ray, Quaternion rotation, Vector3 size) => RayWireBox(ray.origin, ray.direction, rotation, size);
|
||||
[IN(LINE)] public DrawHandler RayWireBox(Vector3 origin, Vector3 direction, Quaternion rotation, Vector3 size) => LineWireBox(origin, origin + direction, rotation, size);
|
||||
|
||||
[IN(LINE)] public DrawHandler RayWireSphere(Transform transform, Vector3 localVector, float radius) => RayWireSphere(transform.position, transform.rotation * localVector, radius);
|
||||
[IN(LINE)] public DrawHandler RayWireSphere(Vector3 origin, Quaternion direction, float radius) => RayWireSphere(origin, direction * Vector3.forward, radius);
|
||||
[IN(LINE)] public DrawHandler RayWireSphere(Ray ray, float radius) => RayWireSphere(ray.origin, ray.direction, radius);
|
||||
[IN(LINE)] public DrawHandler RayWireSphere(Vector3 origin, Vector3 direction, float radius) => LineWireSphere(origin, origin + direction, radius);
|
||||
|
||||
|
||||
[IN(LINE)] public DrawHandler RayWireCapsule(Vector3 startPoint1, Vector3 startPoint2, Quaternion direction, float radius) => RayWireCapsule(startPoint1, startPoint2, direction * Vector3.forward, radius);
|
||||
[IN(LINE)]
|
||||
public DrawHandler RayWireCapsule(Vector3 startPoint1, Vector3 startPoint2, Vector3 direction, float radius)
|
||||
{
|
||||
var center = (startPoint1 + startPoint2) * 0.5f;
|
||||
return LineWireCapsule_Internal(startPoint1, startPoint1, center, center + direction, radius);
|
||||
}
|
||||
|
||||
[IN(LINE)]
|
||||
public DrawHandler RayWireCapsule(Transform transform, Vector3 localVector, Quaternion rotation, float radius, float height)
|
||||
{
|
||||
var scale = transform.lossyScale;
|
||||
return RayWireCapsule(transform.position, transform.rotation * localVector, transform.rotation * rotation, radius + scale.x, height * scale.y);
|
||||
}
|
||||
[IN(LINE)] public DrawHandler RayWireCapsule(Vector3 origin, Quaternion direction, Quaternion rotation, float radius, float height) => RayWireCapsule(origin, direction * Vector3.forward, rotation, radius, height);
|
||||
[IN(LINE)] public DrawHandler RayWireCapsule(Ray ray, Quaternion rotation, float radius, float height) => RayWireCapsule(ray.origin, ray.direction, rotation, radius, height);
|
||||
[IN(LINE)] public DrawHandler RayWireCapsule(Vector3 origin, Vector3 direction, Quaternion rotation, float radius, float height) => LineWireCapsule(origin, origin + direction, rotation, radius, height);
|
||||
#endregion
|
||||
|
||||
|
||||
#region WidthLine
|
||||
[IN(LINE)] public DrawHandler WidthLine(Vector3 start, Vector3 end, float width) => Gizmo(new WidthLineGizmo(start, end, width));
|
||||
|
@ -72,7 +72,8 @@ namespace DCFApixels
|
||||
[IN(LINE)]
|
||||
public DrawHandler BoxCast(Vector3 origin, Vector3 direction, Quaternion rotation, Vector3 size, RaycastHit hit)
|
||||
{
|
||||
WireCube(origin, rotation, size * 2f);
|
||||
size *= 2f;
|
||||
WireCube(origin, rotation, size);
|
||||
if (hit.collider == null)
|
||||
{
|
||||
RayFade(origin, direction * 3f);
|
||||
@ -81,9 +82,9 @@ namespace DCFApixels
|
||||
{
|
||||
Vector3 end = origin + direction * hit.distance;
|
||||
|
||||
WidthOutLine(origin, end, size.x * 2f);
|
||||
WidthOutLine(origin, end, size.x);
|
||||
Setup(Color.SetAlpha(ShadowAlphaMultiplier)).Line(origin, end);
|
||||
WireCube(end, rotation, size * 2f);
|
||||
WireCube(end, rotation, size);
|
||||
|
||||
RaycastHit(hit);
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
using DCFApixels.DebugXCore;
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
//#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
//#endif
|
||||
|
||||
namespace DCFApixels
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace DCFApixels.DebugXCore.Internal
|
||||
{
|
||||
internal static class ColorExtensions
|
||||
internal static class Extensions
|
||||
{
|
||||
public static Color SetAlpha(this Color self, float v)
|
||||
{
|
||||
@ -14,5 +14,18 @@ namespace DCFApixels.DebugXCore.Internal
|
||||
self.color.a *= self.alpha;
|
||||
return self.color;
|
||||
}
|
||||
public static Vector3 Mult(this Vector3 a, Vector3 b)
|
||||
{
|
||||
a.x *= b.x;
|
||||
a.y *= b.y;
|
||||
a.z *= b.z;
|
||||
return a;
|
||||
}
|
||||
public static Vector2 Mult(this Vector2 a, Vector2 b)
|
||||
{
|
||||
a.x *= b.x;
|
||||
a.y *= b.y;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
@ -67,7 +67,7 @@ Shader "DCFApixels/DebugX/Handles"
|
||||
};
|
||||
|
||||
float4 _DebugX_GlobalColor;
|
||||
|
||||
float _DebugX_GlobalGreaterPassAlpha;
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
@ -123,7 +123,8 @@ Shader "DCFApixels/DebugX/Handles"
|
||||
CGPROGRAM
|
||||
half4 frag (v2f i) : SV_Target
|
||||
{
|
||||
return i.color * half4(1, 1, 1, 0.1);
|
||||
//return i.color * half4(1, 1, 1, 0.1);
|
||||
return i.color * half4(1, 1, 1, _DebugX_GlobalGreaterPassAlpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ Shader "DCFApixels/DebugX/Handles Wire"
|
||||
};
|
||||
|
||||
float4 _DebugX_GlobalColor;
|
||||
|
||||
float _DebugX_GlobalGreaterPassAlpha;
|
||||
|
||||
v2g vert (appdata_t v)
|
||||
{
|
||||
@ -154,7 +154,8 @@ Shader "DCFApixels/DebugX/Handles Wire"
|
||||
CGPROGRAM
|
||||
half4 frag (g2f i) : SV_Target
|
||||
{
|
||||
return i.color * half4(1, 1, 1, 0.1);
|
||||
//return i.color * half4(1, 1, 1, 0.1);
|
||||
return i.color * half4(1, 1, 1, _DebugX_GlobalGreaterPassAlpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
91
Runtime/Utils/ColorX.cs
Normal file
91
Runtime/Utils/ColorX.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DebugXCore
|
||||
{
|
||||
public class ColorX
|
||||
{
|
||||
/// <summary> color code Red. RGB is (255, 0, 0)</summary>
|
||||
public static readonly Color Red = new Color32(255, 0, 0, 255);
|
||||
/// <summary> color code Green. RGB is (0, 255, 0)</summary>
|
||||
public static readonly Color Green = new Color32(0, 255, 0, 255);
|
||||
/// <summary> color code Blue. RGB is (0, 0, 255)</summary>
|
||||
public static readonly Color Blue = new Color32(0, 0, 255, 255);
|
||||
/// <summary> color code Yellow. RGB is (255, 255, 0)</summary>
|
||||
public static readonly Color Yellow = new Color32(255, 255, 0, 255);
|
||||
/// <summary> color code Cyan. RGB is (0, 255, 255)</summary>
|
||||
public static readonly Color Cyan = new Color32(0, 255, 255, 255);
|
||||
/// <summary> color code Magenta. RGB is (255, 0, 255)</summary>
|
||||
public static readonly Color Magenta = new Color32(255, 0, 255, 255);
|
||||
/// <summary> color code White. RGB is (255, 255, 255)</summary>
|
||||
public static readonly Color White = new Color32(255, 255, 255, 255);
|
||||
/// <summary> color code Black. RGB is (0, 0, 0)</summary>
|
||||
public static readonly Color Black = new Color32(0, 0, 0, 255);
|
||||
|
||||
/// <summary> color code OrangeRed. RGB is (255, 69, 0)</summary>
|
||||
public static readonly Color OrangeRed = new Color32(255, 69, 0, 255);
|
||||
/// <summary> color code Orange. RGB is (255, 165, 0)</summary>
|
||||
public static readonly Color Orange = new Color32(255, 165, 0, 255);
|
||||
/// <summary> color code Purple. RGB is (128, 0, 128)</summary>
|
||||
public static readonly Color Purple = new Color32(128, 0, 128, 255);
|
||||
/// <summary> color code Pink. RGB is (255, 192, 203)</summary>
|
||||
public static readonly Color Pink = new Color32(255, 192, 203, 255);
|
||||
/// <summary> color code Brown. RGB is (165, 42, 42)</summary>
|
||||
public static readonly Color Brown = new Color32(165, 42, 42, 255);
|
||||
/// <summary> color code Grey/Gray. RGB is (128, 128, 128)</summary>
|
||||
public static readonly Color Gray = new Color32(128, 128, 128, 255);
|
||||
/// <summary> color code Grey/Gray. RGB is (128, 128, 128)</summary>
|
||||
public static readonly Color Grey = Gray;
|
||||
/// <summary> color code LightGray. RGB is (211, 211, 211)</summary>
|
||||
public static readonly Color LightGray = new Color32(211, 211, 211, 255);
|
||||
/// <summary> color code DarkGray. RGB is (64, 64, 64)</summary>
|
||||
public static readonly Color DarkGray = new Color32(64, 64, 64, 255);
|
||||
/// <summary> color code Lime. RGB is (125, 255, 0)</summary>
|
||||
public static readonly Color Lime = new Color32(125, 255, 0, 255);
|
||||
/// <summary> color code Teal. RGB is (0, 128, 128)</summary>
|
||||
public static readonly Color Teal = new Color32(0, 128, 128, 255);
|
||||
/// <summary> color code Olive. RGB is (128, 128, 0)</summary>
|
||||
public static readonly Color Olive = new Color32(128, 128, 0, 255);
|
||||
/// <summary> color code Navy. RGB is (0, 0, 128)</summary>
|
||||
public static readonly Color Navy = new Color32(0, 0, 128, 255);
|
||||
/// <summary> color code Maroon. RGB is (128, 0, 0)</summary>
|
||||
public static readonly Color Maroon = new Color32(128, 0, 0, 255);
|
||||
/// <summary> color code Aquamarine. RGB is (127, 255, 212)</summary>
|
||||
public static readonly Color Aquamarine = new Color32(127, 255, 212, 255);
|
||||
/// <summary> color code Fuchsia. RGB is (255, 0, 255)</summary>
|
||||
public static readonly Color Fuchsia = new Color32(255, 0, 255, 255);
|
||||
/// <summary> color code Silver. RGB is (192, 192, 192)</summary>
|
||||
public static readonly Color Silver = new Color32(192, 192, 192, 255);
|
||||
/// <summary> color code Gold. RGB is (255, 215, 0)</summary>
|
||||
public static readonly Color Gold = new Color32(255, 215, 0, 255);
|
||||
/// <summary> color code Indigo. RGB is (75, 0, 130)</summary>
|
||||
public static readonly Color Indigo = new Color32(75, 0, 130, 255);
|
||||
/// <summary> color code Violet. RGB is (238, 130, 238)</summary>
|
||||
public static readonly Color Violet = new Color32(238, 130, 238, 255);
|
||||
/// <summary> color code Coral. RGB is (255, 127, 80)</summary>
|
||||
public static readonly Color Coral = new Color32(255, 127, 80, 255);
|
||||
/// <summary> color code Salmon. RGB is (250, 128, 114)</summary>
|
||||
public static readonly Color Salmon = new Color32(250, 128, 114, 255);
|
||||
/// <summary> color code Turquoise. RGB is (64, 224, 208)</summary>
|
||||
public static readonly Color Turquoise = new Color32(64, 224, 208, 255);
|
||||
/// <summary> color code SkyBlue. RGB is (135, 206, 235)</summary>
|
||||
public static readonly Color SkyBlue = new Color32(135, 206, 235, 255);
|
||||
/// <summary> color code Plum. RGB is (221, 160, 221)</summary>
|
||||
public static readonly Color Plum = new Color32(221, 160, 221, 255);
|
||||
/// <summary> color code Khaki. RGB is (213, 197, 138)</summary>
|
||||
public static readonly Color Khaki = new Color32(213, 197, 138, 255);
|
||||
/// <summary> color code Beige. RGB is (237, 232, 208)</summary>
|
||||
public static readonly Color Beige = new Color32(237, 232, 208, 255);
|
||||
/// <summary> color code Lavender. RGB is (230, 230, 250)</summary>
|
||||
public static readonly Color Lavender = new Color32(230, 230, 250, 255);
|
||||
/// <summary> color code Goldenrod. RGB is (218, 165, 32)</summary>
|
||||
public static readonly Color Goldenrod = new Color32(218, 165, 32, 255);
|
||||
/// <summary> color code DeepPink. RGB is (255, 105, 180)</summary>
|
||||
public static readonly Color DeepPink = new Color32(255, 105, 180, 255);
|
||||
/// <summary> color code Crimson. RGB is (220, 20, 60)</summary>
|
||||
public static readonly Color Crimson = new Color32(220, 20, 60, 255);
|
||||
/// <summary> color code BlueViolet. RGB is (138, 43, 226)</summary>
|
||||
public static readonly Color BlueViolet = new Color32(138, 43, 226, 255);
|
||||
/// <summary> color code AmericanRose. RGB is (255, 3, 62)</summary>
|
||||
public static readonly Color AmericanRose = new Color32(255, 3, 62, 255);
|
||||
}
|
||||
}
|
2
Runtime/Utils/ColorX.cs.meta
Normal file
2
Runtime/Utils/ColorX.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81b38422925065a4d951ed9a03939795
|
@ -2404,6 +2404,7 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 854408294}
|
||||
- {fileID: 618947640}
|
||||
- {fileID: 938543767}
|
||||
- {fileID: 819845932}
|
||||
- {fileID: 734505742}
|
||||
- {fileID: 1548291220}
|
||||
@ -2540,6 +2541,8 @@ MonoBehaviour:
|
||||
- {fileID: 1230489027}
|
||||
- {fileID: 82819859}
|
||||
WarrningPoint: {fileID: 223293504}
|
||||
RotatedTransform: {fileID: 819845932}
|
||||
RotationSpeed: 30
|
||||
--- !u!4 &700624119
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3266,6 +3269,84 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1625911623}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &938543766
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 938543767}
|
||||
- component: {fileID: 938543768}
|
||||
m_Layer: 0
|
||||
m_Name: Collider (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &938543767
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 938543766}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -3.007, z: 0.5}
|
||||
m_LocalScale: {x: 6, y: 0.5000001, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 644929157}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &938543768
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 938543766}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ForceReceiveLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ContactCaptureLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_CallbackLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_CompositeOperation: 0
|
||||
m_CompositeOrder: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
oldSize: {x: 0, y: 0}
|
||||
newSize: {x: 0, y: 0}
|
||||
adaptiveTilingThreshold: 0
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!1 &1048642970
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -5793,6 +5874,8 @@ MonoBehaviour:
|
||||
- {fileID: 1190527457}
|
||||
- {fileID: 607411204}
|
||||
WarrningPoint: {fileID: 1275004640}
|
||||
RotatedTransform: {fileID: 1102617550}
|
||||
RotationSpeed: 30
|
||||
--- !u!4 &2070085917
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -11,6 +11,8 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
public Transform[] Points;
|
||||
public Transform WarrningPoint;
|
||||
|
||||
public Transform RotatedTransform;
|
||||
public float RotationSpeed = 30;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void OnDrawGizmos()
|
||||
@ -56,6 +58,11 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
#else
|
||||
DebugX.Draw(GetColor(WarrningPoint).Inverse()).Text(WarrningPoint.position, "Add \"DEBUGX_ENABLE_PHYSICS2D\" define", DebugXTextSettings.WorldSpaceScale.SetSize(22).SetAnchor(TextAnchor.MiddleCenter));
|
||||
#endif
|
||||
|
||||
if (Application.isPlaying && RotatedTransform)
|
||||
{
|
||||
RotatedTransform.Rotate(new Vector3(0, RotationSpeed * Time.deltaTime, 0));
|
||||
}
|
||||
}
|
||||
private Color GetColor(Transform pos1)
|
||||
{
|
||||
|
@ -11,6 +11,8 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
public Transform[] Points;
|
||||
public Transform WarrningPoint;
|
||||
|
||||
public Transform RotatedTransform;
|
||||
public float RotationSpeed = 30;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void OnDrawGizmos()
|
||||
@ -58,6 +60,11 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
#else
|
||||
DebugX.Draw(GetColor(WarrningPoint).Inverse()).Text(WarrningPoint.position, "Add \"DEBUGX_ENABLE_PHYSICS3D\" define", DebugXTextSettings.WorldSpaceScale.SetSize(22).SetAnchor(TextAnchor.MiddleCenter));
|
||||
#endif
|
||||
|
||||
if (Application.isPlaying && RotatedTransform)
|
||||
{
|
||||
RotatedTransform.Rotate(new Vector3(0, RotationSpeed * Time.deltaTime, 0));
|
||||
}
|
||||
}
|
||||
private Color GetColor(Transform pos1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user