private IEnumerator lerpToColor(Color pColor) { RollDie die = FindObjectOfType(typeof(RollDie)) as RollDie; Renderer dieRend = die.gameObject.transform.GetChild(0).GetComponent <Renderer>(); Renderer boardRend = GameObject.Find("BackgoundEmmision").GetComponent <Renderer>(); boardRend.material.EnableKeyword("_EMISSION"); Color newCol = dieRend.material.color; while (true) { newCol = Color.Lerp(newCol, pColor, Time.deltaTime * 5); dieRend.material.color = newCol; dieRend.material.SetColor("_EmissionColor", newCol); boardRend.material.color = newCol; boardRend.material.SetColor("_EmissionColor", newCol); dieRend.gameObject.transform.GetComponentInChildren <Light>().color = newCol; if (newCol == pColor) { yield break; } else { yield return(null); } } }
private void cmdRequestDieRoll() { RollDie die = FindObjectOfType <RollDie>(); die.StartCoroutine(die.RollRandom()); StartCoroutine(updateDie(die.transform.GetChild(0).gameObject)); }
public void RollTheDie(Vector2 pDieTossValues) { RollDie die = FindObjectOfType <RollDie>(); die.StartCoroutine(die.RollWithValues(pDieTossValues)); }