Example #1
0
        void Start()
        {
            SetVolumenGeneral(1);

            DontDestroyOnLoad(this);

            //Getting clip group index for easier use
            clipIndex = new int[groupSizes.Length];
            int counter = 0;

            for (int i = 0; i < groupSizes.Length; i++)
            {
                clipIndex[i] = counter;
                counter     += groupSizes[i];
            }
            //Setting cam if not publicly set
            if (!cam)
            {
                cam = Camera.main;
            }
            //Making sure audio dad is set up correctly
            if (!audioDad.GetComponent <AudioDad>())
            {
                audioDad.AddComponent <AudioDad>();
            }
            //Making pools and prespawning
            PoolManager.MakePool(audioDad);
            PoolManager.SetPoolLimit(audioDad, clips.Length * 50);
            PoolManager.PreSpawn(audioDad, clips.Length * 6, false);
        }
        void Start()
        {
            for (int i = 0; i < clips.Length; i++)
            {
                GameObject temp = new GameObject();

                temp.AddComponent <AudioSource>();
                temp.GetComponent <AudioSource>().clip = clips[i];
                temp.AddComponent <DefaultSound>();
                temp.GetComponent <DefaultSound>().dj = temp.GetComponent <AudioSource>();
                temp.name = "soundMaker" + i.ToString();
                sounds.Add(temp);
                PoolManager.PreSpawn(sounds[i], (int)Mathf.Round(maxSimultaneousClip[i] / 2));
                PoolManager.SetPoolLimit(sounds[i], maxSimultaneousClip[i]);
            }
            print("audio manager start ended");
        }