void startRecording() { gameClock.ActivateDebugTimer(); gameClock.debugTimer = songStart; recordingTimer = songStart; recording = new SongRecording(inputSongName.text); isRecording = true; audioControl.LoadClip(inputSongTrack.text, songStart); statusLabel.text = "Recording..."; }
//Plays the audio attatched to the key and sets its material to down public void PlayNote(bool wasAI) { if (!AI || !wasAI)//If the player presses the key { playerData.ResetSleepTime(); } StopCoroutine("SoundStop"); stamp = false; GetComponent <AudioSource>().Play(); keyModelRenderer.material = keyDown; heldNotedistance = 0; if (Physics.Raycast(keyPos, transform.up, out hit, 1)) //Shoots raycast from the tip of note { if (hit.collider.tag == "Note" || hit.collider.tag == "SharpNote") //If the raycast hits a regular or sharp note... { if (hit.distance <= .7f && hit.distance > .45f) //Sweet spot distance { holdingNote = true; playerData.AddScore(100); //Sweet spot playerData.IncreaseMultiplier(.1f); //Add to multiplier } else if (hit.distance > .7f) //To far distance { holdingNote = true; playerData.BreakMultiplier();//No score, break multiplier } else//Not to far but not in sweet spot { holdingNote = true; playerData.AddScore(50);//Too Close spot } //Stores the distance hit in order to check forheld notes heldNotedistance = hit.distance; hit.transform.position = new Vector3(-1000, -1000, -1000); hit.transform.gameObject.SetActive(false); } } if (songrecording) { SongRecording.AddNote(keyNum); } }
void Update() { try { playerScoreDisplay.text = "Score:\n" + Mathf.RoundToInt(playerScore + holdingScore) + "\n" + "Multiplier:\n" + playerMultiplier; playerMultiplierBar.fillAmount = multiplierCount; if (playerMultiplier == 8) { playerMultiplierBar.fillAmount = 1; } } catch { } if (isRecording) { SongRecording.SongPlaying(); } if (sleepTimer + 30 < Time.time) { ResetSleepTime(); SetAI(true); } }