Exemple #1
0
    private void Start()
    {
        dc               = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <DynamicCamera3D>(); //find dynamic camera
        parentObj        = gameObject.GetComponentInParent <Transform>().gameObject;                        //find reference to parent
        dc.inInteraction = false;

        originalCameraRotation = dc.transform.rotation; // save the original position & rotation of the camera
        originalCameraPosition = dc.transform.position;

        // Depth of Field
        defaultDOFVal    = postProcProf.depthOfField.settings; // save previous setting
        dof              = defaultDOFVal;                      //set dof to default
        isFocusing       = false;
        hasExecutedFocus = false;
    }
    IEnumerator ZoomCameraOut()
    {
        float           timeElapsed = 0f;
        float           duration    = 0.4f;
        DynamicCamera3D dc          = GameObject.Find("DynamicCamera3D").GetComponent <DynamicCamera3D>();

        while (timeElapsed < duration)
        {
            timeElapsed   += Time.deltaTime;
            dc.scrollValue = -1.5f * Time.deltaTime;
            yield return(new WaitForSecondsRealtime(Time.deltaTime));
        }

        yield return(new WaitForSecondsRealtime(duration));

        dc.scrollValue = 0f;
    }
 // Start is called before the first frame update
 void Start()
 {
     //retrieve main camera
     gameCamera = GameObject.Find("DynamicCamera3D").GetComponent <DynamicCamera3D>();
 }