private void Light(LightUp.LIGHT_STATE newState) { Shader s = this.GetComponent <Shader> (); switch (newState) { default: case LIGHT_STATE.STATE_NORMAL: GetComponent <Renderer> ().material.SetColor("_EmissionColor", colorDefault); break; case LIGHT_STATE.STATE_ACTIVE: GetComponent <Renderer> ().material.SetColor("_EmissionColor", colorActive); break; case LIGHT_STATE.STATE_ERROR: GetComponent <Renderer> ().material.SetColor("_EmissionColor", colorError); break; } }
// Called from PatternLightUp(float duration) to light up the orb for a given duration. IEnumerator LightFor(float duration, LightUp.LIGHT_STATE newState) { // Assign the lightup material to the orb and play the audio... if (LIGHT_STATE.STATE_ACTIVE == newState) { // Assign the lightup material to the orb. Light(LIGHT_STATE.STATE_ACTIVE); // Get the GVR audio source component on this orb and play the audio. this.GetComponent <GvrAudioSource>().Play(); } else { // Assign the lightup material to the orb. Light(newState); } // ...wait... yield return(new WaitForSeconds(duration - 0.1f)); // ...revert the material back to the orb's default material. AestheticReset(); }
// Lightup behavior for displaying the orb lightup pattern. // Called when the GameLogic.DisplayPattern() function is invoked (see GameLogic.cs script). public void PatternLightUp(float duration, LightUp.LIGHT_STATE newState = LIGHT_STATE.STATE_ACTIVE) { StartCoroutine(LightFor(duration, newState)); }