virtual public void OnDrawGizmos(Color m_StartCol, Color m_EndCol) { #if UNITY_EDITOR var tmp = Gizmos.color; Gizmos.color = m_StartCol; var prev = m_Points[0]; UCL_DrawGizmos.DrawConstSizeSphere(prev, 1.5f); for (int i = 1; i < m_Points.Count; i++) { var cur = m_Points[i]; //Gizmos.color = Color.Lerp(m_StartCol, m_EndCol, (i / (float)m_Points.Count)); UCL_DrawGizmos.DrawLine(prev, cur); prev = cur; } Gizmos.color = m_EndCol; if (m_Points.Count > 1) { UCL_DrawGizmos.DrawConstSizeSphere(prev, 1.5f); } //m_Rnd.OnRect(width, height); Gizmos.color = tmp; #endif }
private void OnDrawGizmos() { #if UNITY_EDITOR var tmp = Gizmos.color; if (m_PathPoints == null) { m_PathPoints = new List <Vector3>(); } if (m_PathPoints.Count == 0) { UpdatePath(); } UCL_DrawGizmos.DrawConstSizeSphere(m_PathPoints[0], 1.5f); //m_Rnd.OnRect(width, height); Gizmos.color = tmp; #endif }
private void OnDrawGizmos() { var prev_col = Gizmos.color; Gizmos.color = Color.green; Vector3 s = m_S.position; Vector3 e = m_E.position; Vector3 prev = Vector3.Lerp(s, e, m_Datas[0]); UCL_DrawGizmos.DrawConstSizeSphere(prev, 1f); for (int i = 1; i < m_Datas.Count; i++) { Vector3 cur = Vector3.Lerp(s, e, m_Datas[i]); Gizmos.DrawLine(prev, cur); UCL_DrawGizmos.DrawConstSizeSphere(cur, 1f); prev = cur; } //m_Datas.FirstElement Gizmos.color = Color.red; float seg = 1f / (m_Datas.Count - 1); float x = 0; float y = 0; for (int i = 0; i < m_Datas.Count; i++) { y = seg * i; x = MathLib.LinearMapping.GetX(m_Datas, y); Vector3 cur = Vector3.Lerp(s, e, CurveFunc(x)); //Gizmos.DrawLine(prev, cur); UCL_DrawGizmos.DrawConstSizeSphere(cur, 1f); prev = cur; } /* * Gizmos.color = Color.red; * float seg = 1.0f / (m_Datas.Count - 1); * for(int i = 0; i < m_Datas.Count; i++) { * Vector3 cur = Vector3.Lerp(s, e, MathLib.LinearMapping.get); * UCL_DrawGizmos.DrawConstSizeSphere(cur, 1f); * prev = cur; * } */ Gizmos.color = prev_col; }
#pragma warning restore 0414 virtual protected void DrawGizmos() { #if UNITY_EDITOR var tmp = Gizmos.color; { Vector3 prev = GetPos(0); Gizmos.color = m_PathCol; int m_SmoothAmount = 100; for (int i = 1; i <= m_SmoothAmount; i++) { float pm = (float)i / m_SmoothAmount; Vector3 currPt = GetPos(pm); Gizmos.DrawLine(currPt, prev); prev = currPt; } } if (m_DisPointCount > 0) { float seg = 1.0f / m_DisPointCount; for (int i = 0; i < m_DisPointCount; i++) { var a = GetPos(i * seg); //var a = m_GetPoint ? GetPoint(i * seg) : GetPos(i * seg); UCL_DrawGizmos.DrawConstSizeSphere(a, 0.5f * m_PointSize); } /* * for(int i = 0; i < m_WorldSpacePoints.Length - 1; i++) { * Gizmos.DrawLine(m_WorldSpacePoints[i], m_WorldSpacePoints[i + 1]); * } */ } else { Gizmos.color = m_DemoPointColor; UCL_DrawGizmos.DrawConstSizeSphere(GetPos(m_DemoPoint), 0.75f * m_PointSize); } Gizmos.color = tmp; #endif }
#pragma warning restore 0414 //[SerializeField] bool m_GetPoint = false; //#endif protected void DrawGizmos() { #if UNITY_EDITOR if (m_PathPoints == null || m_PathPoints.Length < 4) { return; } if (m_GenStartPos != transform.position || m_GenStartRot != transform.rotation || m_GenStartScale != transform.lossyScale) { UpdatePathPoint(); } var tmp = Gizmos.color; { Vector3 prev = GetPoint(m_PathPoints, 0); Gizmos.color = m_PathCol; int SmoothAmount = m_WorldSpacePoints.Length * m_SmoothSeg; for (int i = 1; i <= SmoothAmount; i++) { float pm = (float)i / SmoothAmount; Vector3 currPt = GetPoint(pm); Gizmos.DrawLine(currPt, prev); prev = currPt; } } if (m_DisPointCount > 0) { float seg = 1.0f / m_DisPointCount; for (int i = 0; i < m_DisPointCount; i++) { var a = GetPos(i * seg); //var a = m_GetPoint ? GetPoint(i * seg) : GetPos(i * seg); UCL_DrawGizmos.DrawConstSizeSphere(a, 0.5f * m_PointSize); /* * var b = GetPosLinear(i * seg); * UCL_DrawGizmos.DrawConstSizeSphere(b, 0.5f * m_PointSize); * Gizmos.DrawLine(a, b); */ } /* * for(int i = 0; i < m_WorldSpacePoints.Length - 1; i++) { * Gizmos.DrawLine(m_WorldSpacePoints[i], m_WorldSpacePoints[i + 1]); * } */ } else { Gizmos.color = m_DemoPointColor; UCL_DrawGizmos.DrawConstSizeSphere(GetPos(m_DemoPoint), 0.75f * m_PointSize); } Gizmos.color = m_PointCol; //UnityEditor.Handles.color = m_PointCol; for (int i = 0; i < m_WorldSpacePoints.Length; i++) { UCL_DrawGizmos.DrawConstSizeSphere(m_WorldSpacePoints[i], m_PointSize); //Gizmos.DrawSphere(m_WorldSpacePoints[i], 1f * GetGizmoSize(m_WorldSpacePoints[i])); //UnityEditor.Handles.dra(m_WorldSpacePoints[i], Vector3.one); } Gizmos.color = tmp; #endif }