feat: controll forge3ds overall volume
This commit is contained in:
parent
d4829e572b
commit
9ac205b950
@ -11,6 +11,7 @@ namespace FORGE3D
|
||||
// Audio timers
|
||||
float timer_01, timer_02;
|
||||
public Transform audioSource;
|
||||
public Vector2 volumeRange;
|
||||
[Header("Vulcan")] public AudioClip[] vulcanHit; // Impact prefabs array
|
||||
public AudioClip vulcanShot; // Shot prefab
|
||||
public float vulcanDelay; // Shot delay in ms
|
||||
@ -95,7 +96,7 @@ namespace FORGE3D
|
||||
{
|
||||
// Modify audio source settings specific to it's type
|
||||
aSrc.pitch = Random.Range(0.95f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 5f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -118,7 +119,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.95f, 1f);
|
||||
aSrc.volume = Random.Range(0.6f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 7f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -140,7 +141,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.95f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 30f;
|
||||
aSrc.loop = false;
|
||||
|
||||
@ -163,7 +164,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.95f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 50f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -185,7 +186,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.9f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 6f;
|
||||
aSrc.loop = false;
|
||||
|
||||
@ -207,7 +208,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.9f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 8f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -229,7 +230,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.9f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 8f;
|
||||
aSrc.loop = false;
|
||||
|
||||
@ -252,7 +253,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.9f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 7f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -274,7 +275,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(0.4f, 0.5f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 8f;
|
||||
aSrc.loop = false;
|
||||
|
||||
@ -296,7 +297,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(0.4f, 0.5f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 25f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -318,7 +319,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 4f;
|
||||
aSrc.loop = false;
|
||||
|
||||
@ -341,7 +342,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 20f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -363,7 +364,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 4f;
|
||||
aSrc.loop = false;
|
||||
|
||||
@ -387,7 +388,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 50f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -411,13 +412,13 @@ namespace FORGE3D
|
||||
if (aOpen != null && aLoop != null)
|
||||
{
|
||||
aOpen.pitch = Random.Range(0.8f, 1f);
|
||||
aOpen.volume = Random.Range(0.8f, 1f);
|
||||
aOpen.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aOpen.minDistance = 50f;
|
||||
aOpen.loop = false;
|
||||
aOpen.Play();
|
||||
|
||||
aLoop.pitch = Random.Range(0.95f, 1f);
|
||||
aLoop.volume = Random.Range(0.95f, 1f);
|
||||
aLoop.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aLoop.loop = true;
|
||||
aLoop.minDistance = 50f;
|
||||
aLoop.Play();
|
||||
@ -434,7 +435,7 @@ namespace FORGE3D
|
||||
if (aClose != null)
|
||||
{
|
||||
aClose.pitch = Random.Range(0.8f, 1f);
|
||||
aClose.volume = Random.Range(0.8f, 1f);
|
||||
aClose.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aClose.minDistance = 50f;
|
||||
aClose.loop = false;
|
||||
aClose.Play();
|
||||
@ -455,13 +456,13 @@ namespace FORGE3D
|
||||
if (aOpen != null && aLoop != null)
|
||||
{
|
||||
aOpen.pitch = Random.Range(0.8f, 1f);
|
||||
aOpen.volume = Random.Range(0.8f, 1f);
|
||||
aOpen.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aOpen.minDistance = 50f;
|
||||
aOpen.loop = false;
|
||||
aOpen.Play();
|
||||
|
||||
aLoop.pitch = Random.Range(0.95f, 1f);
|
||||
aLoop.volume = Random.Range(0.95f, 1f);
|
||||
aLoop.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aLoop.loop = true;
|
||||
aLoop.minDistance = 50f;
|
||||
|
||||
@ -479,7 +480,7 @@ namespace FORGE3D
|
||||
if (aClose != null)
|
||||
{
|
||||
aClose.pitch = Random.Range(0.8f, 1f);
|
||||
aClose.volume = Random.Range(0.8f, 1f);
|
||||
aClose.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aClose.minDistance = 50f;
|
||||
aClose.loop = false;
|
||||
aClose.Play();
|
||||
@ -500,13 +501,13 @@ namespace FORGE3D
|
||||
if (aOpen != null && aLoop != null)
|
||||
{
|
||||
aOpen.pitch = Random.Range(0.8f, 1f);
|
||||
aOpen.volume = Random.Range(0.8f, 1f);
|
||||
aOpen.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aOpen.minDistance = 50f;
|
||||
aOpen.loop = false;
|
||||
aOpen.Play();
|
||||
|
||||
aLoop.pitch = Random.Range(0.95f, 1f);
|
||||
aLoop.volume = Random.Range(0.95f, 1f);
|
||||
aLoop.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aLoop.loop = true;
|
||||
aLoop.minDistance = 50f;
|
||||
|
||||
@ -524,7 +525,7 @@ namespace FORGE3D
|
||||
if (aClose != null)
|
||||
{
|
||||
aClose.pitch = Random.Range(0.8f, 1f);
|
||||
aClose.volume = Random.Range(0.8f, 1f);
|
||||
aClose.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aClose.minDistance = 50f;
|
||||
aClose.loop = false;
|
||||
aClose.Play();
|
||||
@ -545,13 +546,13 @@ namespace FORGE3D
|
||||
if (aOpen != null && aLoop != null)
|
||||
{
|
||||
aOpen.pitch = Random.Range(0.8f, 1f);
|
||||
aOpen.volume = Random.Range(0.8f, 1f);
|
||||
aOpen.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aOpen.minDistance = 50f;
|
||||
aOpen.loop = false;
|
||||
aOpen.Play();
|
||||
|
||||
aLoop.pitch = Random.Range(0.95f, 1f);
|
||||
aLoop.volume = Random.Range(0.95f, 1f);
|
||||
aLoop.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aLoop.loop = true;
|
||||
aLoop.minDistance = 50f;
|
||||
|
||||
@ -569,7 +570,7 @@ namespace FORGE3D
|
||||
if (aClose != null)
|
||||
{
|
||||
aClose.pitch = Random.Range(0.8f, 1f);
|
||||
aClose.volume = Random.Range(0.8f, 1f);
|
||||
aClose.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aClose.minDistance = 50f;
|
||||
aClose.loop = false;
|
||||
aClose.Play();
|
||||
@ -588,7 +589,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.9f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 20f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
@ -611,7 +612,7 @@ namespace FORGE3D
|
||||
if (aSrc != null)
|
||||
{
|
||||
aSrc.pitch = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(0.8f, 1f);
|
||||
aSrc.volume = Random.Range(volumeRange.x, volumeRange.y);
|
||||
aSrc.minDistance = 20f;
|
||||
aSrc.loop = false;
|
||||
aSrc.Play();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user