using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour, ICounterReceiver
{
Camera cam;
Dictionary
<int,
float> camSizeMap
= new Dictionary
<int,
float>() { {0, 5.0f},
{25, 7.0f},
{50, 8.0f},
{100, 12.0f},
{200, 15.0f},
{300, 17.0f},
{400, 18.5f},
{500, 20.0f},
{600, 22.0f},
{700, 24.0f},
{800, 26.0f},
{900, 28.0f},
{1000, 30.0f},
{1100, 32.0f},
{1200, 34.0f},
};
float prevsize;
void Start()
{
cam = gameObject.GetComponent<Camera>();
prevsize = 0;
}
public void UpdateCounter(int count) {
float targetSize = 0;
foreach(KeyValuePair<int, float> pair in camSizeMap) {
if (count < pair.Key) {
break;
}
targetSize = pair.Value;
}
if (prevsize != targetSize) {
cam.orthographicSize = targetSize;
prevsize = targetSize;
}
}
}