예제 #1
0
    /// <summary>
    /// Saves the SFX to the SoundManager prefab for easy access for frequently used SFX.  Will register the SFX to the group specified.
    /// If the group doesn't exist, it will be added to SoundManager.
    public static void SaveSFX(AudioClip clip, SFXGroup grp)
    {
        if (clip == null)
        {
            return;
        }

        if (grp != null)
        {
            if (!Instance.groups.ContainsKey(grp.groupName))
            {
                Instance.groups.Add(grp.groupName, grp);
#if UNITY_EDITOR
                Instance.sfxGroups.Add(grp);
#endif
            }
            else if (Instance.groups[grp.groupName] != grp)
            {
                Debug.LogWarning("The SFXGroup, " + grp.groupName + ", already exists. This new group will not be added.");
            }
        }

        SaveSFX(clip);
        Instance.AddClipToGroup(clip.name, grp.groupName);
    }
예제 #2
0
    /////////////////////////////////////////////////////

    /// <summary>
    /// Saves the SFX to the SoundManager prefab for easy access for frequently used SFX.  Will register the SFX to the group.
    /// </summary>
    public static void SaveSFX(AudioClip clip, string grpName)
    {
        if (clip == null)
        {
            return;
        }

        SFXGroup grp = Instance.GetGroupByGroupName(grpName);

        if (grp == null)
        {
            Debug.LogWarning("The SFXGroup, " + grpName + ", does not exist. Creating it as a new group");
        }

        SaveSFX(clip);
        Instance.AddClipToGroup(clip.name, grpName);
    }