Пример #1
0
        public static float GetEdgePosition_AsFloat(this RectTransform me, RectTransform.Edge edge)
        {
            var relevantPosition = me.position[edge.Axis().CoordinateIndex()];
            var distanceToEdge   = me.DistanceFromPivotToEdge(edge);
            var edgePosition     = relevantPosition + (distanceToEdge * edge.Direction());

            return(edgePosition);
        }
Пример #2
0
        public static void LineUp(
            RectTransform leader,
            IEnumerable <RectTransform> followers,
            RectTransform.Edge direction,
            float padding = 0
            )
        {
            var previousInLine = leader;

            foreach (var nextInLine in followers)
            {
                nextInLine.Align(direction.Inverse(), previousInLine.GetEdgePosition_AsFloat(direction) + direction.Direction() * padding);
                previousInLine = nextInLine;
            }
        }