Example #1
0
 private void OnSnare(TimedNote note)
 {
     snareTimer = inputTimeout;
     verticalMovementEnabled = true;
     ActivateLine(North, ActivateVertical);
     ActivateLine(South, ActivateVertical);
 }
Example #2
0
        private void OnBass(TimedNote note)
        {
            bassTimer = inputTimeout;
            horizontalMovementEnabled = true;

            ActivateLine(East, ActivateHorizontal);
            ActivateLine(West, ActivateHorizontal);
        }
Example #3
0
    public void AddTimedNote(int midiNo, float time)
    {
        TimedNote temp = new TimedNote()
        {
            maxTime = time, midiNumber = midiNo
        };

        timedNotes.Add(temp);
    }
Example #4
0
    private void PlayingStage(Stage stage)
    {
        if (sortedStageDialogue.Any() && sortedStageDialogue.Peek().time <= timer)
        {
            TimedDialogue dialogue = sortedStageDialogue.Pop();

            Text textObject = dialoguePanel.GetComponentInChildren <Text>();
            textObject.text  = dialogue.text;
            textObject.color = dialogue.color;

            dialoguePanel.SetActive(true);

            // Hide text after duration
            if (deactivateDialogueCoroutine != null)
            {
                StopCoroutine(deactivateDialogueCoroutine);
            }
            deactivateDialogueCoroutine = StartCoroutine(DeactivateAfterSeconds(dialoguePanel, dialogue.duration));
        }

        if (sortedStageNotes.Any() && sortedStageNotes.Peek().time <= timer)
        {
            TimedNote note = sortedStageNotes.Pop();
            if (!string.IsNullOrEmpty(note.note) && noteSpawnPositions.Any())
            {
                var noteTarget = Instantiate(noteTargetPrefab, new Vector3(noteTargetXStartOffset, noteSpawnPositions[note.note]), Quaternion.identity);
                noteTarget.GetComponent <SpriteRenderer>().size = new Vector2(noteTargetXScale * note.duration, 1);
                noteTarget.GetComponent <Rigidbody2D>().AddForce(new Vector2(noteTargetSpeed, 0));
                spawnedNotes.Add(noteTarget);
            }
        }

        // If all tracks are done playing, stage is over
        if (!sortedStageNotes.Any() && !sortedStageDialogue.Any() && audioSourceTracks.All(a => !a.isPlaying))
        {
            // Check if we won, otherwise restart
            if (spawnedNotes.All(s => s.GetComponent <NoteTargetController>().hit))
            {
                state = GameState.PassStage;
            }
            else
            {
                state = GameState.InitStage;
            }
        }
    }
Example #5
0
 private void OnBass(TimedNote note)
 {
     textMeshPro.text = "Bass";
     StartCoroutine(ClearTextAfterDelay());
 }
Example #6
0
 private void OnSnare(TimedNote note)
 {
     textMeshPro.text = "Snare";
     StartCoroutine(ClearTextAfterDelay());
 }