GameFlowState.cs 886 B

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. public static class GameFlowState
  3. {
  4. public static string ModeKey { get; private set; } = "";
  5. public static int Level { get; private set; }
  6. public static bool ReturningToLobby { get; private set; }
  7. [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
  8. static void ResetStatics()
  9. {
  10. ModeKey = "";
  11. Level = 0;
  12. ReturningToLobby = false;
  13. }
  14. public static void PrepareLaunch(string modeKey, int level)
  15. {
  16. ModeKey = modeKey;
  17. Level = Mathf.Clamp(level, 1, GameDefinitions.MaxLevel);
  18. ReturningToLobby = false;
  19. }
  20. public static void MarkReturningToLobby()
  21. {
  22. ReturningToLobby = true;
  23. }
  24. public static bool ConsumeReturningToLobby()
  25. {
  26. bool value = ReturningToLobby;
  27. ReturningToLobby = false;
  28. return value;
  29. }
  30. }