Esempio n. 1
0
    public static List <T> Scrambled <T>(this IEnumerable <T> collection)
    {
        var olist   = new List <T>(collection);
        var retList = new List <T>();

        while (olist.Count > 0)
        {
            var id      = K10Random.Less(olist.Count);
            var element = olist[id];
            retList.Add(element);
            olist.RemoveAt(id);
        }

        return(retList);
    }
Esempio n. 2
0
    public void SetConfiguration(AudioSource source)
    {
        source.volume                = _volume;
        source.pitch                 = K10Random.FloatInterval(_minPitch, _maxPitch);
        source.panStereo             = _pan;
        source.outputAudioMixerGroup = _group;
        source.spatialBlend          = _spatialBlend;
        source.minDistance           = _minDistance;
        source.maxDistance           = _maxDistance;
        source.dopplerLevel          = _dopplerLevel;
        source.spread                = _spread;
        source.rolloffMode           = _rolloff;

        if (_rolloff == AudioRolloffMode.Custom)
        {
            var curve  = new AnimationCurve();
            var nTime  = MinDistance / MaxDistance;
            var outTan = -3 / (1 - nTime);
            curve.AddKey(new Keyframe(nTime, 1, 0, outTan));
            curve.AddKey(new Keyframe(1, 0, 0, 0));
            source.SetCustomCurve(AudioSourceCurveType.CustomRolloff, curve);
        }
    }
Esempio n. 3
0
 public static int Interval(int min, int exclusiveMax)
 {
     return(K10Random.Less(exclusiveMax - min) + min);
 }