Пример #1
0
    public void ApplyCameraProfile(Camera camera, PROFILE_MODE profileMode, CameraTransition transition = null)
    {
        _currentParent = camera.transform;
        if (profileMode == PROFILE_MODE.DEFAULT)
        {
            _defaultParent = camera.transform;
        }
        transform.SetParent(_currentParent);

        ChangeSize(camera.orthographicSize, profileMode, transition);
        MoveTo(_currentParent.transform.position, profileMode, transition);
        RotateTo(_currentParent.transform.position, profileMode, transition);
    }
Пример #2
0
    public void ChangeSize(float size, PROFILE_MODE profileMode, CameraTransition transition = null)
    {
        if (null != transition)
        {
            _sizeTransition         = transition;
            _sizeTransitionStart    = _currentSize;
            _sizeTransitionEnd      = size;
            _sizeTransitionTimer    = 0f;
            _isSizeTransitionActive = true;
        }
        else
        {
            _camera.orthographicSize = _currentSize = size;
        }

        if (profileMode == PROFILE_MODE.DEFAULT)
        {
            _defaultSize = size;
        }
    }
Пример #3
0
    public void RotateTo(Vector3 angle, PROFILE_MODE profileMode, CameraTransition transition = null)
    {
        if (null != transition)
        {
            _rotateTransition       = transition;
            _rotateTransitionOrigin = transform.localEulerAngles;
            //_moveTransitionDestination = destination;
            _rotateTransitionDestination = angle;
            _rotateTransitionTimer       = 0f;
            _isMoveTransitonActive       = true;
        }
        else
        {
            transform.localEulerAngles = angle;
        }

        if (profileMode == PROFILE_MODE.DEFAULT)
        {
            _defaultRotation = angle;
        }
    }
Пример #4
0
    public void MoveTo(Vector3 destination, PROFILE_MODE profileMode, CameraTransition transition = null)
    {
        if (null != transition)
        {
            _moveTransition       = transition;
            _moveTransitionOrigin = transform.localPosition;
            //_moveTransitionDestination = destination;
            _moveTransitionDestination = _currentParent.InverseTransformPoint(destination);
            _moveTransitionTimer       = 0f;
            _isMoveTransitonActive     = true;
        }
        else
        {
            transform.position = destination;
        }

        if (profileMode == PROFILE_MODE.DEFAULT)
        {
            _defaultPosition = destination;
        }
    }