#if HAVE_SLATE
using System;
using UnityEngine;
using Slate;
using Framework.Services;
namespace Framework.Cameras {
///
/// Disables camera handling in the slate cutscene camera root
///
public class CameraRootDisabler : ScriptComponent {
///
/// Called once after the GameObject the script is attached to is created
///
protected override void Awake() {
base.Awake();
disableCameraRoot();
}
///
/// Called once before the script is updated for the first time
///
protected void Start() {
disableCameraRoot();
}
///
/// Disables all camera control options on Slate's director camera
///
private void disableCameraRoot() {
DirectorCamera cameraRoot = GetComponent();
if(cameraRoot == null) {
Debug.LogError(
"Could not locate DirectorCamera component. The CameraRootDisabler " +
"has to be added to the same game object as the DirectorCamera component!"
);
return;
}
DirectorCamera.setMainWhenActive = false;
DirectorCamera.matchMainWhenActive = false;
DirectorCamera.autoHandleActiveState = false;
DirectorCamera.dontDestroyOnLoad = false;
}
}
} // namespace Framework.Cameras
#endif // HAVE_SLATE