Exemplo n.º 1
0
    public AudioClip GetSound(string clipName, Lugus.LugusResourceCollectionType collectionType)
    {
        if (clipDictionary.ContainsKey(clipName))
        {
            return(clipDictionary[clipName]);
        }

        ILugusResourceCollection collection = LugusResources.use.GetCollectionOfType(collectionType);

        if (collection == null)
        {
            Debug.LogError("SoundManager: No collection found. Aborting.");
            return(null);
        }

        AudioClip newClip = null;

        newClip = collection.GetAudio(clipName);

        if (newClip == LugusResources.use.errorAudio)
        {
            Debug.LogError("SoundManager: No sound found with the name: " + clipName);
            return(null);
        }
        else
        {
            clipDictionary.Add(clipName, newClip);
            return(newClip);
        }
    }
 public ILugusResourceCollection GetCollectionOfType(Lugus.LugusResourceCollectionType type)
 {
     if (type == Lugus.LugusResourceCollectionType.None)
     {
         Debug.LogError("LugusResourcesDefault: Resource collection type was None!");
         return(null);
     }
     else if (type == Lugus.LugusResourceCollectionType.Shared)
     {
         return(Shared);
     }
     else if (type == Lugus.LugusResourceCollectionType.Localized)
     {
         return(Localized);
     }
     else
     {
         Debug.LogError("LugusResourcesDefault: Resource collection type was not recognized: " + type.ToString());
         return(null);
     }
 }