2021년 4학년 1학기 기업연계프로젝트2 컴퓨터소프트웨어공학과 <원광투어팀> 팀장 : 송유진 팀원 : 김나영, 이경희, 한유진
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

5 years ago
  1. using Unity.FPS.Game;
  2. using Unity.FPS.Gameplay;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace Unity.FPS.UI
  6. {
  7. public class JetpackCounter : MonoBehaviour
  8. {
  9. [Tooltip("Image component representing jetpack fuel")]
  10. public Image JetpackFillImage;
  11. [Tooltip("Canvas group that contains the whole UI for the jetack")]
  12. public CanvasGroup MainCanvasGroup;
  13. [Tooltip("Component to animate the color when empty or full")]
  14. public FillBarColorChange FillBarColorChange;
  15. Jetpack m_Jetpack;
  16. void Awake()
  17. {
  18. m_Jetpack = FindObjectOfType<Jetpack>();
  19. DebugUtility.HandleErrorIfNullFindObject<Jetpack, JetpackCounter>(m_Jetpack, this);
  20. FillBarColorChange.Initialize(1f, 0f);
  21. }
  22. void Update()
  23. {
  24. MainCanvasGroup.gameObject.SetActive(m_Jetpack.IsJetpackUnlocked);
  25. if (m_Jetpack.IsJetpackUnlocked)
  26. {
  27. JetpackFillImage.fillAmount = m_Jetpack.CurrentFillRatio;
  28. FillBarColorChange.UpdateVisual(m_Jetpack.CurrentFillRatio);
  29. }
  30. }
  31. }
  32. }