Esempio n. 1
0
 protected override void SetReferences()
 {
     if (SingletonUtil.TryInit(ref Instance, this, gameObject))
     {
         base.SetReferences();
     }
 }
 // Must be colled to setup the class's functionality
 void Init()
 {
     // Singleton method returns a bool depending on whether this object is the instance of the class
     if (SingletonUtil.TryInit(ref Instance, this, gameObject, true))
     {
         loader   = new AudioLoader(path);
         fileList = loader.Load();
         if (!fileList.AreEventsSubscribed)
         {
             fileList.SubscribeEvents();
         }
         fileList.PopulateGroups();
         InitFileDictionary(fileList);
         AddAudioEvents();
         SubscribeEvents();
         if (isAudioListener)
         {
             AddAudioListener();
         }
         PreloadFiles(fileList.Files);
         // TODO: Enable after tracks have been delivered
         // initCyclingAudio();
         if (playMusicOnInit)
         {
             playMainMusic();
         }
     }
 }
Esempio n. 3
0
 // Must be colled to setup the class's functionality
 void init()
 {
     // Singleton method returns a bool depending on whether this object is the instance of the class
     if (SingletonUtil.TryInit(ref _instance, this, gameObject, true))
     {
         if (useCustomPaths)
         {
             loader = new AudioLoader(customJSONPath, customAudioPath);
         }
         else
         {
             loader = AudioLoader.Default;
         }
         fileList = loader.Load();
         if (!fileList.AreEventsSubscribed)
         {
             fileList.SubscribeEvents();
         }
         fileList.PopulateGroups();
         initFileDictionary(fileList);
         addAudioEvents();
         subscribeEvents();
         if (isAudioListener)
         {
             addAudioListener();
         }
         preloadFiles(fileList.Files);
         if (playMusicOnInit)
         {
             playMainMusic();
         }
     }
 }
Esempio n. 4
0
    protected override void SetReferences()
    {
        bool shouldInitialize = true;

        if (IsSingleton && !SingletonUtil.TryInit(ref Instance, this, gameObject))
        {
            shouldInitialize = false;
        }
        if (shouldInitialize)
        {
            createAgents();
            createGrid(agents);
        }
    }