Skip to content

Commit d71db9f

Browse files
committed
Update 4
1 parent ece32b1 commit d71db9f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

CameraDistance.cs

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using UnityEngine;
2+
using Cinemachine;
3+
4+
public class CameraDistance : MonoBehaviour
5+
{
6+
CinemachineVirtualCamera cam;
7+
8+
void Start()
9+
{
10+
cam = GetComponent<CinemachineVirtualCamera>();
11+
}
12+
13+
void Camera(bool Zoom)
14+
{
15+
//Zoom by 100%
16+
if(Zoom)
17+
{
18+
CinemachineComponentBase componentBase = cam.GetCinemachineComponent(CinemachineCore.Stage.Body);
19+
if (componentBase is CinemachineFramingTransposer)
20+
{
21+
(componentBase as CinemachineFramingTransposer).m_CameraDistance = 10f;
22+
}
23+
}
24+
else
25+
{
26+
CinemachineComponentBase componentBase = cam.GetCinemachineComponent(CinemachineCore.Stage.Body);
27+
if (componentBase is CinemachineFramingTransposer)
28+
{
29+
(componentBase as CinemachineFramingTransposer).m_CameraDistance = 20f;
30+
}
31+
}
32+
}
33+
}

CameraShake.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ public void VignetteActivation(bool trigger)
3838
}
3939
}
4040

41-
41+
public void Zoom(bool trigger)
42+
{
43+
if(trigger)
44+
{
45+
cam.m_Lens.OrthographicSize = 17.5f;
46+
}
47+
else
48+
{
49+
cam.m_Lens.OrthographicSize = 14f;
50+
}
51+
}
4252

4353
private void Update()
4454
{

0 commit comments

Comments
 (0)