summaryrefslogtreecommitdiff
path: root/GameCode/CameraZoomHandler.cs
blob: 56c8b86aa2468e1fa0e338856bcf79012e3a8a79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using UnityEngine;

public class CameraZoomHandler : MonoBehaviour
{
	private Camera[] cameras;

	private void Start()
	{
		cameras = GetComponentsInChildren<Camera>();
	}

	private void Update()
	{
		float b = 20f;
		if (MapManager.instance.currentMap != null)
		{
			b = MapManager.instance.currentMap.Map.size;
		}
		for (int i = 0; i < cameras.Length; i++)
		{
			cameras[i].orthographicSize = Mathf.Lerp(cameras[i].orthographicSize, b, Time.unscaledDeltaTime * 5f);
		}
	}
}