SimonGameManager.cs 1.13 KB
Newer Older
1
2
3
4
5
6
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SimonGameManager : MonoBehaviour {

7
8
9
10
11
    public static Queue<GameObject> simonNotes = new Queue<GameObject>();

    public static float score;
    public static int combo;

12
13
14
15
16
    public static void SimonPlayed(GameObject note){
        simonNotes.Enqueue(note);
    }

    public static void PlayerPlayed(GameObject note){
17
18
19
20
21
22
23
24
        if (simonNotes.Count > 0)
        {
            GameObject sNote = simonNotes.Dequeue();
            Note simonNote = sNote.GetComponent<Note>();
            Note playerNote = note.GetComponent<Note>();

            if (simonNote.type == playerNote.type)
            {
25
                HitNote(playerNote.points);
26
27
28
            }
            else
            {
29
                MissNote();
30
31
32
            }

            Destroy(sNote);
33
        }else{
34
            print("Dont be hasty master Hobbit");
35
36
        }
    }
37
38
39
40
41
42
43
44
45
46
47

    static void HitNote(int points){
        print("GOOD");
        score += points;
        combo++;
    }

    static void MissNote(){
        print("BAD");
        combo = 0;
    }
48
}