TimerDisplay.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * Licensed under the Oculus SDK License Agreement (the "License");
  6. * you may not use the Oculus SDK except in compliance with the License,
  7. * which is provided at the time of installation or download, or which
  8. * otherwise accompanies this software in either electronic or hard copy form.
  9. *
  10. * You may obtain a copy of the License at
  11. *
  12. * https://developer.oculus.com/licenses/oculussdk/
  13. *
  14. * Unless required by applicable law or agreed to in writing, the Oculus SDK
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. using UnityEngine;
  21. using UnityEngine.UI;
  22. namespace Oculus.Voice.Demo.BuiltInDemo
  23. {
  24. public class TimerDisplay : MonoBehaviour
  25. {
  26. public TimerController timer;
  27. private Text _uiText;
  28. // Start is called before the first frame update
  29. void Start()
  30. {
  31. _uiText = GetComponent<Text>();
  32. }
  33. // Update is called once per frame
  34. void Update()
  35. {
  36. // Note: This is not optimized and you should avoid updating time each frame.
  37. _uiText.text = timer.GetFormattedTimeFromSeconds();
  38. }
  39. }
  40. }