Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #4
0
 public static Func <GZone <float>, float> Sloper(float amplitude, RectTransform.Edge bottomEdge)
 {
     return((zone) => zone.Value + (zone.Coordinate[bottomEdge.Axis().CoordinateIndex()] * amplitude));
 }