| 1 | /************************************************************************************ |
| 2 | Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved. |
| 3 | |
| 4 | Licensed under the Oculus Utilities SDK License Version 1.31 (the "License"); you may not use |
| 5 | the Utilities SDK except in compliance with the License, which is provided at the time of installation |
| 6 | or download, or which otherwise accompanies this software in either electronic or hard copy form. |
| 7 | |
| 8 | You may obtain a copy of the License at |
| 9 | https://developer.oculus.com/licenses/utilities-1.31 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, the Utilities SDK distributed |
| 12 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
| 13 | ANY KIND, either express or implied. See the License for the specific language governing |
| 14 | permissions and limitations under the License. |
| 15 | ************************************************************************************/ |
| 16 | |
| 17 | using UnityEngine; |
| 18 | using UnityEngine.UI; |
| 19 | using System.Collections; |
| 20 | |
| 21 | /// <summary> |
| 22 | /// Visualizes progress for operations such as loading. |
| 23 | /// </summary> |
| 24 | public class OVRProgressIndicator : MonoBehaviour |
| 25 | { |
| 26 | public MeshRenderer progressImage; |
| 27 | |
| 28 | [Range(0, 1)] |
| 29 | public float currentProgress = 0.7f; |
| 30 | |
| 31 | void Awake() |
| 32 | { |
| 33 | progressImage.sortingOrder = 150; |
| 34 | } |
| 35 | |
| 36 | |
| 37 | |
| 38 | // Update is called once per frame |
| 39 | void Update() |
| 40 | { |
| 41 | progressImage.sharedMaterial.SetFloat("_AlphaCutoff", 1-currentProgress); |
| 42 | |
| 43 | } |
| 44 | } |