示例#1
0
        public float GetEdgePosition_AsFloat(RectTransform.Edge edge, bool extendToLine = false)
        {
            var edgeLocal  = GetEdgePosition_AsFloat_Local(edge);
            var parentAxis = TextMesh.rectTransform.GetAxisPosition_AsFloat(edge.Axis());

            return(parentAxis + edgeLocal);
        }
示例#2
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);
        }
示例#3
0
        public static RectTransform Align(this RectTransform me, RectTransform.Edge edge, float target)
        {
            var edgePosition = me.GetEdgePosition_AsFloat(edge);
            var offset       = target - edgePosition;

            var offsetVector = new Vector3 {
                [edge.Axis().CoordinateIndex()] = offset
            };

            me.position += offsetVector;

            return(me);
        }
示例#4
0
 public static Func <GZone <float>, float> Sloper(float amplitude, RectTransform.Edge bottomEdge)
 {
     return((zone) => zone.Value + (zone.Coordinate[bottomEdge.Axis().CoordinateIndex()] * amplitude));
 }