Commit 2f918911 authored by mmaluschnig's avatar mmaluschnig
Browse files

changed the way that notes are spawned by having a single NoteManager

parent 3472a876
......@@ -6,35 +6,26 @@ using UnityEngine.EventSystems;
public class KeyPressManager : MonoBehaviour {
public GameObject note;
public Transform playerNoteSpawn;
public Button qButton;
public Button wButton;
public Button eButton;
public Button rButton;
public Button tButton;
public Button yButton;
Dictionary<string, Color> keytoColor;
// Use this for initialization
void Start () {
keytoColor = new Dictionary<string, Color>() {
{"Q",Color.red},
{"W",new Color(1,0.5f,0)},
{"E",Color.yellow},
{"R",Color.green},
{"T",Color.blue},
{"Y",Color.magenta}
};
}
// Update is called once per frame
void Update () {
}
// Update is called once per frame
void Update()
{
//call buttons submit event when the player presses the corresponding key
var pointer = new PointerEventData(EventSystem.current);
if (Input.GetKeyDown(KeyCode.Q)){
if (Input.GetKeyDown(KeyCode.Q))
{
ExecuteEvents.Execute(qButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
if (Input.GetKeyDown(KeyCode.W))
......@@ -58,10 +49,4 @@ public class KeyPressManager : MonoBehaviour {
ExecuteEvents.Execute(yButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
}
public void spawnNote(string noteVal){
print(noteVal);
GameObject thisNote = Instantiate(note, playerNoteSpawn);
thisNote.GetComponent<SpriteRenderer>().color = keytoColor[noteVal];
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NoteManager : MonoBehaviour {
public Transform playerNoteSpawn;
public Transform simonNoteSpawn;
public GameObject note;
static Dictionary<string, Color> keytoColor = new Dictionary<string, Color>() {
{"Q",Color.red},
{"W",new Color(1,0.5f,0)},
{"E",Color.yellow},
{"R",Color.green},
{"T",Color.blue},
{"Y",Color.magenta}
};
public void spawnNote(string noteVal)
{
print(noteVal);
GameObject thisNote = Instantiate(note, playerNoteSpawn);
thisNote.GetComponent<SpriteRenderer>().color = keytoColor[noteVal];
}
public void spawnSimonNote(string noteVal){
//maybe change to int val for simon
GameObject thisNote = Instantiate(note, playerNoteSpawn);
thisNote.GetComponent<SpriteRenderer>().color = keytoColor[noteVal];
}
}
fileFormatVersion: 2
guid: aa0bbaf3d667543989f050741ad9f05f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimonScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
fileFormatVersion: 2
guid: 4a9ec53774bf24fb984364506c95334c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Supports Markdown
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