diff --git a/Assets/Scenes/CaseyTest.unity b/Assets/Scenes/CaseyTest.unity index db8f1bc..23e6479 100644 --- a/Assets/Scenes/CaseyTest.unity +++ b/Assets/Scenes/CaseyTest.unity @@ -4168,6 +4168,36 @@ PrefabInstance: propertyPath: m_Name value: LongSledgeHammer objectReference: {fileID: 0} + - target: {fileID: 5460175760291139684, guid: 0cd2ef3ca51fc5541912dbdcd56cd066, + type: 3} + propertyPath: m_LocalRotation.x + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 5460175760291139684, guid: 0cd2ef3ca51fc5541912dbdcd56cd066, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5460175760291139684, guid: 0cd2ef3ca51fc5541912dbdcd56cd066, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5460175760291139684, guid: 0cd2ef3ca51fc5541912dbdcd56cd066, + type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 5460175760291139684, guid: 0cd2ef3ca51fc5541912dbdcd56cd066, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -90 + objectReference: {fileID: 0} + - target: {fileID: 5460175760291139684, guid: 0cd2ef3ca51fc5541912dbdcd56cd066, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0cd2ef3ca51fc5541912dbdcd56cd066, type: 3} --- !u!4 &503616637 stripped @@ -6558,6 +6588,21 @@ PrefabInstance: propertyPath: herd value: objectReference: {fileID: 1457452760} + - target: {fileID: 4035834407651339497, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: spacialBlend + value: 0.022 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339497, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: volumes.Array.data[0] + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339497, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: volumes.Array.data[1] + value: 0.75 + objectReference: {fileID: 0} - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, type: 3} propertyPath: m_LocalPosition.x @@ -6618,6 +6663,31 @@ PrefabInstance: propertyPath: audioPosition value: objectReference: {fileID: 963194225} + - target: {fileID: 4035834407651339499, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: volumes.Array.data[0] + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339499, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: volumes.Array.data[1] + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339499, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: waitTime + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339499, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: makeSolo + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339499, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: spacialBlend + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4035834407651339503, guid: 6ad2be9300e66ea46bc90805f007dd81, type: 3} propertyPath: m_Name @@ -13565,7 +13635,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2009130163} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.7, y: 8, z: 65.3} + m_LocalPosition: {x: 0.1, y: 2.9, z: 57} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1457452761} diff --git a/Assets/Scripts/Gameplay/AudioRandomiser.cs b/Assets/Scripts/Gameplay/AudioRandomiser.cs index 7cf77f2..8364292 100644 --- a/Assets/Scripts/Gameplay/AudioRandomiser.cs +++ b/Assets/Scripts/Gameplay/AudioRandomiser.cs @@ -14,10 +14,16 @@ public class AudioRandomiser : MonoBehaviour public float waitTime; public float[] volumes; + public bool makeSolo; + public bool mute; + + [Range(0, 1)] + public float spacialBlend = 1; + // Start is called before the first frame update void Start() { - + } void Awake() @@ -30,7 +36,7 @@ public class AudioRandomiser : MonoBehaviour int count = 1; if (herd != null) { - count = (int) Mathf.Round(herd.HerdAmount() / 10); + count = (int)Mathf.Round(herd.HerdAmount() / 10); count = Mathf.Clamp(count, 1, 10); } @@ -47,19 +53,45 @@ public class AudioRandomiser : MonoBehaviour yield return new WaitForSeconds(wait); AudioClip clip = audioSources[Random.Range(0, audioSources.Length)]; float volume = Random.Range(volumes[0], volumes[1]); - AudioSource.PlayClipAtPoint(clip, audioPosition.transform.position, volume); + PlayClipAt(clip, Vector3.zero, (!mute) ? volume : 0); + if (makeSolo) + { + foreach (AudioRandomiser audioRandomiser in FindObjectsOfType()) + if (audioRandomiser != this) + audioRandomiser.mute = true; + + GetComponent().volume /= 2f; + yield return new WaitForSeconds(clip.length); + GetComponent().volume *= 2f; + + foreach (AudioRandomiser audioRandomiser in FindObjectsOfType()) + if (audioRandomiser != this) + audioRandomiser.mute = false; + } } public IEnumerator PlayClips() { yield return new WaitForSeconds(waitTime); PlaySoundFromCount(); + StartCoroutine(PlayClips()); } - // Update is called once per frame - void Update() + AudioSource PlayClipAt(AudioClip clip, Vector3 pos, float volume) { - + GameObject tempGO = new GameObject("TempAudio"); // create the temp object + tempGO.transform.position = pos; // set its position + AudioSource aSource = tempGO.AddComponent(); // add an audio source + aSource.clip = clip; // define the clip + // set other aSource properties here, if desired + + aSource.volume = volume; + aSource.spatialBlend = spacialBlend; + aSource.Play(); // start the sound + Destroy(tempGO, clip.length); // destroy object after clip duration + return aSource; // return the AudioSource reference } + + } diff --git a/Assets/Scripts/Gameplay/GameStateController.cs b/Assets/Scripts/Gameplay/GameStateController.cs index 844ab3a..4a8157c 100644 --- a/Assets/Scripts/Gameplay/GameStateController.cs +++ b/Assets/Scripts/Gameplay/GameStateController.cs @@ -28,7 +28,7 @@ public class GameStateController : MonoBehaviour StartCoroutine(FadeImage(WinLose.GetComponentInChildren())); WinText.SetActive(true); StartCoroutine(WaitForLoadOut()); - SceneManager.LoadScene(0); + } public void LoseState() @@ -39,7 +39,6 @@ public class GameStateController : MonoBehaviour StartCoroutine(FadeImage(WinLose.GetComponentInChildren())); LoseText.SetActive(true); StartCoroutine(WaitForLoadOut()); - SceneManager.LoadScene(0); } public IEnumerator FadeImage(Image img) @@ -55,6 +54,7 @@ public class GameStateController : MonoBehaviour public IEnumerator WaitForLoadOut() { yield return new WaitForSeconds(5.0f); + SceneManager.LoadScene(0); } // Update is called once per frame