File tree 2 files changed +44
-1
lines changed
2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -38,7 +38,17 @@ public void VignetteActivation(bool trigger)
38
38
}
39
39
}
40
40
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
+ }
42
52
43
53
private void Update ( )
44
54
{
You can’t perform that action at this time.
0 commit comments