Пример #1
0
        public static void Set(
            RectTransform cursor,
            RectTransform target,
            ref Vector3 velocity,
            float?smoothMoveTime = null,
            float?smoothSizeTime = null)
        {
            if (!smoothMoveTime.HasValue)
            {
                ((Transform)cursor).set_position(((Transform)target).get_position());
            }
            else
            {
                ((Transform)cursor).set_position(Smooth.Damp(((Transform)cursor).get_position(), ((Transform)target).get_position(), ref velocity, smoothMoveTime.Value));
            }
            if (!smoothSizeTime.HasValue)
            {
                return;
            }
            Vector3 velocity1 = velocity;

            CursorFrame.SetSize(cursor, target, ref velocity1, smoothSizeTime.Value);
            if (smoothMoveTime.HasValue)
            {
                return;
            }
            velocity = velocity1;
        }
Пример #2
0
 public static void SetSize(
     RectTransform cursor,
     RectTransform target,
     ref Vector3 velocity,
     float smoothTime)
 {
     for (int index = 0; index < CursorFrame.axes.Length; ++index)
     {
         float     num1  = ((Vector3) ref velocity).get_Item(index);
         Rect      rect1 = cursor.get_rect();
         Vector2   size1 = ((Rect) ref rect1).get_size();
         double    num2  = (double)((Vector2) ref size1).get_Item(index);
         Rect      rect2 = target.get_rect();
         Vector2   size2 = ((Rect) ref rect2).get_size();
         double    num3  = (double)((Vector2) ref size2).get_Item(index);
         ref float local = ref num1;
         double    num4  = (double)smoothTime;
         float     num5  = Smooth.Damp((float)num2, (float)num3, ref local, (float)num4);
         ((Vector3) ref velocity).set_Item(index, num1);
         cursor.SetSizeWithCurrentAnchors((RectTransform.Axis)(int) CursorFrame.axes[index], num5);
     }