diff --git a/Assets/Prefabs/Level.prefab b/Assets/Prefabs/Level.prefab new file mode 100644 index 0000000..a17b842 Binary files /dev/null and b/Assets/Prefabs/Level.prefab differ diff --git a/Assets/Prefabs/LevelAssests (1).prefab b/Assets/Prefabs/LevelAssests (1).prefab deleted file mode 100644 index 925abe9..0000000 Binary files a/Assets/Prefabs/LevelAssests (1).prefab and /dev/null differ diff --git a/Assets/Prefabs/LevelPrefabs/Player.prefab b/Assets/Prefabs/LevelPrefabs/Player.prefab index b31ade1..5abcaae 100644 Binary files a/Assets/Prefabs/LevelPrefabs/Player.prefab and b/Assets/Prefabs/LevelPrefabs/Player.prefab differ diff --git a/Assets/Prefabs/MenuCanvas.prefab b/Assets/Prefabs/MenuCanvas.prefab index 111c9b0..82121d6 100644 Binary files a/Assets/Prefabs/MenuCanvas.prefab and b/Assets/Prefabs/MenuCanvas.prefab differ diff --git a/Assets/Scenes/TheLevel.unity b/Assets/Scenes/TheLevel.unity index 7b75fdd..4665f29 100644 Binary files a/Assets/Scenes/TheLevel.unity and b/Assets/Scenes/TheLevel.unity differ diff --git a/Assets/Scripts/Menu.cs b/Assets/Scripts/Menu.cs index 067ac20..1287a97 100644 --- a/Assets/Scripts/Menu.cs +++ b/Assets/Scripts/Menu.cs @@ -21,6 +21,9 @@ public class Menu : MonoBehaviour { [SerializeField] GameObject barParent; [SerializeField] GameObject barText; + [SerializeField] Toggle avgToggle; + + // Use this for initialization void Start () { @@ -44,6 +47,11 @@ void Update () { if (Input.GetKeyDown (KeyCode.F)) { ShowHideBars (); } + + if (Input.GetKeyDown (KeyCode.A)) { + WaveManager.instance.useAvg = !WaveManager.instance.useAvg; + avgToggle.isOn = WaveManager.instance.useAvg; + } } diff --git a/Assets/Scripts/WaveManager.cs b/Assets/Scripts/WaveManager.cs index a0b88f6..99bcd3f 100644 --- a/Assets/Scripts/WaveManager.cs +++ b/Assets/Scripts/WaveManager.cs @@ -40,8 +40,9 @@ public class WaveManager : MonoBehaviour { public bool isMakingWaves = true; public float amplitudeModifier = 2f; - public float mapMin = -25f; + public float mapMin = -27f; public float mapMax = 10f; + public bool useAvg = true; //Privates List colliderPillars; @@ -99,14 +100,20 @@ void FixedUpdate () { { if (FrequencyAnalysis.instance != null) { //freq = MapToCalibration((FrequencyAnalysis.instance.MapToCalibration(frequencyAndAmp[0].Key))); - freq = TotalMap(FrequencyAnalysis.instance.avgFreq); + if(useAvg){ + freq = TotalMap(FrequencyAnalysis.instance.avgFreq); + } + else{ + freq = TotalMap(FrequencyAnalysis.instance.frequencyAndAmp[0].Key); + } + amp = Mathf.Clamp (frequencyAndAmp [0].Value * amplitudeModifier, 0, 10f); } } if (FrequencyAnalysis.instance != null) { //float hejmartin = FrequencyAnalysis.instance.MapToCalibration(frequencyAndAmp[0].Key); - Debug.Log("FREQ: " +frequencyAndAmp[0].Key +" "+ freq+" AMP: "+amp); + //Debug.Log("FREQ: " +frequencyAndAmp[0].Key +" "+ freq+" AMP: "+amp); } //Moving the physical pillars diff --git a/Assets/Scripts/soundscripts/FrequencyAnalysis.cs b/Assets/Scripts/soundscripts/FrequencyAnalysis.cs index aab6840..750adc6 100644 --- a/Assets/Scripts/soundscripts/FrequencyAnalysis.cs +++ b/Assets/Scripts/soundscripts/FrequencyAnalysis.cs @@ -74,9 +74,13 @@ void Start() { print (Microphone.devices.Length); aso.clip = Microphone.Start (Microphone.devices[microphoneNr], true, 1, 44100); while (!(Microphone.GetPosition(null) > 0)){} - aso.Play (); aso.loop = true; + aso.Play (); + + + + numberleft = new float[numSamples]; volumeSamples = new float[numSamples]; @@ -100,9 +104,7 @@ void Start() { // Update is called once per frame void Update () { numberleft = new float[numSamples]; - aso.GetSpectrumData (numberleft, 0,FFTWindow.BlackmanHarris); - // 22050/samplenumber = 10.7 // TO FIND ELEMENT IN ARRAY: // FrequencyYouWant / 10.7(result from last) @@ -223,6 +225,7 @@ void Update () { avgFreq /= frequencyAndAmp.Count; //print ("----------------------------"); //print (avgFreq); + } diff --git a/Assets/mic.mixer b/Assets/mic.mixer new file mode 100644 index 0000000..72d28c8 Binary files /dev/null and b/Assets/mic.mixer differ diff --git a/Assets/mic.mixer.meta b/Assets/mic.mixer.meta new file mode 100644 index 0000000..bd97d6a --- /dev/null +++ b/Assets/mic.mixer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 22227ec6d1b6a2c4e966485d883b482d +timeCreated: 1485086214 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/minotaurDestroy.cs b/Assets/minotaurDestroy.cs new file mode 100644 index 0000000..051ef11 --- /dev/null +++ b/Assets/minotaurDestroy.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class minotaurDestroy : MonoBehaviour { + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } + + void OnCollisionEnter2D(Collision2D other) + { + Destroy(gameObject); + } +}