private string GetMaterialText(eAudioM_GroundType aType, eAudioM_AudioSelector aSelector) { string textToReturn = ""; switch (aSelector) { case eAudioM_AudioSelector.AudioClip: { textToReturn += GetAmountOfSound(aType, eAudioM_FootSoundType.Walk); textToReturn += GetAmountOfSound(aType, eAudioM_FootSoundType.Run); textToReturn += GetAmountOfSound(aType, eAudioM_FootSoundType.Crouch); textToReturn += GetAmountOfSound(aType, eAudioM_FootSoundType.Crawling); break; } case eAudioM_AudioSelector.AudioData: { textToReturn += GetAmountOfSoundData(aType, eAudioM_FootSoundType.Walk); textToReturn += GetAmountOfSoundData(aType, eAudioM_FootSoundType.Run); textToReturn += GetAmountOfSoundData(aType, eAudioM_FootSoundType.Crouch); textToReturn += GetAmountOfSoundData(aType, eAudioM_FootSoundType.Crawling); break; } } return(textToReturn); }
private string GetAmountOfSoundData(eAudioM_GroundType aType, eAudioM_FootSoundType aMovement) { int amount = m_FootSoundsData[(int)aType].GetSoundsList(aMovement).Count; if (amount >= 10) { return("[9+]"); } else { return("[" + amount.ToString() + "]"); } }
//-------------------------------------------------------------------------------------------- ///<summary> ///(Sphere Audio) Instiante a foot sound depend on which ground you are on, play it and then destroy it ///<param name="aPosition">The position where the sound will be instantiate</param> ///<param name="aGroundType">The type of ground you are moving on</param> ///<param name="aMovementType">The type of movement you are doing</param> ///<param name="aFootDir">The foot that will touch the ground and make sound</param> ///</summary> public void FootSound_Play(Vector3 aPosition, eAudioM_GroundType aGroundType, eAudioM_FootSoundType aMovementType, eAudioM_FootSoundDir aFootDir) { if (!FootSound_IsInit(true)) { return; } AudioClip clip = null; switch (m_FootAudioSelector) { case eAudioM_AudioSelector.AudioClip: { clip = m_FootSoundsData.GetFootSound(aGroundType, aMovementType); break; } case eAudioM_AudioSelector.AudioData: { AudioData data = m_FootSoundsData.GetFootSoundData(aGroundType, aMovementType); if (data == null) { Debug.LogWarning(Debug_Warning("There's no AudioData available for the ground '" + aGroundType + "' and the movement type '" + aMovementType + "'")); return; } data.StereoPan = FootSound_GetStereoPan(aFootDir); SoundEasy_Play(data, aPosition); return; } } if (clip == null) { Debug.LogWarning(Debug_Warning("There's no sound to play")); return; } GameObject obj = new GameObject(); obj.transform.position = aPosition; SFX_AudioSetup audio = obj.AddComponent <SFX_AudioSetup>(); audio.SetupAudio(clip, m_FootSoundsData.GetFootSoundVolume(aGroundType, aMovementType), 1.0f, 1.0f, FootSound_GetStereoPan(aFootDir)); audio.PlayAudio(0); }
private void ShowMaterialAvailable() { for (int i = 0; i < EnumSystem.GetEnumCount(typeof(eAudioM_GroundType)); i++) { if (i == m_GroundSelectId) { ShowAdvancedListBtn(((eAudioM_GroundType)i).ToString(), GetMaterialText((eAudioM_GroundType)i, m_AudioSelector), null, true, 2); } else { if (ShowAdvancedListBtn(((eAudioM_GroundType)i).ToString(), GetMaterialText((eAudioM_GroundType)i, m_AudioSelector), null, false, 2)) { m_GroundSelectId = i; } } } m_GroundSelect = (eAudioM_GroundType)m_GroundSelectId; }
public float GetFootSoundVolume(eAudioM_GroundType aGround, eAudioM_FootSoundType aType) { return(m_FootSounds[(int)aGround].GetFootSoundVolume(aType)); }
///<summary>Return a foot sound data depend on the moving type of the player and the ground is on</summary> public AudioData GetFootSoundData(eAudioM_GroundType aGround, eAudioM_FootSoundType aType) { return(m_FootSoundsWithData[(int)aGround].GetFootSound(aType)); }
///<summary>Return a foot sound depend on the moving type of the player and the ground is on</summary> public AudioClip GetFootSound(eAudioM_GroundType aGround, eAudioM_FootSoundType aType) { return(m_FootSounds[(int)aGround].GetFootSound(aType)); }