Ejemplo n.º 1
0
 public AudioSubItem(AudioSubItem orig, AudioItem item)
 {
     SubItemType = orig.SubItemType;
     if (SubItemType == AudioSubItemType.Clip)
     {
         Clip = orig.Clip;
     }
     else if (SubItemType == AudioSubItemType.Item)
     {
         ItemModeAudioID = orig.ItemModeAudioID;
     }
     Probability          = orig.Probability;
     DisableOtherSubitems = orig.DisableOtherSubitems;
     Clip                = orig.Clip;
     Volume              = orig.Volume;
     PitchShift          = orig.PitchShift;
     Pan2D               = orig.Pan2D;
     Delay               = orig.Delay;
     RandomPitch         = orig.RandomPitch;
     RandomVolume        = orig.RandomVolume;
     RandomDelay         = orig.RandomDelay;
     ClipStopTime        = orig.ClipStopTime;
     ClipStartTime       = orig.ClipStartTime;
     FadeIn              = orig.FadeIn;
     FadeOut             = orig.FadeOut;
     RandomStartPosition = orig.RandomStartPosition;
     for (var index = 0; index < orig.IndividualSettings.Count; ++index)
     {
         IndividualSettings.Add(orig.IndividualSettings[index]);
     }
     Item = item;
 }
Ejemplo n.º 2
0
        private static bool _IsValidSubItem(AudioSubItem item)
        {
            switch (item.SubItemType)
            {
            case AudioSubItemType.Clip:
                return(item.Clip != null);

            case AudioSubItemType.Item:
                if (item.ItemModeAudioID != null)
                {
                    return(item.ItemModeAudioID.Length > 0);
                }
                return(false);

            default:
                return(false);
            }
        }
Ejemplo n.º 3
0
        private static AudioSubItem[] _ChooseSubItems(AudioItem audioItem, AudioPickSubItemMode pickMode, AudioObject useExistingAudioObj)
        {
            if (audioItem.SubItems == null)
            {
                return(null);
            }
            var length = audioItem.SubItems.Length;

            if (length == 0)
            {
                return(null);
            }
            var index1     = 0;
            var flag       = useExistingAudioObj != null;
            var lastChosen = !flag ? audioItem.LastChosen : useExistingAudioObj.LastChosenSubItemIndex;

            if (length > 1)
            {
                switch (pickMode)
                {
                case AudioPickSubItemMode.Disabled:
                    return(null);

                case AudioPickSubItemMode.Random:
                    index1 = _ChooseRandomSubitem(audioItem, true, lastChosen);
                    break;

                case AudioPickSubItemMode.RandomNotSameTwice:
                    index1 = _ChooseRandomSubitem(audioItem, false, lastChosen);
                    break;

                case AudioPickSubItemMode.Sequence:
                    index1 = (lastChosen + 1) % length;
                    break;

                case AudioPickSubItemMode.SequenceWithRandomStart:
                    index1 = lastChosen != -1 ? (lastChosen + 1) % length : Random.Range(0, length);
                    break;

                case AudioPickSubItemMode.AllSimultaneously:
                    var audioSubItemArray = new AudioSubItem[length];
                    for (var index2 = 0; index2 < length; ++index2)
                    {
                        audioSubItemArray[index2] = audioItem.SubItems[index2];
                    }
                    return(audioSubItemArray);

                case AudioPickSubItemMode.TwoSimultaneously:
                    return(new[]
                    {
                        _ChooseSingleSubItem(audioItem, AudioPickSubItemMode.RandomNotSameTwice, useExistingAudioObj),
                        _ChooseSingleSubItem(audioItem, AudioPickSubItemMode.RandomNotSameTwice, useExistingAudioObj)
                    });

                case AudioPickSubItemMode.StartLoopSequenceWithFirst:
                    index1 = !flag ? 0 : (lastChosen + 1) % length;
                    break;

                case AudioPickSubItemMode.RandomNotSameTwiceOddsEvens:
                    index1 = _ChooseRandomSubitem(audioItem, false, lastChosen, true);
                    break;
                }
            }
            if (flag)
            {
                useExistingAudioObj.LastChosenSubItemIndex = index1;
            }
            else
            {
                audioItem.LastChosen = index1;
            }
            return(new[] { audioItem.SubItems[index1] });
        }