namespace Monkey.Game
{

    public static class CameraManager
    {

        public static CameraMode CameraMode
        {
            get => _cameraMode;
            set => _cameraMode = value;
        }

        private static com.ootii.Input.UnityInputSource _unityInputSource;
        private static CameraMode _cameraMode;
        
        static CameraManager()
        {
            _unityInputSource = null;
            _cameraMode = CameraMode.Stiff;
        }

        public static void Update()
        {
            if ((_unityInputSource == null) && !SetUnityInputSource())
                return;

            switch (_cameraMode)
            {

                case CameraMode.Stiff:
                    _unityInputSource.ViewActivator = 2;

                    break;

                case CameraMode.Unlocked:
                    _unityInputSource.ViewActivator = 0;

                    break;

            }
        }

        private static bool SetUnityInputSource()
        {
            _unityInputSource = UnityEngine.GameObject.FindObjectOfType<com.ootii.Input.UnityInputSource>();

            return (_unityInputSource != null);
        }

    }

}
