@@ -18,10 +18,10 @@ namespace Camera
|
||||
{
|
||||
var mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
|
||||
var mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
|
||||
|
||||
|
||||
_xRotation -= mouseY;
|
||||
_xRotation = Mathf.Clamp(_xRotation, -90f, 90f);
|
||||
|
||||
|
||||
transform.localRotation = Quaternion.Euler(_xRotation, 0f, 0f);
|
||||
playerBody.Rotate(Vector3.up * mouseX);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Camera
|
||||
{
|
||||
[SerializeField] private int maxInterActDistance = 10;
|
||||
[SerializeField] private GameObject target;
|
||||
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Camera
|
||||
{
|
||||
private UnityEngine.Camera _camera;
|
||||
private PostProcessVolume _processVolume;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_camera = GetComponent<UnityEngine.Camera>();
|
||||
@@ -23,12 +24,14 @@ namespace Camera
|
||||
private void PostProcess()
|
||||
{
|
||||
_camera.fieldOfView = Mathf.Lerp(_camera.fieldOfView, 90f, Time.deltaTime * 10f);
|
||||
_processVolume.profile.GetSetting<ChromaticAberration>().intensity.value = Mathf.Lerp(_processVolume.profile.GetSetting<ChromaticAberration>().intensity.value, 1f, Time.deltaTime * 10f);
|
||||
_processVolume.profile.GetSetting<ChromaticAberration>().intensity.value = Mathf.Lerp(
|
||||
_processVolume.profile.GetSetting<ChromaticAberration>().intensity.value, 1f, Time.deltaTime * 10f);
|
||||
}
|
||||
|
||||
private void ProcessingStop()
|
||||
{
|
||||
_processVolume.profile.GetSetting<ChromaticAberration>().intensity.value = Mathf.Lerp(_processVolume.profile.GetSetting<ChromaticAberration>().intensity.value, 0f, Time.deltaTime * 10f);
|
||||
_processVolume.profile.GetSetting<ChromaticAberration>().intensity.value = Mathf.Lerp(
|
||||
_processVolume.profile.GetSetting<ChromaticAberration>().intensity.value, 0f, Time.deltaTime * 10f);
|
||||
_camera.fieldOfView = Mathf.Lerp(_camera.fieldOfView, 60f, Time.deltaTime * 10f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Camera
|
||||
private Vector3 _originalPos;
|
||||
private bool _isRunning;
|
||||
private bool _isWalking;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_originalPos = cameraTransform.localPosition;
|
||||
@@ -20,8 +21,8 @@ namespace Camera
|
||||
EventManager.Instance.PlayerWalking += OnPlayerWalking;
|
||||
EventManager.Instance.PlayerWalkStop += StopWalking;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void OnPlayerRunning()
|
||||
{
|
||||
_isRunning = true;
|
||||
@@ -31,7 +32,7 @@ namespace Camera
|
||||
{
|
||||
_isWalking = true;
|
||||
}
|
||||
|
||||
|
||||
private void StopRunning()
|
||||
{
|
||||
_isRunning = false;
|
||||
@@ -48,7 +49,7 @@ namespace Camera
|
||||
{
|
||||
var xShake = Mathf.Sin(Time.time * frequency) * amplitude;
|
||||
var yShake = Mathf.Cos(Time.time * frequency * 2) * amplitude * 0.5f;
|
||||
|
||||
|
||||
cameraTransform.localPosition = _originalPos + new Vector3(xShake, yShake, 0);
|
||||
}
|
||||
else
|
||||
@@ -57,12 +58,12 @@ namespace Camera
|
||||
{
|
||||
var xShake = Mathf.Sin(Time.time * frequency / 2) * amplitude;
|
||||
var yShake = Mathf.Cos(Time.time * frequency / 2 * 2) * amplitude * 0.5f;
|
||||
|
||||
|
||||
cameraTransform.localPosition = _originalPos + new Vector3(xShake, yShake, 0);
|
||||
}else
|
||||
}
|
||||
else
|
||||
cameraTransform.localPosition = _originalPos;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user