2019-08-07 20:03:51 +02:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2019-08-14 16:17:48 +02:00
|
|
|
|
namespace Saltosion.OneWeapon.Utils {
|
2019-08-07 20:03:51 +02:00
|
|
|
|
public class CameraHelper : MonoBehaviour {
|
2019-08-07 21:03:03 +02:00
|
|
|
|
public Camera Camera;
|
|
|
|
|
[Range(1, 4)]
|
|
|
|
|
public int PixelScale = 2;
|
|
|
|
|
public int PixelsPerUnit = 32;
|
|
|
|
|
|
|
|
|
|
private int LastHeight = -1;
|
2019-08-07 20:03:51 +02:00
|
|
|
|
|
|
|
|
|
private void Update() {
|
2019-08-07 21:03:03 +02:00
|
|
|
|
if (LastHeight != Screen.height) {
|
|
|
|
|
Camera.orthographicSize = Screen.height * ((0.5f / PixelsPerUnit) / PixelScale);
|
|
|
|
|
LastHeight = Screen.height;
|
|
|
|
|
}
|
2019-08-07 20:03:51 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|