Commit 403ba606 authored by gstuitje's avatar gstuitje
Browse files

Now we can play songs

parent b64ee28b
<Properties StartupConfiguration="{67A4F128-F6AC-CD88-DA35-F29416A0792A}|">
<MonoDevelop.Ide.ItemProperties.Assembly-CSharp PreferredExecutionTarget="Unity.Editor" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/SpawnKeys.cs">
<Files>
<File FileName="Assets/TextFiles/TestMultiples.txt" Line="1" Column="1" />
<File FileName="Assets/Scripts/SpawnKeys.cs" Line="9" Column="18" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MultiItemStartupConfigurations />
</Properties>
\ No newline at end of file
fileFormatVersion: 2
guid: 81df3ff23e8e9439b864c9df74c8a1de
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 413f6ca780d3944a294d3a04a3582648
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,6 +6,7 @@ public class SpawnKeys : MonoBehaviour {
public TextAsset songFile;
public GameObject arrowPrefab;
private string song = "default";
Queue<string[]> songKeys = new Queue<string[]>();
string[] nextKey;
......@@ -26,28 +27,23 @@ public class SpawnKeys : MonoBehaviour {
print("Array version");
string[] lines = songFile.text.Split('\n');
arrows = new string[lines.Length];
timings = new float[lines.Length];
arrows = new string[lines.Length-1];
timings = new float[lines.Length-1];
int count = 0;
foreach (string line in lines)
{
arrows[count] = line.Split(' ')[0];
timings[count] = float.Parse(line.Split(' ')[1]);
count++;
}
//print out arrays
//for (int i = 0; i < arrows.Length; i++)
//{
// print(arrows[i] + " " + timings[i]);
//}
//Same as above but uses queues, will have to parse
//string of timings into a float later on.
print("Queue version!");
foreach (string line in songFile.text.Split('\n'))
{
songKeys.Enqueue(line.Split(' '));
if (count != 0)
{
songKeys.Enqueue(line.Split(' '));
}else{
song = line;
}
count++;
}
nextKey = songKeys.Dequeue();
//print out queue
......@@ -56,6 +52,10 @@ public class SpawnKeys : MonoBehaviour {
// string[] x = songKeys.Dequeue();
// print(x[0] + " " + x[1]);
//}
print(song);
print(Resources.Load("Bavaria"));
AudioClip songAudio = Resources.Load<AudioClip>(song);
AudioSource.PlayClipAtPoint(songAudio, transform.position);
}
......
fileFormatVersion: 2
guid: d66310f56c0f0487b8df20890b29e5f6
guid: 2009ec12e81114ee1acd4caadc2602c4
TextScriptImporter:
externalObjects: {}
userData:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment