// Update is called once per frame void Update() { if (renderers[0].isVisible) { renderers[0].material.SetFloat("_Alpha", timeKeeper.GetAlphaSun()); renderers[0].material.SetFloat("_Angle", timeKeeper.GetSunAngle()); if (results.Count > 0) { Vector3 lightToObject = this.transform.position - results[0].gameObject.transform.position; renderers[1].material.SetFloat("_Angle", (Mathf.Atan2(lightToObject.y, lightToObject.x) - Mathf.PI / 2)); renderers[1].material.SetFloat("_Alpha", timeKeeper.GetAlphaPoint()); } if (results.Count > 1) { Vector3 lightToObject = this.transform.position - results[1].gameObject.transform.position; renderers[2].material.SetFloat("_Angle", (Mathf.Atan2(lightToObject.y, lightToObject.x) - Mathf.PI / 2)); renderers[2].material.SetFloat("_Alpha", timeKeeper.GetAlphaPoint()); } } }