MenuUI.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using UnityEngine;
  3. public class MenuUI : MonoBehaviour
  4. {
  5. [SerializeField] private GameObject menuUIWrapper;
  6. [SerializeField] private AudioSource startAudioSource;
  7. [SerializeField] private GameObject TutorialWrapper;
  8. private bool _isPressed;
  9. private void Awake()
  10. {
  11. if (PlayerPrefs.HasKey("Tutorial"))
  12. Destroy(TutorialWrapper);
  13. }
  14. public void ActivateMenu(bool status)
  15. {
  16. if (status)
  17. {
  18. startAudioSource.Play();
  19. if (ComponentsManager.Tutorial)
  20. {
  21. if (ComponentsManager.Tutorial.GetStep == 0)
  22. ComponentsManager.Tutorial.NextStep(1, true);
  23. }
  24. }
  25. menuUIWrapper.SetActive(status);
  26. }
  27. private void Update()
  28. {
  29. if (Input.GetKeyDown(KeyCode.E))
  30. {
  31. ComponentsManager.PlayerWallet.AddMoney(144);
  32. }
  33. }
  34. public void StartBattleButton()
  35. {
  36. ComponentsManager.BattleManager.StartBattle();
  37. ActivateMenu(false);
  38. if (!_isPressed)
  39. {
  40. _isPressed = true;
  41. }
  42. if (ComponentsManager.Tutorial)
  43. {
  44. if (ComponentsManager.Tutorial.GetStep == 0)
  45. ComponentsManager.Tutorial.NextStep(0, false);
  46. if (ComponentsManager.Tutorial.GetStep == 2)
  47. ComponentsManager.Tutorial.NextStep(2, false);
  48. if (ComponentsManager.Tutorial.GetStep == 4)
  49. ComponentsManager.Tutorial.NextStep(5, false);
  50. }
  51. }
  52. }