Пример #1
0
        private IEnumerator ZoomInCamera(float finalZoomSize, float duration)
        {
            CinemachineBrain     brain             = Camera.main.GetComponent <CinemachineBrain>();
            CinemachineClearShot currentVcamParent = brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent <CinemachineClearShot>();

            if (currentVcamParent != null)
            {
                CinemachineVirtualCamera currentVcam = currentVcamParent.LiveChild as CinemachineVirtualCamera;
                if (currentVcam != null)
                {
                    float originZoomSize = currentVcam.m_Lens.OrthographicSize;
                    float timeLeft       = duration;
                    while (timeLeft > 0)
                    {
                        currentVcam.m_Lens.OrthographicSize += (finalZoomSize - originZoomSize) * Time.deltaTime / duration;
                        timeLeft -= Time.deltaTime;
                        yield return(null);
                    }
                    if (currentVcam.m_Lens.OrthographicSize != finalZoomSize)
                    {
                        currentVcam.m_Lens.OrthographicSize = finalZoomSize;
                    }
                }
            }
        }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     rooms = GameObject.FindGameObjectsWithTag("Room");
     masks = GameObject.FindGameObjectsWithTag("Mask");
     //rooms_M = GameObject.FindGameObjectsWithTag("Room").
     //brain = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CinemachineBrain>();
     CSCamera = GameObject.FindGameObjectWithTag("ClearShot").GetComponent <CinemachineClearShot>();
 }
    private void Start()
    {
        followCamera = gameObject.GetComponent <CinemachineVirtualCamera>();

        target = carTarget[0].GetComponent <PathFollower>();

        m_clearShot = clearShotRef.GetComponent <CinemachineClearShot>();
    }
Пример #4
0
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        cameraTransformReference = Camera.main.transform;
        if (scene.name.Equals("MainCabin"))
        {
            CM_ClearShot = GameObject.Find("CM_ClearShotCamera_MainCabin").GetComponent <CinemachineClearShot>();

            StartCoroutine(SetActiveClearShot());
        }
    }
Пример #5
0
    private void OnVirtualCameraActivated(ICinemachineCamera toCamera, ICinemachineCamera fromCamera)
    {
        if (toCamera.GetType() != typeof(CinemachineClearShot))
        {
            EventManager <RoomSwitchEventInfo> .InvokeEvent(new RoomSwitchEventInfo()
            {
                virtualCameraName = toCamera.Name
            });

            _isBlending = true;
        }
        else
        {
            _cinemachineClearShot = (CinemachineClearShot)toCamera;
        }
    }
        public override void SetUp()
        {
            // a basic "character" to use as a lookat
            m_Character = CreateGameObject("Character");
            m_Character.transform.position = new Vector3(10, 0, 1);

            // main camera
            CreateGameObject("Camera", typeof(Camera), typeof(CinemachineBrain));

            // a ClearShot camera
            var clearShotHolder = CreateGameObject("CM ClearShot", typeof(CinemachineClearShot), typeof(CinemachineCollider));

            m_ClearShot        = clearShotHolder.GetComponent <CinemachineClearShot>();
            m_ClearShot.LookAt = m_Character.transform;
            var clearShotCollider = clearShotHolder.GetComponent <CinemachineCollider>();

            clearShotCollider.m_MinimumDistanceFromTarget = 0.1f;

            // a stationary vcam1 with a hard lookat
            var vcam1Holder = CreateGameObject("CM Vcam1", typeof(CinemachineVirtualCamera));

            vcam1Holder.transform.SetParent(clearShotHolder.transform);
            vcam1Holder.transform.position = new Vector3(0, 0, 8);
            m_Vcam1 = vcam1Holder.GetComponent <CinemachineVirtualCamera>();
            m_Vcam1.AddCinemachineComponent <CinemachineHardLookAt>();
            m_Vcam1.Priority = 20;

            // a completely locked vcam2
            var vcam2Holder = CreateGameObject("CM Vcam2", typeof(CinemachineVirtualCamera));

            vcam2Holder.transform.SetParent(clearShotHolder.transform);
            vcam2Holder.transform.position = new Vector3(0, 0, -2);
            m_Vcam2          = vcam2Holder.GetComponent <CinemachineVirtualCamera>();
            m_Vcam2.Priority = 10;

            // a "wall" composed of a single quad that partially obscures vcam1, but not vcam2
            var wall = CreatePrimitive(PrimitiveType.Quad);

            wall.transform.SetPositionAndRotation(new Vector3(0, 0, 4), Quaternion.Euler(0, 180, 0));
            wall.transform.localScale = new Vector3(2, 2, 2);

            base.SetUp();
        }
Пример #7
0
 void Start()
 {
     clearShot = GetComponent <CinemachineClearShot>();
     num       = 0;
     SetCamera(num);
 }
Пример #8
0
 // Start is called before the first frame update
 void Start()
 {
     cams = GetComponent <CinemachineClearShot>();
 }
Пример #9
0
 private void Start()
 {
     brain     = Camera.main.GetComponent <CinemachineBrain>();
     clearShot = brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent <CinemachineClearShot>();
 }