Because currently it is a system where there is only a single clip, except that I would like to use an array to have multiple clips and therefore play a random clip when the player hits with the weapon.
I already tried to modify all this.
In "bl_Gun"
Line 18 :
Code: Select all
public AudioClip FireSound;
Code: Select all
public AudioClip[] FireSound;
Code: Select all
if (Info.Type != GunType.Grenade)
{
Source.clip = FireSound;
Source.spread = Random.Range(1.0f, 1.5f);
Source.Play();
}
}
Code: Select all
if (Info.Type != GunType.Grenade)
{
FireRandomSounds();
}
}
Code: Select all
public void PlayFireAudio()
{
FireSource.clip = FireSound;
FireSource.spread = Random.Range(1.0f, 1.5f);
FireSource.pitch = Random.Range(1.0f, 1.075f);
FireSource.Play();
}
Code: Select all
public void PlayFireAudio()
{
FireRandomSounds();
}
New line in 1689 (This kind of system works very well.) :
Code: Select all
public void FireRandomSounds()
{
FireSource.clip = FireSound[Random.Range(0, FireSound.Length)];
FireSource.Play();
}
In "bl_NetworkGun"
Line 121 to 123 :
Code: Select all
Source.clip = LocalGun.FireSound;
Source.spread = Random.Range(1.0f, 1.5f);
Source.Play();
Code: Select all
LocalGun.FireRandomSounds();
Code: Select all
public void KnifeFire()
{
if (LocalGun != null)
{
Source.clip = LocalGun.FireSound;
Source.spread = Random.Range(1.0f, 1.5f);
Source.Play();
}
}
Code: Select all
public void KnifeFire()
{
if (LocalGun != null)
{
LocalGun.FireRandomSounds();
}
}
Line 165 to 171 :
Code: Select all
public void PlayLocalFireAudio()
{
Source.clip = LocalGun.FireSound;
Source.spread = Random.Range(1.0f, 1.5f);
Source.Play();
}
Code: Select all
public void PlayLocalFireAudio()
{
LocalGun.FireRandomSounds();
}
In "bl_GunEditor"
Error line 178 :
Code: Select all
script.FireSound = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
Code: Select all
script.FireSound = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
List of errors :
Code: Select all
Assets\MFPS\Scripts\Internal\Editor\MFPS\bl_GunEditor.cs(178,60): error CS1503: Argument 1: cannot convert from 'string' to 'UnityEngine.Object'
Assets\MFPS\Scripts\Internal\Editor\MFPS\bl_GunEditor.cs(178,74): error CS1503: Argument 2: cannot convert from 'UnityEngine.AudioClip[]' to 'System.Type'
Assets\MFPS\Scripts\Internal\Editor\MFPS\bl_GunEditor.cs(178,92): error CS1503: Argument 3: cannot convert from 'System.Type' to 'UnityEngine.GUILayoutOption'
Assets\MFPS\Scripts\Internal\Editor\MFPS\bl_GunEditor.cs(178,123): error CS1503: Argument 4: cannot convert from 'bool' to 'UnityEngine.GUILayoutOption'
Assets\MFPS\Scripts\Internal\Editor\MFPS\bl_GunEditor.cs(372,56): error CS1503: Argument 1: cannot convert from 'string' to 'UnityEngine.Object'
Assets\MFPS\Scripts\Internal\Editor\MFPS\bl_GunEditor.cs(372,70): error CS1503: Argument 2: cannot convert from 'UnityEngine.AudioClip[]' to 'System.Type'
Assets\MFPS\Scripts\Internal\Editor\MFPS\bl_GunEditor.cs(372,88): error CS1503: Argument 3: cannot convert from 'System.Type' to 'UnityEngine.GUILayoutOption'
Assets\MFPS\Scripts\Internal\Editor\MFPS\bl_GunEditor.cs(372,119): error CS1503: Argument 4: cannot convert from 'bool' to 'UnityEngine.GUILayoutOption'
Did you have an alternative for me or how to correct it?
Thanks for your help !