adding in some needed packages
This commit is contained in:
parent
9e739f5dc8
commit
aba5310742
1012 changed files with 494191 additions and 1 deletions
26
Assets/Bremsengine/Music Player/MusicWrapper.cs
Normal file
26
Assets/Bremsengine/Music Player/MusicWrapper.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Bremsengine
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Bremsengine/MusicWrapper")]
|
||||
[System.Serializable]
|
||||
public class MusicWrapper : ScriptableObject
|
||||
{
|
||||
public static implicit operator AudioClip(MusicWrapper mw) => mw == null ? null : mw.musicClip;
|
||||
public static implicit operator float(MusicWrapper mw) => mw == null ? 0f : mw.musicVolume;
|
||||
public string TrackName = Helper.DefaultName;
|
||||
public AudioClip musicClip;
|
||||
public float musicVolume => clipVolume * MusicPlayer.GlobalVolume;
|
||||
[SerializeField] float clipVolume = 0.7f;
|
||||
[field: SerializeField] public bool dontReplaceSelf { get; private set; } = true;
|
||||
private void OnValidate()
|
||||
{
|
||||
this.FindStringError(nameof(TrackName), TrackName);
|
||||
}
|
||||
public void Play()
|
||||
{
|
||||
MusicPlayer.PlayMusicWrapper(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue