fork download
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. [RequireComponent(typeof(WeatherManager))]
  6. [RequireComponent(typeof(ImagesManager))]
  7.  
  8. public class Managers : MonoBehaviour
  9. {
  10. public static WeatherManager Weather
  11. {
  12. get;
  13.  
  14. private set;
  15. }
  16.  
  17. public static ImagesManager Images
  18. {
  19. get;
  20.  
  21. private set;
  22. }
  23.  
  24. private List<IGameManager> _startSequence;
  25.  
  26. void Awake()
  27. {
  28. Weather = GetComponent<WeatherManager>();
  29. Images = GetComponent<ImagesManager>();
  30.  
  31. _startSequence = new List<IGameManager>();
  32. _startSequence.Add(Weather);
  33. _startSequence.Add(Images);
  34.  
  35. StartCoroutine(StartupManagers());
  36. }
  37.  
  38. private IEnumerator StartupManagers()
  39. {
  40. NetworkService network = new NetworkService();
  41.  
  42. foreach(IGameManager manager in _startSequence)
  43. {
  44. manager.Startup(network);
  45. }
  46.  
  47. yield return null;
  48.  
  49. int numModules = _startSequence.Count;
  50. int numReady = 0;
  51.  
  52. while(numReady < numModules)
  53. {
  54. int lastReady = numReady;
  55.  
  56. numReady = 0;
  57.  
  58. foreach(IGameManager manager in _startSequence)
  59. {
  60. if(manager.status == ManagerStatus.Started)
  61. {
  62. numReady++;
  63. }
  64. }
  65.  
  66. if(numReady > lastReady)
  67. {
  68. Debug.Log("Progress: " + numReady + "/" + numModules);
  69. }
  70.  
  71. yield return null;
  72. }
  73.  
  74. Debug.Log("All managers started up.");
  75. }
  76.  
  77. // Use this for initialization
  78. void Start ()
  79. {
  80.  
  81. }
  82.  
  83. // Update is called once per frame
  84. void Update ()
  85. {
  86.  
  87. }
  88. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(3,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(8,25): error CS0246: The type or namespace name `MonoBehaviour' could not be found. Are you missing an assembly reference?
prog.cs(10,19): error CS0246: The type or namespace name `WeatherManager' could not be found. Are you missing an assembly reference?
prog.cs(17,19): error CS0246: The type or namespace name `ImagesManager' could not be found. Are you missing an assembly reference?
prog.cs(24,18): error CS0246: The type or namespace name `IGameManager' could not be found. Are you missing an assembly reference?
Compilation failed: 5 error(s), 0 warnings
stdout
Standard output is empty