Beispiel #1
0
        public string GetSummary()
        {
            var points = ComponentPoints.Select(p => $"({p.Y},{p.X})");

            return($"Sub-Region:\n" +
                   $"\tPoints: {{ { string.Join(", ", points)} }}\n" +
                   $"\tC. of Mass: ({CenterOfMass.Item2}, {CenterOfMass.Item1})");
        }
        private static void CreatePointsLister()
        {
            GameObject            whereToPut   = CreatePointsLister("Component Points Lister");
            ComponentPoints       points       = whereToPut.AddComponent(typeof(ComponentPoints)) as ComponentPoints;
            ComponentPointsEditor pointsEditor = (ComponentPointsEditor)CreateEditor((ComponentPoints)points, typeof(ComponentPointsEditor));

            pointsEditor.Construct(Color.yellow);
            DestroyImmediate(pointsEditor);
            Selection.activeGameObject = points.gameObject;
        }
 static void DrawGizmos(ComponentPoints points, GizmoType selectionType)
 {
     if (points.gameObject == Selection.activeGameObject)
     {
         return;
     }
     if (!points.ShowWayPointsWhenUnselected)
     {
         return;
     }
     if (!points.ShowTarget)
     {
         return;
     }
     for (int i = 0; i < points.WaypointsCount; ++i)
     {
         DrawUnselected(points, i);
     }
 }
        protected static void DrawUnselected(ComponentPoints point, int index)
        {
            Vector3   posInSpline = point.GetPositionFromPoint(index);
            Component reference   = point.GetReference(index);

            if (reference == null)
            {
                return;
            }

            Vector3 posOfReference = reference.transform.position;

            ExtDrawGuizmos.DrawBezier(posInSpline, posOfReference, point.GetRotationFromPoint(index) * Vector3.right, point.ColorWayPoint, 0.5f);


            float size     = HandleUtility.GetHandleSize(posOfReference) * 0.05f;
            Color colorOld = Gizmos.color;

            Gizmos.color = point.ColorWayPoint;
            Gizmos.DrawSphere(posOfReference, size);
            Gizmos.color = colorOld;
        }