Commit c835c8f8 authored by astatham's avatar astatham
Browse files

Added speed selection for MimeMime

parent c907c842
<Properties StartupConfiguration="{67A4F128-F6AC-CD88-DA35-F29416A0792A}|">
<MonoDevelop.Ide.ItemProperties.Assembly-CSharp PreferredExecutionTarget="Unity.Editor" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/MimeScripts/MimeMime.cs">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/MimeScripts/SongSelect.cs">
<Files>
<File FileName="Assets/Scripts/MimeScripts/SpawnKeys.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/MimeScripts/SpawnKeys.cs" Line="21" Column="30" />
<File FileName="Assets/Scripts/MimeScripts/TriggerManager.cs" Line="143" Column="32" />
<File FileName="Assets/Scripts/MimeScripts/MimeMime.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/MimeScripts/SongSelect.cs" Line="1" Column="1" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
......
......@@ -14,6 +14,7 @@ public class MimeMime : MonoBehaviour {
private static int goodHits;
private static int badHits;
private static int misses;
private static float multiplier;
private static int badCount;
......@@ -32,7 +33,8 @@ public class MimeMime : MonoBehaviour {
public static void PerfectHit(Key key)
{
addPlayerScore(key.points);
int addScore = (int)(key.points * FindObjectOfType<SpawnKeys>().playSpeed);
addPlayerScore(addScore);
perfectHits++;
updateMultiplyer();
Combo += 1;
......@@ -40,22 +42,26 @@ public class MimeMime : MonoBehaviour {
public static void GoodHit(Key key)
{
addPlayerScore(key.points * 0.8f);
int addScore = (int)(key.points * FindObjectOfType<SpawnKeys>().playSpeed);
addPlayerScore(addScore*0.8f);
goodHits++;
updateMultiplyer();
}
public static void BadHit(Key key)
{
addPlayerScore(key.points * 0.4f);
int addScore = (int)(key.points * FindObjectOfType<SpawnKeys>().playSpeed);
addPlayerScore(addScore*0.4f);
badHits++;
badCount++;
updateMultiplyer();
Combo -= badCount;
}
public static void MissHit(Key key) {
addPlayerScore(key.points * 0.2f);
public static void MissHit(Key key)
{
int addScore = (int)(key.points * FindObjectOfType<SpawnKeys>().playSpeed);
addPlayerScore(addScore*0.2f);
misses++;
badCount++;
updateMultiplyer();
......
......@@ -7,23 +7,30 @@ using UnityEngine.UI;
public class SongSelect : MonoBehaviour {
private SpawnKeys keySpawner;
public Toggle qwerToggle, wsadToggle;
public Toggle qwerToggle, wsadToggle, slow, normal, fast;
// Use this for initialization
void Start () {
keySpawner = GameObject.FindWithTag("LevelMaster").GetComponent<SpawnKeys>();
Toggle[] toggleArray = gameObject.GetComponentsInChildren<Toggle>();
if (toggleArray[0].tag == "QWER")
{
qwerToggle = toggleArray[0];
wsadToggle = toggleArray[1];
} else
{
qwerToggle = toggleArray[1];
wsadToggle = toggleArray[0];
foreach (Toggle toggle in toggleArray){
if (toggle.tag == "QWER"){
qwerToggle = toggle;
} else if (toggle.tag == "WSAD"){
wsadToggle = toggle;
} else if (toggle.tag == "Slow"){
slow = toggle;
} else if (toggle.tag == "Normal"){
normal = toggle;
} else if (toggle.tag == "Fast"){
fast = toggle;
}
}
qwerToggle.onValueChanged.AddListener(delegate { ToggleValueChanged(qwerToggle); });
wsadToggle.onValueChanged.AddListener(delegate { ToggleValueChanged(wsadToggle); });
}
slow.onValueChanged.AddListener(delegate { SpeedChanged(slow); });
normal.onValueChanged.AddListener(delegate { SpeedChanged(normal); });
fast.onValueChanged.AddListener(delegate { SpeedChanged(fast); });
}
public void playSong1(){
keySpawner.Bavaria();
......@@ -50,10 +57,25 @@ public class SongSelect : MonoBehaviour {
{
if (toggle.tag == "QWER" && toggle.isOn)
{
GameObject.FindObjectOfType<SpawnKeys>().qwer = true;
FindObjectOfType<SpawnKeys>().qwer = true;
} else if (toggle.tag == "WSAD" && toggle.isOn)
{
GameObject.FindObjectOfType<SpawnKeys>().qwer = false;
FindObjectOfType<SpawnKeys>().qwer = false;
}
}
private void SpeedChanged(Toggle toggle){
if (toggle.tag == "Slow" && toggle.isOn){
FindObjectOfType<SpawnKeys>().playSpeed = 0.8f;
FindObjectOfType<LevelManager>().GetComponent<AudioSource>().pitch = 0.8f;
} else if (toggle.tag == "Fast" && toggle.isOn)
{
FindObjectOfType<SpawnKeys>().playSpeed = 1.2f;
FindObjectOfType<LevelManager>().GetComponent<AudioSource>().pitch = 1.2f;
} else if (toggle.tag == "Normal" && toggle.isOn) {
FindObjectOfType<SpawnKeys>().playSpeed = 1.0f;
FindObjectOfType<LevelManager>().GetComponent<AudioSource>().pitch = 1.0f;
}
}
}
......@@ -18,6 +18,7 @@ public class SpawnKeys : MonoBehaviour {
public float skip;
public float volumeFade;
public bool qwer = true;
public float playSpeed = 1.0f;
private bool songSet = false;
private string song = "default";
......@@ -36,6 +37,7 @@ public class SpawnKeys : MonoBehaviour {
// Use this for initialization
void Start () {
print("Speed = " + playSpeed);
}
public void startTutorial()
......@@ -118,7 +120,7 @@ public class SpawnKeys : MonoBehaviour {
if(endSong == true && music != null){
music.volume -= (volumeFade * Time.deltaTime);
}
while (nextKey != null && Time.time > startTime + (float.Parse(nextKey[1])/0.8f) - skip)
while (nextKey != null && Time.time > startTime + (float.Parse(nextKey[1])/playSpeed) - skip)
{
if (float.Parse(nextKey[1]) >= skip)
{
......
......@@ -32,6 +32,9 @@ TagManager:
- playerInput
- QWER
- WSAD
- Slow
- Normal
- Fast
layers:
- Default
- TransparentFX
......
Markdown is supported
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