Beispiel #1
0
        private void AnimateBoxToBox(Vector2Int _fromIndex, Vector2Int _toIndex)
        {
            GridBox gbFrom = mGridBoxList[GetMapedInex(_fromIndex.x, _fromIndex.y)];
            GridBox gbTo   = mGridBoxList[GetMapedInex(_toIndex.x, _toIndex.y)];

            //Debug.Log ("converting from " + gbFrom.GetCurrentValue () + " >> " + gbTo.GetCurrentValue ());
            Vector2 posFrom = gbFrom.transform.localPosition;
            Vector2 posTo   = gbTo.transform.localPosition;

            GridBox dummyBox = GetAnimatingBox();

            dummyBox.ModifyValue(gbFrom.GetCurrentValue());
            dummyBox.SetBgSize(gbFrom.GetComponent <RectTransform> ().sizeDelta.x);
            dummyBox.transform.localPosition = posFrom;

            dummyBox.gameObject.SetActive(true);
            gbFrom.ModifyValue(0);

            dummyBox.transform.DOLocalMove(posTo, m_AnimationDuration).OnComplete(() => {
                dummyBox.gameObject.SetActive(false);
                PrintGrid();
            });
        }