コード例 #1
0
 public static void UpdateDirtyBusses(AudioBus bus)
 {
     if (bus.Dirty)
     {
         bus.RuntimeVolume = bus.RuntimeTargetVolume * bus.CombinedVolume;
         var nodes = bus.GetRuntimePlayers();
         for (int i = 0; i < nodes.Count; ++i)
         {
             if (nodes[i] != null)
             {
                 nodes[i].UpdateBusVolume(bus.RuntimeVolume);
             }
             else
             {
                 nodes.SwapRemoveAt(i);
             }
         }
     }
     for (int i = 0; i < bus.Children.Count; ++i)
     {
         if (bus.Dirty)
         {
             bus.Children[i].Dirty = true;
         }
         UpdateDirtyBusses(bus.Children[i]);
     }
 }
コード例 #2
0
    //TODO Move this to another class
    private static void StopAllNodeInBus(AudioBus bus)
    {
        var players = bus.GetRuntimePlayers();

        for (int i = 0; i < players.Count; i++)
        {
            players[i].Stop();
        }
        for (int i = 0; i < bus.Children.Count; i++)
        {
            StopAllNodeInBus(bus.Children[i]);
        }
    }