ShowPhaseNotificationObject.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class ShowPhaseNotificationObject : MonoBehaviour
  6. {
  7. public Text PhaseText;
  8. public bool isClose { get; set; }
  9. public void Init()
  10. {
  11. Off();
  12. }
  13. public void ShowPhase(GameContext.phase phase)
  14. {
  15. switch(phase)
  16. {
  17. case GameContext.phase.Breeding:
  18. PhaseText.text = "Breeding Phase";
  19. break;
  20. case GameContext.phase.Main:
  21. PhaseText.text = "Main Phase";
  22. break;
  23. }
  24. isClose = false;
  25. this.gameObject.SetActive(true);
  26. StartCoroutine(CloseCoroutine());
  27. }
  28. IEnumerator CloseCoroutine()
  29. {
  30. GManager.instance.turnStateMachine.IsSelecting = true;
  31. GetComponent<Animator>().SetInteger("Close", 0);
  32. yield return new WaitForSeconds(0.3f);
  33. GetComponent<Animator>().SetInteger("Close", 1);
  34. GManager.instance.turnStateMachine.IsSelecting = false;
  35. }
  36. public void Off()
  37. {
  38. this.gameObject.SetActive(false);
  39. isClose = true;
  40. }
  41. }