Newer
Older
CGTrack / Assets / Oculus / SampleFramework / Core / DistanceGrab / Scripts / PauseOnInputLoss.cs
/************************************************************************************

Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.  

See SampleFramework license.txt for license terms.  Unless required by applicable law 
or agreed to in writing, the sample code is provided “AS IS” WITHOUT WARRANTIES OR 
CONDITIONS OF ANY KIND, either express or implied.  See the license for specific 
language governing permissions and limitations under the license.

************************************************************************************/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace OculusSampleFramework
{
    public class PauseOnInputLoss : MonoBehaviour
    {
        void Start()
        {
            OVRManager.InputFocusAcquired += OnInputFocusAcquired;
            OVRManager.InputFocusLost += OnInputFocusLost;
        }

        private void OnInputFocusLost()
        {
            Time.timeScale = 0.0f;
        }

        private void OnInputFocusAcquired()
        {
            Time.timeScale = 1.0f;
        }
    }
}