Isoulated/Assets/Tools/AudioManager/Sounds.cs
Gerard Gascón 001bb14f16 init
2025-04-24 17:19:36 +02:00

51 lines
1.4 KiB
C#

using Geri.MinMaxSlider;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
[CreateAssetMenu(fileName = "Sounds", menuName = "Tools/Sounds")]
public class Sounds : ScriptableObject{
[Tooltip("The music mixer.")]
public AudioMixerGroup mainMixer = default;
[Tooltip("The SFX mixer.")]
public AudioMixerGroup sfxMixer = default;
public List[] sounds;
[System.Serializable] public class List{
[Tooltip("Name of the sound. Each name has to be different between each other.")]
public string name;
public AudioClip clip;
[System.Serializable] public enum Type { Music, SFX }
[Space]
[Tooltip("Is it part of the music or the SFX?")] public Type type;
[Space]
[Tooltip("Default volume of the sound."), MinMaxSlider(0f, 1f)] public Vector2 volume;
[Tooltip("Default pitch of the sound."), MinMaxSlider(.1f, 3f)] public Vector2 pitch;
public bool loop;
[HideInInspector] public AudioSource source;
float randomVolume;
public float RandomVolume{
get{
randomVolume = Random.Range(volume.x, volume.y);
return randomVolume;
}
}
float randomPitch;
public float RandomPitch{
get{
randomPitch = Random.Range(pitch.x, pitch.y);
return randomPitch;
}
}
}
}