示例#1
0
        // 卡片信息更新
        public void update()
        {
            if (cardAnim == null || !moving)
            {
                return;
            }

            eclapse += Time.deltaTime;
            Vector3 pos = Vector3.Lerp(_startPos, _nextPos, Mathf.Min(eclapse, CardAnimation.MOVE_TIME) / CardAnimation.MOVE_TIME);

            tf.localPosition = pos;

            if (eclapse > CardAnimation.MOVE_TIME)
            {
                slotKey = slotNext;
                if (slotNext == slotTarget)
                {
                    moving = false;
                }
                else
                {
                    if (cardAnim.direction == EDirection.left)
                    {
                        slotNext = cardAnim.leftSlotKey(slotKey);
                    }
                    else
                    {
                        slotNext = cardAnim.rightSlotKey(slotKey);
                    }

                    _startPos = tf.localPosition;
                    _nextPos  = cardAnim.slot2Position(slotNext);
                    eclapse   = 0.0f;
                }
            }
        }