Exemplo n.º 1
0
    /// <summary>
    ///
    /// </summary>
    public SoundClip GetCopy(int index)
    {
        if (index < 0 || index >= this.soundClips.Length)
        {
            return(null);
        }
        SoundClip clip = new SoundClip();

        clip.realID       = index;
        clip.clipPath     = this.soundClips[index].clipPath;
        clip.clipName     = this.soundClips[index].clipName;
        clip.maxVolume    = this.soundClips[index].maxVolume;
        clip.pitch        = this.soundClips[index].pitch;
        clip.dopplerLevel = this.soundClips[index].dopplerLevel;
        clip.rollOffMode  = this.soundClips[index].rollOffMode;
        clip.minDistance  = this.soundClips[index].minDistance;
        clip.maxDistance  = this.soundClips[index].maxDistance;
        clip.spatialBlend = this.soundClips[index].spatialBlend;
        clip.isLoop       = this.soundClips[index].isLoop;
        clip.checkTime    = new float[this.soundClips[index].checkTime.Length];
        clip.setTime      = new float[this.soundClips[index].setTime.Length];
        clip.playType     = this.soundClips[index].playType;
        for (int i = 0; i < clip.checkTime.Length; i++)
        {
            clip.checkTime[i] = this.soundClips[index].checkTime[i];
            clip.setTime[i]   = this.soundClips[index].setTime[i];
        }
        clip.PreLoad();
        return(clip);
    }
Exemplo n.º 2
0
    public SoundClip GetCopy(int index)
    {
        if (index < 0 || index >= this.soundClips.Length)
        {
            return(null);
        }

        SoundClip newClip = new SoundClip();

        newClip.RealID           = index;
        newClip.ClipPath         = this.soundClips[index].ClipPath;
        newClip.ClipName         = this.soundClips[index].ClipName;
        newClip.MaxVolume        = this.soundClips[index].MaxVolume;
        newClip.Pitch            = this.soundClips[index].Pitch;
        newClip.DopplerLevel     = this.soundClips[index].DopplerLevel;
        newClip.audioRolloffMode = this.soundClips[index].audioRolloffMode;
        newClip.MinDistance      = this.soundClips[index].MinDistance;
        newClip.MaxDistance      = this.soundClips[index].MaxDistance;
        newClip.SpatialBlend     = this.soundClips[index].SpatialBlend;
        newClip.IsLoop           = this.soundClips[index].IsLoop;
        newClip.CheckTime        = new float[this.soundClips[index].CheckTime.Length];
        newClip.SetTime          = new float[this.soundClips[index].SetTime.Length];
        for (int i = 0; i < newClip.CheckTime.Length; i++)
        {
            newClip.CheckTime[i] = this.soundClips[index].CheckTime[i];
            newClip.SetTime[i]   = this.soundClips[index].SetTime[i];
        }
        newClip.PreLoad();
        return(newClip);
    }
Exemplo n.º 3
0
    public SoundClip GetCopy(int index)
    {
        if (index < 0 || index >= soundClips.Length)
        {
            return(null);
        }
        SoundClip clip     = new SoundClip();
        SoundClip original = soundClips[index];

        clip.realId       = index;
        clip.soundPath    = original.soundPath;
        clip.soundName    = original.soundName;
        clip.maxVolume    = original.maxVolume;
        clip.pitch        = original.pitch;
        clip.dopplerLevel = original.dopplerLevel;
        clip.rolloffMode  = original.rolloffMode;
        clip.minDistance  = original.minDistance;
        clip.maxDistance  = original.maxDistance;
        clip.spatialBlend = original.spatialBlend;
        clip.isLoop       = original.isLoop;
        clip.checkTime    = new float[original.checkTime.Length];
        clip.setTime      = new float[original.setTime.Length];
        clip.playType     = original.playType;
        for (int i = 0; i < clip.checkTime.Length; i++)
        {
            clip.checkTime[i] = original.checkTime[i];
            clip.setTime[i]   = original.setTime[i];
        }
        clip.PreLoad();
        return(clip);
    }
    /// <summary>
    /// 해당 index의 EffectClip을 복사해서 반환
    /// </summary>
    public SoundClip GetCopy(int index)
    {
        if (index < 0 || index >= this.soundClips.Length)
        {
            Debug.LogError("SoundData/GetCopy Out of index! index = " + index);
            return(null);
        }

        SoundClip original = this.soundClips[index];

        //deep copy
        SoundClip clip = new SoundClip();

        clip.realId       = index;
        clip.clipPath     = original.clipPath;
        clip.clipName     = original.clipName;
        clip.maxVolume    = original.maxVolume;
        clip.pitch        = original.pitch;
        clip.dopplerLevel = original.dopplerLevel;
        clip.rolloffMode  = original.rolloffMode;
        clip.minDistance  = original.minDistance;
        clip.maxDistance  = original.maxDistance;
        clip.spatialBlend = original.spatialBlend;
        clip.isLoop       = original.isLoop;
        clip.checkTime    = new float[original.checkTime.Length];
        clip.setTime      = new float[original.setTime.Length];
        for (int i = 0; i < clip.checkTime.Length; i++)
        {
            clip.checkTime[i] = original.checkTime[i];
            clip.setTime[i]   = clip.setTime[i];
        }
        clip.PreLoad();
        return(clip);
    }
Exemplo n.º 5
0
    /// <summary>
    /// 이펙트,UI 같은 일회성 사운드 재생.
    /// </summary>
    public void PlayOneShot(SoundClip m)
    {
        if (m == null)
        {
            Debug.LogWarning("[Failed] param is null!");
        }
        m.PreLoad();

        switch (m.playType)
        {
        case SoundPlayType.EFFECT:
            Play_EffectSound(m);
            break;

        case SoundPlayType.BGM:
            Play(m);
            break;

        case SoundPlayType.None:
            Debug.LogWarning("SoundType이 None 으로 잘못 설정 되어 있음.:" + m.realID.ToString());
            break;

        case SoundPlayType.UI:
            Play_UISound(m);
            break;
        }
    }