-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLAICameraManager.cs
90 lines (80 loc) · 2.93 KB
/
LAICameraManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using LobbyAppearanceImprovements.Layouts;
using RoR2;
using System.Collections.Generic;
using UnityEngine;
namespace LobbyAppearanceImprovements
{
internal static class LAICameraManager
{
public static Dictionary<string, LAILayout.CameraSetting> currentCameraSettings = new Dictionary<string, LAILayout.CameraSetting>();
//public static GameObject DefaultTextObject;
public static Methods.LAICameraController CurrentCameraController;
public static CameraRigController MainCameraRigController
{
get
{
if (!_mainCameraRigController)
_mainCameraRigController = GameObject.Find("Main Camera").GetComponent<CameraRigController>();
return _mainCameraRigController;
}
set
{
_mainCameraRigController = value;
}
}
private static CameraRigController _mainCameraRigController;
public static void Init()
{
On.RoR2.CameraRigController.Start += CameraRigController_Start;
}
public static void CameraRigController_Start(On.RoR2.CameraRigController.orig_Start orig, CameraRigController self)
{
orig(self);
var a = self.gameObject.AddComponent<CameraController>();
a.SetCam(self);
a.enabled = false;
}
public class CameraController : MonoBehaviour
{
public float fov = 60;
public float pitch = 0;
public float yaw = 0;
public bool restart = false;
public bool logit = false;
private CameraRigController cam;
public void SetCam(CameraRigController newCam)
{
cam = newCam;
}
public void FixedUpdate()
{
if (restart)
{
fov = 60;
pitch = 0;
yaw = 0;
restart = false;
return;
}
cam.baseFov = fov;
//camera rig controller gets cameramodecontext from itself
//
/*cam.GenerateCameraModeContext(out CameraModeBase.CameraModeContext cameraModeContext);
object rawInstanceData = cam.cameraMode.camToRawInstanceData[cameraModeContext.cameraInfo.cameraRigController];
((CameraModePlayerBasic.InstanceData)rawInstanceData).pitchYaw = new PitchYawPair()
{
pitch = pitch,
yaw = yaw
};
cam.cameraModeContext = cameraModeContext;*/
//cam.pitch = pitch;
//cam.yaw = yaw;
if (logit)
{
Debug.Log($"new CameraSetting( {fov}, {pitch}, {yaw} )");
logit = false;
}
}
}
}
}