void Start() { element = GetComponent <TriggerableElement>(); // Get reference to object's material. m_Material = GetComponent <Renderer>().material; // Get material's starting color value. m_Color = m_Material.color; }
void Update() { foreach (char c in Input.inputString) { var index = KeyToIndexDictionary.GetIndex(c.ToString()); try { if (index <= 14) { lastTriggeredElement = TriggerElement(index, musicReactiveElements); } else if (index <= 29) { lastTriggeredElement = TriggerElement(index, backgroundElements); } else if (index == 9999) { Debug.Log("Could not find a value for keystroke of " + c.ToString()); } else { Debug.Log("Got a very unexpected outcome using keystroke of " + c.ToString()); } } catch (NoElementWithIndexException e) { Debug.Log("Could not find an element with index position of " + e.index); } } if (Input.GetButtonDown("Up")) { if (lastTriggeredElement && !lastTriggeredElement.audioInsensitive) { lastTriggeredElement.gameObject.GetComponent <TransparentMaterial>().DecrementSensitivityDivision(); } } else if (Input.GetButtonDown("Down")) { if (lastTriggeredElement && !lastTriggeredElement.audioInsensitive) { lastTriggeredElement.gameObject.GetComponent <TransparentMaterial>().IncrementSensitivityDivision(); } } else if (Input.GetButtonDown("FlipBuffer")) { if (lastTriggeredElement && !lastTriggeredElement.audioInsensitive) { lastTriggeredElement.gameObject.GetComponent <TransparentMaterial>().FlipBuffer(); } } else if (Input.GetButtonDown("DriveTreble")) { if (lastTriggeredElement && !lastTriggeredElement.audioInsensitive) { lastTriggeredElement.gameObject.GetComponent <TransparentMaterial>().FlipTreble(); } } else if (Input.GetButtonDown("DriveMids")) { if (lastTriggeredElement && !lastTriggeredElement.audioInsensitive) { lastTriggeredElement.gameObject.GetComponent <TransparentMaterial>().FlipMids(); } } else if (Input.GetButtonDown("DriveBass")) { if (lastTriggeredElement && !lastTriggeredElement.audioInsensitive) { lastTriggeredElement.gameObject.GetComponent <TransparentMaterial>().FlipBass(); } } else if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.Escape)) { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } }