Example #1
0
 public override bool Remove(Attachment attachment)
 {
     if (attachment is AudioAttachment audioAttachment)
     {
         if (queue.Contains(audioAttachment.data))
         {
             while (queue.Count > 0)
             {
                 AudioAttachment.Data data = queue[queue.Count - 1];
                 queue.Remove(data);
                 if (data.Equals(audioAttachment.data))
                 {
                     break;
                 }
             }
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Example #2
0
 protected virtual void Update()
 {
     if (queue == null || queue.Count == 0)
     {
         source.clip = null;
         source.loop = false;
     }
     else
     {
         AudioAttachment.Data top = queue[queue.Count - 1];
         if (!top.Equals(current))
         {
             source.clip = top.clip;
             source.loop = top.loop;
             source.Play();
         }
         else
         {
             if (!source.isPlaying)
             {
                 queue.Remove(top);
             }
         }
         current = top;
     }
 }