//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Check Successful Hit? //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public bool CheckSuccessfulHit(TambourineSoundsManager.SoundTypes eSoundType) { if (m_lActiveChallengeNotes.Count > 0) { ChallengeNoteMovement matchingNote = GetFirstMovingNote(); if (matchingNote != null && matchingNote.CheckMatchingSoundType(eSoundType) && matchingNote.CheckSuccessfulHit()) //ChallengeNoteMovement matchingNote = GetFirstMatchingNoteType(eSoundType); //if(matchingNote != null && matchingNote.CheckSuccessfulHit()) { m_lActiveChallengeNotes.Remove(matchingNote); return(true); } else { ChallengeScore -= 0.01f; Score -= 0.01f; VisibleScore -= 0.01f; return(false); } } else { return(false); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Remove Note From Sequence //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void RemoveNote(ChallengeNoteMovement cni) { if (m_lActiveChallengeNotes.Count > 0) { m_lActiveChallengeNotes.Remove(cni); // If removing that last note made us run out of Notes then the challenge has been finished. Tell the Game Manager to cease operations. if (m_lActiveChallengeNotes.Count == 0) { OnChallengeFinish(); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Add New CHallenge Note //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void AddNewChallengeNote(TambourineSoundsManager.SoundTypes eSoundType, float fBeatPos) { GameObject challengeNote = Instantiate(m_goChallengeNotePrefab, Vector3.zero, Quaternion.identity) as GameObject; ChallengeNoteMovement cnm = challengeNote.GetComponent <ChallengeNoteMovement>(); int iCurrentIndex = transform.childCount + 1; challengeNote.transform.name = "Challenge Note - " + (iCurrentIndex < 1000 ? "0" : "") + (iCurrentIndex < 100 ? "0" : "") + (iCurrentIndex < 10 ? "0" : "") + iCurrentIndex.ToString(); challengeNote.transform.parent = this.transform; challengeNote.transform.localPosition = Vector3.zero; cnm.m_rChallengeModeInfo = this; cnm.ChangeSoundType(eSoundType, fBeatPos); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Start Challenge //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void StartChallenge() { ChallengeScore = 0.0f; VisibleScore = 0.0f; m_lActiveChallengeNotes.Clear(); m_eChallengeActivity = ChallengeActivity.CHALLENGE_MODE; foreach (Transform child in transform) { ChallengeNoteMovement cni = child.GetComponent <ChallengeNoteMovement>(); cni.Reset(); cni.BeginMovement(); m_lActiveChallengeNotes.AddLast(cni); } StartNoteMovement(); PlayBackingTrack(BackingTrackDelay); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Stop Challenge //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void StopChallenge() { StopNoteMovement(); m_lActiveChallengeNotes.Clear(); m_eChallengeActivity = ChallengeActivity.IDLE; foreach (Transform child in transform) { ChallengeNoteMovement cni = child.GetComponent <ChallengeNoteMovement>(); cni.Reset(); } StopBackingTrack(); #if UseMemoryGameManager if (m_rSoundsRhythmMemoryGame != null) { m_rSoundsRhythmMemoryGame.StopPlayback(); } #endif }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Start AutoPlay //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void StartAutoPlay() { if (IsPracticeMode) { ResetNotations(); m_eChallengeActivity = ChallengeActivity.IDLE; #if UseMemoryGameManager if (m_rSoundsRhythmMemoryGame != null) { m_rSoundsRhythmMemoryGame.StopPlayback(); } #endif } else { ChallengeScore = 0.0f; VisibleScore = 0.0f; m_eChallengeActivity = ChallengeActivity.PRACTICE_MODE; m_lActiveChallengeNotes.Clear(); foreach (Transform child in transform) { ChallengeNoteMovement cni = child.GetComponent <ChallengeNoteMovement>(); cni.Reset(); cni.BeginAutoPlay(); m_lActiveChallengeNotes.AddLast(cni); } StartNoteMovement(); PlayBackingTrack(BackingTrackDelay); // Play Auto-Example #if UseMemoryGameManager if (m_rSoundsRhythmMemoryGame != null) { m_rSoundsRhythmMemoryGame.PlayThroughRhythmList(m_ePlaylistTrack, null, StartDelayTime); } #endif } }