Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update() { //paste it in your Update method
- if (Input.GetKeyCode(KeyCode.Z)) {
- StartCoroutine(WaitThenCallThisConstantly(0.0005f,0.0075f,counter,maxTimes));
- }
- }
- IEnumerator WaitThenCallThisConstantly(float time,float smoothTime,int counter,int maxTimes) {
- yield return new WaitForSeconds (time);
- float zoom = 4.25f; float smooth = 5.0f;
- float normal = 4.95f; //increase this to a bigger value to zoom out even more
- counter++;
- if (counter < maxTimes) {
- mainCamera.orthographicSize = Mathf.Lerp(mainCamera.orthographicSize,normal,Time.deltaTime * (counter/2.0f) *smooth);
- StartCoroutine(WaitThenCallThisConstantly(time,smoothTime,counter,maxTimes));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement