コード例 #1
0
    void SwitchCamera(Transform t)
    {
        if (onLock && t)
        {
            if (t != player)
            {
                lockIcon.gameObject.SetActive(true);
                PositionConstraint pc = lockIcon.GetComponent <PositionConstraint>();
                if (pc)
                {
                    if (pc.sourceCount > 0)
                    {
                        pc.RemoveSource(0);
                    }
                    constraintSource.sourceTransform = t;
                    constraintSource.weight          = 1;
                    pc.AddSource(constraintSource);
                    //pc.translationOffset = Vector3.zero;
                    //pc.translationAtRest = Vector3.zero;
                }
                lockVcam.GetComponent <CinemachineVirtualCamera>().LookAt   = t;
                lockVcam.GetComponent <CinemachineVirtualCamera>().Priority = mainPriority + 1;
                return;
            }
        }

        lockIcon.gameObject.SetActive(false);
        lockVcam.GetComponent <CinemachineVirtualCamera>().Priority = mainPriority - 1;
    }
コード例 #2
0
 public void ChangeCurrentAngle(float xOrY, bool XTrueYFalse) //bool is true if input float is x, false if input float is y
 {
     if (XTrueYFalse)
     {
         CurrentCamera.GetComponent <CinemachineFreeLook>().m_XAxis.Value = xOrY;
     }
     else
     {
         CurrentCamera.GetComponent <CinemachineFreeLook>().m_YAxis.Value = xOrY;
     }
 }
コード例 #3
0
        bool ObjectHasCollider(object obj)
        {
            CinemachineVirtualCameraBase vcam = obj as CinemachineVirtualCameraBase;
            var collider = (vcam == null) ? null : vcam.GetComponent <CinemachineCollider>();

            return(collider != null && collider.enabled);
        }
コード例 #4
0
    public void AddToMasterList(CinemachineVirtualCameraBase camToAdd)
    {
        _masterList.Add(camToAdd.name, camToAdd);
        Debug.Log("Add " + camToAdd + " To master list");
        _masterCamListNames.Add(camToAdd.name);

        if (!camToAdd.GetComponent <VirtualCameraControllerBase>().isStartingCam)
        {
            camToAdd.gameObject.SetActive(false);
        }
        else
        {
            _activeCam = camToAdd;
        }
    }
コード例 #5
0
ファイル: CinemachinePostFX.cs プロジェクト: 990890/RobotGame
        CinemachinePostFX GetEffectivePostFX(ICinemachineCamera vcam)
        {
            while (vcam != null && vcam.LiveChildOrSelf != vcam)
            {
                vcam = vcam.LiveChildOrSelf;
            }
            CinemachinePostFX postFX = null;

            while (vcam != null && postFX == null)
            {
                CinemachineVirtualCameraBase vcamBase = vcam as CinemachineVirtualCameraBase;
                if (vcamBase != null)
                {
                    postFX = vcamBase.GetComponent <CinemachinePostFX>();
                }
                if (postFX != null && !postFX.enabled)
                {
                    postFX = null;
                }
                vcam = vcam.ParentCamera;
            }
            return(postFX);
        }
コード例 #6
0
 public void Initialize()
 {
     impulseSource = m_virtualCamera.GetComponent <CinemachineImpulseSource>();
 }
コード例 #7
0
 public void PreInitialize()
 {
     vCamRecomposer = virtualCamera.GetComponent <CinemachineRecomposer>();
 }
コード例 #8
0
 void Start()
 {
     mainPriority = mainVcam.GetComponent <CinemachineFreeLook>().Priority;
 }
コード例 #9
0
 void Start()
 {
     // Tell the camera to follow the player once the player exists (it will be instantiated by FPECore)
     cameraToTrigger.GetComponent <CinemachineVirtualCamera>().LookAt = FPEPlayer.Instance.gameObject.transform;
     turnOffCamera();
 }