public PureDataContainerItemInternal GetSwitchItem(PureDataContainer container, List <int> childrenIds, object source) { PureDataContainerItemInternal switchAudioItem = new PureDataContainerItemInternal(container.Name, pureData); int stateIndex = int.MinValue; PureDataSubContainer[] childrenSubContainers = container.IdsToSubContainers(childrenIds); if (childrenSubContainers[0].parentId == 0) { stateIndex = container.switchSettings.GetCurrentStateIndex(); } else { PureDataSubContainer parentSubContainer = container.GetSubContainerWithID(childrenSubContainers[0].parentId); stateIndex = parentSubContainer.switchSettings.GetCurrentStateIndex(); } if (stateIndex != int.MinValue) { foreach (PureDataSubContainer childSubContainer in childrenSubContainers) { if (childSubContainer.switchSettings.stateIndex == stateIndex) { PureDataSourceOrContainerItem childAudioItem = GetSubContainerItem(container, childSubContainer, source); if (childAudioItem != null) { switchAudioItem.AddItem(childAudioItem); } } } } return(switchAudioItem); }
public PureDataContainerItemInternal GetRandomItem(PureDataContainer container, List <int> childrenIds, object source) { PureDataContainerItemInternal randomAudioItem = new PureDataContainerItemInternal(container.Name, pureData); List <PureDataSubContainer> childcontainers = new List <PureDataSubContainer>(); List <float> weights = new List <float>(); for (int i = 0; i < childrenIds.Count; i++) { PureDataSubContainer childContainer = container.GetSubContainerWithID(childrenIds[i]); if (childContainer != null) { childcontainers.Add(childContainer); weights.Add(childContainer.weight); } } PureDataSubContainer randomChildContainer = HelperFunctions.WeightedRandom(childcontainers, weights); if (randomAudioItem != null) { PureDataSourceOrContainerItem childAudioItem = GetSubContainerItem(container, randomChildContainer, source); if (childAudioItem != null) { randomAudioItem.AddItem(childAudioItem); } } return(randomAudioItem); }
public PureDataContainerItem PlayContainer(string containerName, object source, float delay, params PureDataOption[] options) { PureDataContainerItemInternal item = GetContainerItem(containerName, source); item.ApplyOptions(options); item.Play(delay); return(item); }
public PureDataContainerItemInternal GetMixItem(PureDataContainer container, List <int> childrenIds, object source) { PureDataContainerItemInternal mixAudioItem = new PureDataContainerItemInternal(container.Name, pureData); foreach (int childrenId in childrenIds) { PureDataSourceOrContainerItem childItem = GetSubContainerItem(container, container.GetSubContainerWithID(childrenId), source); if (childItem != null) { mixAudioItem.AddItem(childItem); } } return(mixAudioItem); }
public PureDataContainerItemInternal GetContainerItem(PureDataContainer container, PureDataSubContainer subContainer, object source) { PureDataContainerItemInternal multipleAudioItem = null; switch (subContainer.type) { case PureDataSubContainer.Types.RandomContainer: multipleAudioItem = GetRandomItem(container, subContainer.childrenIds, source); break; case PureDataSubContainer.Types.SwitchContainer: multipleAudioItem = GetSwitchItem(container, subContainer.childrenIds, source); break; default: multipleAudioItem = GetMixItem(container, subContainer.childrenIds, source); break; } return(multipleAudioItem); }
public PureDataContainerItemInternal GetSwitchItem(PureDataContainer container, List<int> childrenIds, object source) { PureDataContainerItemInternal switchAudioItem = new PureDataContainerItemInternal(container.Name, pureData); int stateIndex = int.MinValue; PureDataSubContainer[] childrenSubContainers = container.IdsToSubContainers(childrenIds); if (childrenSubContainers[0].parentId == 0) { stateIndex = container.switchSettings.GetCurrentStateIndex(); } else { PureDataSubContainer parentSubContainer = container.GetSubContainerWithID(childrenSubContainers[0].parentId); stateIndex = parentSubContainer.switchSettings.GetCurrentStateIndex(); } if (stateIndex != int.MinValue) { foreach (PureDataSubContainer childSubContainer in childrenSubContainers) { if (childSubContainer.switchSettings.stateIndex == stateIndex) { PureDataSourceOrContainerItem childAudioItem = GetSubContainerItem(container, childSubContainer, source); if (childAudioItem != null) { switchAudioItem.AddItem(childAudioItem); } } } } return switchAudioItem; }
public PureDataContainerItemInternal GetRandomItem(PureDataContainer container, List<int> childrenIds, object source) { PureDataContainerItemInternal randomAudioItem = new PureDataContainerItemInternal(container.Name, pureData); List<PureDataSubContainer> childcontainers = new List<PureDataSubContainer>(); List<float> weights = new List<float>(); for (int i = 0; i < childrenIds.Count; i++) { PureDataSubContainer childContainer = container.GetSubContainerWithID(childrenIds[i]); if (childContainer != null) { childcontainers.Add(childContainer); weights.Add(childContainer.weight); } } PureDataSubContainer randomChildContainer = HelperFunctions.WeightedRandom(childcontainers, weights); if (randomAudioItem != null) { PureDataSourceOrContainerItem childAudioItem = GetSubContainerItem(container, randomChildContainer, source); if (childAudioItem != null) { randomAudioItem.AddItem(childAudioItem); } } return randomAudioItem; }
public PureDataContainerItemInternal GetMixItem(PureDataContainer container, List<int> childrenIds, object source) { PureDataContainerItemInternal mixAudioItem = new PureDataContainerItemInternal(container.Name, pureData); foreach (int childrenId in childrenIds) { PureDataSourceOrContainerItem childItem = GetSubContainerItem(container, container.GetSubContainerWithID(childrenId), source); if (childItem != null) { mixAudioItem.AddItem(childItem); } } return mixAudioItem; }