Beispiel #1
0
    public void PlayClip(SfxGroup group)
    {
        var source = Pool.Grab();

        source.clip   = group.GetClip();
        source.volume = UnityEngine.Random.Range(group.VolumeRange.x, group.VolumeRange.y);
        source.pitch  = UnityEngine.Random.Range(group.PitchRange.x, group.PitchRange.y);
        source.loop   = false;

        var animator = new AudioSourceAnimator(source, TabFade, MasterVolume, SfxVolume);

        Animators.Add(animator);

        source.Play();
        StartCoroutine(ReturnToPool(animator));
    }