mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
Add option to disable camera
This commit is contained in:
parent
cdf12168c5
commit
47c7c5a694
2 changed files with 15 additions and 1 deletions
|
@ -69,12 +69,18 @@ namespace SanAndreasUnity.Settings {
|
|||
persistType = OptionsWindow.InputPersistType.OnStart
|
||||
};
|
||||
|
||||
OptionsWindow.BoolInput m_enableCamera = new OptionsWindow.BoolInput ("Enable camera") {
|
||||
getValue = () => Camera.main != null && Camera.main.enabled,
|
||||
setValue = (value) => { Camera cam = F.FindMainCameraEvenIfDisabled(); if (cam != null) cam.enabled = value; },
|
||||
persistType = OptionsWindow.InputPersistType.None,
|
||||
};
|
||||
|
||||
|
||||
|
||||
void Awake ()
|
||||
{
|
||||
var inputs = new OptionsWindow.Input[] { m_timeScaleInput, m_gravityInput, m_displayHealthBarsInput, m_displayMinimapInput,
|
||||
m_runInBackgroundInput, m_drawLineFromGunInput,
|
||||
m_runInBackgroundInput, m_drawLineFromGunInput, m_enableCamera,
|
||||
m_syncVehiclesLinearVelocity, m_syncVehiclesAngularVelocity, m_disableVehiclesRigidBodyOnClients,
|
||||
m_syncPedTransformWhileInVehicle,
|
||||
};
|
||||
|
|
|
@ -723,6 +723,14 @@ namespace SanAndreasUnity.Utilities
|
|||
return cam.ViewportPointToRay (viewportPos);
|
||||
}
|
||||
|
||||
public static Camera FindMainCameraEvenIfDisabled()
|
||||
{
|
||||
GameObject camObj = GameObject.FindGameObjectWithTag("MainCamera");
|
||||
if (camObj != null)
|
||||
return camObj.GetComponentInChildren<Camera>(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void GizmosDrawLineFromCamera ()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue