예제 #1
0
    void _lerpPosition_OnLerpFinished()
    {
        //if lifting piece then not doin it anymore
        if (_liftingPiece)
        {
            _liftingPiece  = false;
            _hasBeenLifted = true;

            if (_forceMove)
            {
                // move over the destination tile
                _lerpPosition._LerpTime = _MoveTime;
                _toGoTo   = _destination;
                _toGoTo.y = _LiftedHeight;
                _lerpPosition.LerpTo(_toGoTo);
            }
        }
        // if commander has been dropped
        else if (this.transform.position.y != _LiftedHeight)
        {
            OnCommanderGrounded(_Player.CommanderPosition);

            if (_destinationTile != null)
            {
                if (_forceMove && _forceMoveEvents)
                {
                    OnCommanderForceMoved(_destinationTile._Tile);
                }
                else
                {
                    OnCommanderMoved(_destinationTile._Tile);
                }
            }
            _destinationTile = null;
            _hasBeenLifted   = false;

            if (_forceMove)
            {
                // force move has ended
                _forceMove       = false;
                _forceMoveEvents = false;
            }
        }
        // if commander has been force moved over a tile
        else if (_forceMove && _hasBeenLifted)
        {
            _toGoTo.y = _targetY;
            if (_destinationRotation != null)
            {
                _lerpRotation.LerpTo(_destinationRotation);
            }
        }
    }
예제 #2
0
    public void UpdateRotations()
    {
        //rotate each card ui
        float totalRotation = 0;
        float prevRotToAdd  = 0;

        for (int i = 1; i < m_Cards.Count; i++)
        {
            if (m_Cards[i].isActiveAndEnabled)
            {
                prevRotToAdd = ((!m_CardsSelectable || m_focusedCardIndex == -1) || i != m_focusedCardIndex + 1) ? m_ZRotSpacing : (m_ZRotSpacing * 2);
                //Debug.Log("RotToAdd["+i+"] "+prevRotToAdd);
                m_Cards[i]._TargetRotation = Quaternion.Euler(0, 0, prevRotToAdd + totalRotation);
                //Debug.Log("Target " + m_Cards[i]._TargetRotation);
                totalRotation += prevRotToAdd;
            }
        }

        //rotate the hand ui minus half total
        m_LerpRotation.LerpTo(Quaternion.Euler(0, 0, -totalRotation / 2));
    }