Begin() static public method

Start the tweening process.
static public Begin ( GameObject go, Vector3 pos, float strength ) : SpringPosition,
go GameObject
pos Vector3
strength float
return SpringPosition,
Exemplo n.º 1
0
    /// <summary>
    /// Constrain the current target position to be within panel bounds.
    /// </summary>

    public bool ConstrainTargetToBounds(Transform target, ref Bounds targetBounds, bool immediate)
    {
        Vector3 offset = CalculateConstrainOffset(targetBounds.min, targetBounds.max);

        if (offset.magnitude > 0f)
        {
            if (immediate)
            {
                target.localPosition += offset;
                targetBounds.center  += offset;
                SpringPosition sp = target.GetComponent <SpringPosition>();
                if (sp != null)
                {
                    sp.enabled = false;
                }
            }
            else
            {
                SpringPosition sp = SpringPosition.Begin(target.gameObject, target.localPosition + offset, 13f);
                sp.ignoreTimeScale = true;
                sp.worldSpace      = false;
            }
            return(true);
        }
        return(false);
    }
Exemplo n.º 2
0
 void BringIn()
 {
     gameObject.transform.localPosition = InitialPos;
     _spring = SpringPosition.Begin(gameObject, Vector3.zero, BringInForce);
     _spring.eventReceiver    = gameObject;
     _spring.callWhenFinished = "FinishSpring";
     _nowStatus = ShowStatus.BringIn;
 }
Exemplo n.º 3
0
    void MoveToGrid(int gridIndex)
    {
        m_CachePos = GetGirdPos(gridIndex);
        SpringPosition sp = SpringPosition.Begin(gameObject, m_CachePos, 7f);

        sp.ignoreTimeScale = true;
        sp.worldSpace      = false;
        sp.EventReceiver   = gameObject;
    }
Exemplo n.º 4
0
    void GoToPage(int index)
    {
        _uiScrollView.enabled = false;
        Vector3 pos = list_items[index].transform.localPosition;

        pos.y = -(uiPanel.transform.localPosition.y - PanelInitY);
        list_items[index].transform.localPosition = pos;
        SpringPosition.Begin(uiGrid.gameObject, new Vector3(-PageIndex * uiGrid.cellWidth, 0, 0), 10).onFinished = OnSpringPositionFinished;
    }
Exemplo n.º 5
0
    private void moveTarget(Vector3 dest)
    {
        SpringPosition sp = SpringPosition.Begin(mPageContro.gameObject, dest, 5f);

        sp.ignoreTimeScale = true;
        sp.worldSpace      = false;
        if (UpdateDragPos != null)
        {
            UpdateDragPos(bVertical ? dest.y : dest.x, true);
        }
    }
Exemplo n.º 6
0
        public void BottomRefresh(int equipType)
        {
            if (!_hasInitialized)
            {
                _hasInitialized = true;                  //Initialize干的就是这个
            }
            if (0 <= equipType && equipType < SprEquips.Length)
            {
                //Focus.position = SprEquips[equipType].transform.position;//焦点框
                SpringPosition.Begin(Focus.gameObject,
                                     Focus.parent.InverseTransformPoint(SprEquips[equipType].transform.position), 10);//焦点框
            }

            if (_equipConfig == null)
            {
                return;
            }

            var curList = _equipConfig == null
                              ? new List <Communication.Proto.Equip>()
                              : _equipConfig.EquipList.Where(
                x =>
                x.Type == equipType && CommonData.MyEquipList.Exists(y => y.EquipCode == x.EquipCode))
                          .ToList();
            var slotCount = Mathf.Max(10, (curList.Count + 1) / 2 * 2);

            while (_equipSlotList.Count < slotCount)
            {
                var slot = PrefabHelper.InstantiateAndReset <EquipSlot>(EquipSlotTemplate, Grid.transform);
                slot.name       = "EquipSlot " + _equipSlotList.Count;
                slot.EquipPanel = this;
                slot.gameObject.SetActive(true);
                _equipSlotList.Add(slot);
            }

            for (int i = 0; i < _equipSlotList.Count; i++)
            {
                if (i < curList.Count)
                {
                    _equipSlotList[i].gameObject.SetActive(true);
                    var equip        = curList[i];
                    var curCharacter = CommonData.MyCharacterList[_index];
                    var userEquip    = CommonData.MyEquipList.Find(x => x.EquipCode == equip.EquipCode);
                    _equipSlotList[i].SetAndRefresh(curList[i], curCharacter.WearEquipList.Contains(equip.EquipCode), userEquip.Count);
                }
                else
                {
                    _equipSlotList[i].SetAndRefresh(null, false, 0);
                }
            }

            EquipSlotTemplate.SetActive(false);
        }
Exemplo n.º 7
0
        private void moveTarget(Vector3 dest)
        {
            SpringPosition sp = SpringPosition.Begin(target.gameObject, dest, 5f);

            sp.ignoreTimeScale = true;
            sp.worldSpace      = false;
            DragXPostion xData = new DragXPostion();

            xData.moved = true;
            xData.x     = dest.x;
            target.SendMessage(x_postion_notify_name, xData, SendMessageOptions.DontRequireReceiver);
        }
Exemplo n.º 8
0
    public void CloseList()
    {
        BetterList <Transform> childList = this.GetChildList();

        if (this.sorting != UIGrid.Sorting.None)
        {
            if (this.sorting == UIGrid.Sorting.Alphabetic)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortByName));
            }
            else if (this.sorting == UIGrid.Sorting.Horizontal)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortHorizontal));
            }
            else if (this.sorting == UIGrid.Sorting.Vertical)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortVertical));
            }
            else if (this.onCustomSort != null)
            {
                childList.Sort(this.onCustomSort);
            }
            else
            {
                this.Sort(childList);
            }
        }
        int i    = 0;
        int size = childList.size;

        while (i < size)
        {
            childList[i].parent = null;
            i++;
        }
        Transform transform = base.transform;
        int       j         = 0;
        int       size2     = childList.size;

        while (j < size2)
        {
            Transform transform2 = childList[j];
            transform2.parent = transform;
            float          z              = transform2.localPosition.z;
            int            num            = (!this.reverse) ? 1 : -1;
            Vector3        pos            = (this.arrangement != UIGrid.Arrangement.Horizontal) ? new Vector3(0f, this.cellHeight * -1f, z) : new Vector3(this.cellWidth * -1f * (float)num, 0f, z);
            SpringPosition springPosition = SpringPosition.Begin(transform2.gameObject, pos, 30f);
            springPosition.updateScrollView = true;
            springPosition.onFinished       = new SpringPosition.OnFinished(this.OnCloseFinish);
            j++;
        }
    }
Exemplo n.º 9
0
 public void showSpInfoUIParm(bool show)
 {
     if (show)
     {
         isShowDynamicList = true;
         SpringPosition sp = SpringPosition.Begin(gameObject, new Vector3(178f, 0f, 0f), 15f);
     }
     else
     {
         isShowDynamicList = false;
         SpringPosition sp = SpringPosition.Begin(gameObject, new Vector3(-280f, 0f, 0f), 15f);
     }
 }
Exemplo n.º 10
0
 public void showSpInfoUI()
 {
     if (isShow)
     {
         isShow = false;
         SpringPosition sp = SpringPosition.Begin(gameObject, new Vector3(-359f, 0f, 0f), 15f);
     }
     else
     {
         isShow = true;
         SpringPosition sp = SpringPosition.Begin(gameObject, new Vector3(44f, 0f, 0f), 15f);
     }
 }
Exemplo n.º 11
0
 public void showSpInfoUI(GameObject obj)
 {
     if (isShowTreeMenu)
     {
         isShowTreeMenu = false;
         SpringPosition sp = SpringPosition.Begin(obj, new Vector3(316f, 0f, 0f), 15f);
     }
     else
     {
         isShowTreeMenu = true;
         SpringPosition sp = SpringPosition.Begin(obj, new Vector3(-97f, 0f, 0f), 15f);
     }
 }
Exemplo n.º 12
0
    public void MoveToPage(int page)
    {
        Vector3 pos = GetTargetPagePos(page);

        m_CachePos = pos;
        SpringPosition sp = SpringPosition.Begin(gameObject, m_CachePos, 5f);

        sp.ignoreTimeScale = true;
        sp.worldSpace      = false;
        sp.strength        = moveSpeed;
        sp.EventReceiver   = gameObject;

        m_isNeedToUpdate = true;
    }
        //-------------------------------------------------------------------------------------[]
        private void SetPositionToNewInventoryElement(
            Transform child,
            int itemSize,
            List <InventoryGuiCell> nearCells)
        {
            var firstCellInventoryCoords = nearCells[0].IndexInInventory;
            var rowCells = nearCells.Where(t => t.IndexInInventory.ColCoord == firstCellInventoryCoords.ColCoord);
            var colCells = nearCells.Where(t => t.IndexInInventory.RowCoord == firstCellInventoryCoords.RowCoord);
            var newPos   = new Vector2(
                rowCells.Sum(t => t.Center.x) / rowCells.Count(),
                colCells.Sum(t => t.Center.y) / colCells.Count());

            SpringPosition.Begin(child.gameObject, newPos, Constants.DifferentValues.SpringPositionStrength);
            _newItemFinalPos = newPos;
        }
Exemplo n.º 14
0
 public void showSpInfoUI()
 {
     if (isShowDynamicList)
     {
         SpringPosition sb = SpringPosition.Begin(showButton.gameObject, new Vector3(-35, 16f, 0f), 15f);
         isShowDynamicList = false;
         SpringPosition sp = SpringPosition.Begin(gameObject, new Vector3(-280f, 0f, 0f), 15f);
     }
     else
     {
         SpringPosition sb = SpringPosition.Begin(showButton.gameObject, new Vector3(-357, 16f, 0f), 15f);
         isShowDynamicList = true;
         SpringPosition sp = SpringPosition.Begin(gameObject, new Vector3(178f, 0f, 0f), 15f);
     }
 }
Exemplo n.º 15
0
    public float startAngle = 0;    //起始角度

    protected override void ResetPosition(List <Transform> list)
    {
        mReposition = false;

        // Epic hack: Unparent all children so that we get to control the order in which they are re-added back in
        // EDIT: Turns out this does nothing.
        //for (int i = 0, imax = list.Count; i < imax; ++i)
        //	list[i].parent = null;


        //Transform myTrans = transform;
        float curRadians = 0;

        // Re-add the children in the same order we have them in and position them accordingly
        for (int i = 0, imax = list.Count; i < imax; ++i)
        {
            Transform t = list[i];
            // See above
            //t.parent = myTrans;

            Vector3 pos   = t.localPosition;
            float   depth = pos.z;

            curRadians = Mathf.PI * ((startAngle + i * angle) / 180);
            float posX = Mathf.Sin(curRadians) * R;
            float posY = Mathf.Cos(curRadians) * R;
            pos = new Vector3(posX, posY, depth);

            //if (arrangement == Arrangement.CellSnap) {
            //    if (cellWidth > 0) pos.x = Mathf.Round(pos.x / cellWidth) * cellWidth;
            //    if (cellHeight > 0) pos.y = Mathf.Round(pos.y / cellHeight) * cellHeight;
            //} else pos = (arrangement == Arrangement.Horizontal) ?
            //      new Vector3(cellWidth * x, -cellHeight * y, depth) :
            //      new Vector3(cellWidth * y, -cellHeight * x, depth);

            if (animateSmoothly && Application.isPlaying)
            {
                SpringPosition sp = SpringPosition.Begin(t.gameObject, pos, 15f);
                sp.updateScrollView = true;
                sp.ignoreTimeScale  = true;
            }
            else
            {
                t.localPosition = pos;
            }
        }
    }
Exemplo n.º 16
0
    //飞行完成时的事件回调

    /*public IQKEvent evt_Finished {
     *  get { return _evt_Finished; }
     *  set { if (_evt_Finished != null) _evt_Finished.Dispose(); _evt_Finished = value; }
     * }
     *
     * IQKEvent _evt_Finished = null;
     */

    public void StartFly(OnFlyEnd callBack)
    {
        if (InFlyLayer)
        {
            m_bakParent = gameObject.transform.parent;
            gameObject.transform.parent = UIFlyRoot.Single.transform;
            NGUITools.MarkParentAsChanged(gameObject);
        }

        //禁用物体上的碰检盒
        gameObject.EnableCollider(false);

        SpringPosition sp = SpringPosition.Begin(gameObject, target, strength);

        sp.worldSpace = worldSpace;
        sp.onFinished = () => onFinished(callBack);
    }
Exemplo n.º 17
0
        /// <summary>
        /// 右移按钮
        /// </summary>
        public void Right_Onclick()
        {
            Vector3 tempos = m_gRecordParent.transform.localPosition;

            tempos.x -= m_fDistance;
            m_gRecordParent.GetComponent <TweenPosition>().from = m_gRecordParent.transform.localPosition;
            m_gRecordParent.GetComponent <TweenPosition>().to   = tempos;
            m_gRecordParent.GetComponent <TweenPosition>().ResetToBeginning();
            m_gRecordParent.GetComponent <TweenPosition>().enabled = true;

            if (tempos.x <= -60.0f)
            {
                SpringPosition sp = SpringPosition.Begin(m_gRecordParent.gameObject, m_gRecordParent.transform.localPosition + new Vector3(-60.0f - m_gRecordParent.transform.localPosition.x, 0, 0), 13f);
                sp.enabled    = true;
                sp.worldSpace = false;
            }
        }
Exemplo n.º 18
0
    void StartAnimation()
    {
        LinkedListNode <Item> first = viewList.First;

        if (first != null)
        {
            LinkedListNode <Item> node = viewList.First.Next;
            while (node != null)
            {
                Vector3 pos = node.Value.view.transform.localPosition;
                node.Value.view.transform.localPosition = node.Previous.Value.view.transform.localPosition;
                SpringPosition.Begin(node.Value.view, pos, 15f);
                //iTween.MoveFrom (node.Value.view,iTween.Hash("islocal",true,"position",first.Value.view.transform.localPosition,"easeType",iTween.EaseType.easeOutCubic,"time",0.3f));
                node = node.Next;
            }
        }
    }
Exemplo n.º 19
0
    protected void ResetPosition(BetterList <Transform> list)
    {
        this.mReposition = false;
        int i    = 0;
        int size = list.size;

        while (i < size)
        {
            list[i].parent = null;
            i++;
        }
        int       num       = 0;
        int       num2      = 0;
        int       num3      = 0;
        int       num4      = 0;
        Transform transform = base.transform;
        int       j         = 0;
        int       size2     = list.size;

        while (j < size2)
        {
            Transform transform2 = list[j];
            transform2.parent = transform;
            float   z      = transform2.localPosition.z;
            int     num5   = (!this.reverse) ? 1 : -1;
            Vector3 vector = (this.arrangement != UIGrid.Arrangement.Horizontal) ? new Vector3(this.cellWidth * (float)num2, -this.cellHeight * (float)num * (float)num5, z) : new Vector3(this.cellWidth * (float)num * (float)num5, -this.cellHeight * (float)num2, z);
            if (this.animateSmoothly && Application.isPlaying)
            {
                SpringPosition.Begin(transform2.gameObject, vector, this.animateSmoothlySpeed).updateScrollView = true;
            }
            else
            {
                transform2.localPosition = vector;
            }
            num3 = Mathf.Max(num3, num);
            num4 = Mathf.Max(num4, num2);
            if (++num >= this.maxPerLine && this.maxPerLine > 0)
            {
                num = 0;
                num2++;
            }
            j++;
        }
        this.RePivot(num3, num4);
    }
Exemplo n.º 20
0
    void Update()
    {
        if (stop)
        {
            return;
        }
        if (isStopRound)
        {
            directionOfTravel = stopLineSprite.position - targetItem.position;
            if (directionOfTravel.y < -0.01f)
            {
                directionOfTravel.Normalize();

                //now normalize the direction, since we only want the direction information
                //scale the movement on each axis by the directionOfTravel vector components
                transform.Translate(0, (directionOfTravel.y * speed * Time.deltaTime), 0, Space.World);
                WrapContent();
            }
            else
            {
                bounce = true;
                directionOfTravel.Normalize();
                if (crtBounce < bounceDistance)
                {
                    transform.Translate(0, (-0.1f * speed * Time.deltaTime), 0, Space.World);
                    crtBounce++;
                }
                else
                {
                    stop = true;
                    SpringPosition sp = SpringPosition.Begin(gameObject,
                                                             new Vector3(transform.position.x, transform.position.y + Mathf.Abs(targetItem.position.y - stopLineSprite.position.y), transform.position.z),
                                                             8f);
                    sp.worldSpace = true;
                    sp.onFinished = EventReelFinish;
                }
            }
        }
        else
        {
            // speed = Mathf.Max(speed - targetPassCount / 1.5f * Time.deltaTime, MIN_SPEED);
            transform.position = new Vector3(transform.position.x, transform.position.y - (speed * Time.deltaTime), transform.position.z);
            WrapContent();
        }
    }
Exemplo n.º 21
0
 static public int Begin_s(IntPtr l)
 {
     try {
         UnityEngine.GameObject a1;
         checkType(l, 1, out a1);
         UnityEngine.Vector3 a2;
         checkType(l, 2, out a2);
         System.Single a3;
         checkType(l, 3, out a3);
         var ret = SpringPosition.Begin(a1, a2, a3);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 22
0
    public bool ConstrainTargetToBounds(Transform target, ref Bounds targetBounds, bool immediate)
    {
        Vector3 vector  = targetBounds.min;
        Vector3 vector2 = targetBounds.max;
        float   num     = 1f;

        if (mClipping == UIDrawCall.Clipping.None)
        {
            UIRoot root = base.root;
            if (root != null)
            {
                num = root.pixelSizeAdjustment;
            }
        }
        if (num != 1f)
        {
            vector  /= num;
            vector2 /= num;
        }
        Vector3 vector3 = CalculateConstrainOffset(vector, vector2) * num;

        if (vector3.sqrMagnitude > 0f)
        {
            if (immediate)
            {
                target.localPosition += vector3;
                targetBounds.center  += vector3;
                SpringPosition component = ((Component)target).GetComponent <SpringPosition>();
                if (component != null)
                {
                    component.enabled = false;
                }
            }
            else
            {
                SpringPosition springPosition = SpringPosition.Begin(target.gameObject, target.localPosition + vector3, 13f);
                springPosition.ignoreTimeScale = true;
                springPosition.worldSpace      = false;
            }
            return(true);
        }
        return(false);
    }
Exemplo n.º 23
0
    public void pop(float sth)
    {
        if (PopButton != null) PopButton.SetActive(false);
        if (PackButton != null) PackButton.SetActive(true);


        m_IsPopd = true;
        if (_Evt_PopStateChanged != null)
            _Evt_PopStateChanged.Call(m_IsPopd);


        foreach (PopMenuItem curr in m_Items)
        { 
            curr.obj.EnableCollider( true); 
            curr.obj.EnableComponent<UIButtonOffset>(true);
            SpringPosition.Begin(curr.obj, curr.InitialPos, sth);
        }

    }
Exemplo n.º 24
0
    public Boolean ConstrainTargetToBounds(Transform target, ref Bounds targetBounds, Boolean immediate)
    {
        Vector3 vector  = targetBounds.min;
        Vector3 vector2 = targetBounds.max;
        Single  num     = 1f;

        if (this.mClipping == UIDrawCall.Clipping.None)
        {
            UIRoot root = base.root;
            if (root != (UnityEngine.Object)null)
            {
                num = root.pixelSizeAdjustment;
            }
        }
        if (num != 1f)
        {
            vector  /= num;
            vector2 /= num;
        }
        Vector3 b = this.CalculateConstrainOffset(vector, vector2) * num;

        if (b.sqrMagnitude > 0f)
        {
            if (immediate)
            {
                target.localPosition += b;
                targetBounds.center  += b;
                SpringPosition component = target.GetComponent <SpringPosition>();
                if (component != (UnityEngine.Object)null)
                {
                    component.enabled = false;
                }
            }
            else
            {
                SpringPosition springPosition = SpringPosition.Begin(target.gameObject, target.localPosition + b, 13f);
                springPosition.ignoreTimeScale = true;
                springPosition.worldSpace      = false;
            }
            return(true);
        }
        return(false);
    }
    public bool ConstrainTargetToBounds(Transform target, ref Bounds targetBounds, bool immediate)
    {
        Vector3 vector  = targetBounds.get_min();
        Vector3 vector2 = targetBounds.get_max();
        float   num     = 1f;

        if (this.mClipping == UIDrawCall.Clipping.None)
        {
            UIRoot root = base.root;
            if (root != null)
            {
                num = root.pixelSizeAdjustment;
            }
        }
        if (num != 1f)
        {
            vector  /= num;
            vector2 /= num;
        }
        Vector3 vector3 = this.CalculateConstrainOffset(vector, vector2) * num;

        if (vector3.get_sqrMagnitude() > 0f)
        {
            if (immediate)
            {
                target.set_localPosition(target.get_localPosition() + vector3);
                targetBounds.set_center(targetBounds.get_center() + vector3);
                SpringPosition component = target.GetComponent <SpringPosition>();
                if (component != null)
                {
                    component.set_enabled(false);
                }
            }
            else
            {
                SpringPosition springPosition = SpringPosition.Begin(target.get_gameObject(), target.get_localPosition() + vector3, 13f);
                springPosition.ignoreTimeScale = true;
                springPosition.worldSpace      = false;
            }
            return(true);
        }
        return(false);
    }
Exemplo n.º 26
0
    // 左侧按钮
    public void GameRoom_LeftBtn()
    {
        Vector3 tempos = m_objCurRoomGrid.transform.localPosition;

        tempos.x += m_fSpacing;

        if (tempos.x >= 25)
        {
            m_springPos            = SpringPosition.Begin(m_objCurRoomGrid.gameObject, new Vector3(25, 0, 0), 13f);
            m_springPos.enabled    = true;
            m_springPos.worldSpace = false;
        }
        else
        {
            m_objCurRoomGrid.GetComponent <TweenPosition>().from = m_objCurRoomGrid.transform.localPosition;
            m_objCurRoomGrid.GetComponent <TweenPosition>().to   = tempos;
            m_objCurRoomGrid.GetComponent <TweenPosition>().ResetToBeginning();
            m_objCurRoomGrid.GetComponent <TweenPosition>().enabled = true;
        }
    }
        //===============================================================================================[]
        #endregion



        #region Public methods
        //===============================================================================================[]
        public void OnNewChild(object value)
        {
            if (transform.childCount > 0)
            {
                if (CanAddItemToContainer())
                {
                    var info       = (( string )value).Split('#');
                    var objectName = info[0];
                    var objectId   = info[1];
                    var child      = transform.FindChild(objectName);
                    SpringPosition.Begin(child.gameObject, Vector3.zero, Constants.DifferentValues.SpringPositionStrength);
                    _currentCraftingItemPlace.AddItem(objectId);
                    _wasItemAdded    = true;
                    _newItemFinalPos = Vector3.zero;
                }
                else
                {
                    _wasItemAdded = false;
                }
            }
        }
Exemplo n.º 28
0
    bool ContrainBounds(bool immediate)
    {
        Vector3    offset   = CalculateConstrainOffset();
        tk2dCamera tkCamera = CameraManager.tk2DCamera;

        if (offset.magnitude > 0f)
        {
            if (immediate == true)
            {
                tkCamera.transform.position -= offset;
            }
            else
            {
                SpringPosition sp = SpringPosition.Begin(tkCamera.gameObject, tkCamera.transform.position - offset, this.springDampStrengthen);
                sp.ignoreTimeScale = true;
                sp.worldSpace      = true;
            }
            return(true);
        }
        return(false);
    }
Exemplo n.º 29
0
 // Token: 0x0600308A RID: 12426 RVA: 0x000EE284 File Offset: 0x000EC684
 public bool ConstrainToBounds(bool immediate)
 {
     if (this.mTrans != null && this.rootForBounds != null)
     {
         Vector3 b = this.CalculateConstrainOffset();
         if (b.sqrMagnitude > 0f)
         {
             if (immediate)
             {
                 this.mTrans.position -= b;
             }
             else
             {
                 SpringPosition springPosition = SpringPosition.Begin(base.gameObject, this.mTrans.position - b, 13f);
                 springPosition.ignoreTimeScale = true;
                 springPosition.worldSpace      = true;
             }
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 30
0
 public bool ConstrainToBounds(bool immediate)
 {
     if (mTrans != null && rootForBounds != null)
     {
         Vector3 vector = CalculateConstrainOffset();
         if (vector.magnitude > 0f)
         {
             if (immediate)
             {
                 mTrans.position -= vector;
             }
             else
             {
                 SpringPosition springPosition = SpringPosition.Begin(base.gameObject, mTrans.position - vector, 13f);
                 springPosition.ignoreTimeScale = true;
                 springPosition.worldSpace      = true;
             }
             return(true);
         }
     }
     return(false);
 }