Exemple #1
0
    private IEnumerator WaitUntilDialougeIsDoneToZoomOut()
    {
        while (dialougeManager.CheckInDialouge())
        {
            yield return(new WaitForEndOfFrame());
        }

        Vector3 cameraZoomLerp;
        float   lerpStep = 0.1f;

        while (mainCamera.orthographicSize < cameraPositionAndSizeBeforeDialouge.z)
        {
            Debug.Log("Zooming");
            cameraZoomLerp = Vector3.Lerp(newCameraPositionAndSizeDuringDialouge, cameraPositionAndSizeBeforeDialouge, lerpStep);

            //mainCamera.transform.position = Vector3.Lerp(mainCamera.transform.position, newCameraTransform.position, Time.deltaTime * zoomSpeed);

            mainCamera.transform.position = new Vector3(cameraZoomLerp.x, cameraZoomLerp.y, mainCamera.transform.position.z);
            mainCamera.orthographicSize   = cameraZoomLerp.z;

            lerpStep += zoomSpeed * Time.deltaTime;

            yield return(new WaitForEndOfFrame());
        }

        yield return(null);
    }
Exemple #2
0
 private void Update()
 {
     xDistance = Mathf.Abs(transform.position.x - player.transform.position.x);
     yDistance = Mathf.Abs(transform.position.y - player.transform.position.y);
     if (xDistance < xDistanceBeforeDialogeCanBeActive && yDistance < yDistanceBeforeDialogeCanBeActive)
     {
         if (!dialougeManager.CheckInDialouge())
         {
             interactObject.SetActive(true);
         }
         else
         {
             interactObject.SetActive(false);
         }
         if (player.activeMiscCommand == PlayerController.PlayerMiscCommands.Dialouge && player.readCurrentPlayerState().GetType() == new PlayerIdleState().GetType())
         {
             StartDialouge();
         }
     }
     else
     {
         interactObject.SetActive(false);
     }
 }