Esempio n. 1
0
 private void CreateSingleton()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 2
0
 public static void Start(IReadOnlyList <IServices> newServices,
                          IReadOnlyList <IController> Controllers)
 {
     if (!IsApplicationStarted)
     {
         var dict = new Dictionary <Type, IController>(Controllers.Count);
         foreach (var item in Controllers)
         {
             dict.Add(item.GetType(), item);
         }
         allControllers = dict;
         for (int i = 0; i < newServices.Count; i++)
         {
             newServices[i].Init();
         }
         Services             = new ServicesHolder(newServices);
         IsApplicationStarted = true;
         ApplicationStartEvent?.Invoke();
     }
 }