Commit 70efe1e5 authored by 18신대성's avatar 18신대성

Merge branch 'camera' into polish

# Conflicts:
#	Assets/Resources/stages/stage6_5.json.meta
parents af1ed246 7a376bb2
......@@ -13,10 +13,11 @@ public class CameraController : MonoBehaviour
Vector3 previousPos;
Vector3 previousAngle;
float shootingFov = 60f;
float mapFov = 20f;
float mapFov = 0;
float rotationX = 0;
float rotationY = 0;
float sensitivity = 1;
float sensitivity = 5;
public float minFOV, maxFOV;
[SerializeField]
public Vector3 centerPos = new Vector3(-0.5f, 0, -0.5f);
......@@ -73,6 +74,16 @@ public class CameraController : MonoBehaviour
transform.eulerAngles = new Vector3(30, transform.eulerAngles.y, transform.eulerAngles.z);
}
/// <summary>
/// Zoom in / out camera with mouse scroll.
/// </summary>
void CameraScroll()
{
float scroll = Input.GetAxis("Mouse ScrollWheel") * sensitivity;
if (Camera.main.fieldOfView >= maxFOV && scroll < 0) Camera.main.fieldOfView = maxFOV;
else if (Camera.main.fieldOfView <= minFOV && scroll > 0) Camera.main.fieldOfView = minFOV;
else Camera.main.fieldOfView -= scroll;
}
/// <summary>
/// Zoom in at player.
/// </summary>
/// <param name="player">Player to be zoomed in.</param>
......@@ -175,8 +186,10 @@ public class CameraController : MonoBehaviour
{
if (!GameManager.inst.isPlayerShooting)
{
mapFov = Camera.main.fieldOfView;
CameraMove();
CameraDrag();
CameraScroll();
}
else if (!GameManager.inst.isGameOver)
{
......
......@@ -93,7 +93,10 @@ public class MapManager : SingletonBehaviour<MapManager>
}
Camera.main.GetComponent<CameraController>().centerPos =
new Vector3((float)(currentMap.maxBorder.x + currentMap.minBorder.x) / 2, 0, (float)(currentMap.maxBorder.y + currentMap.minBorder.y) / 2);
Debug.Log(new Vector3((float)(currentMap.maxBorder.x + currentMap.minBorder.x) / 2, 0, (float)(currentMap.maxBorder.y + currentMap.minBorder.y) / 2));
float fov = (Mathf.Max(currentMap.maxBorder.x - currentMap.minBorder.x, currentMap.maxBorder.y - currentMap.minBorder.y) + 1) + 10;
Camera.main.fieldOfView = fov;
Camera.main.GetComponent<CameraController>().minFOV = fov * 0.7f;
Camera.main.GetComponent<CameraController>().maxFOV = fov * 1.5f;
}
public IEnumerator Rebaker()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment