/// <summary> /// Changes the color of the player avatar to the given one /// /// </summary> /// <param name="color">target color</param> /// <param name="isSmooth">if true, the color change will follow a smooth gradient</param> protected override void ChangeColor(Color color, bool isSmooth, float seconds) { if (changeColorCoroutine != null) { StopCoroutine(changeColorCoroutine); } foreach (GameObject probe in GameObject.FindGameObjectsWithTag("Probe")) { Renderer renderer = probe.GetComponent <Renderer>(); foreach (Material material in renderer.materials) { if (isSmooth) { changeColorCoroutine = materials.ChangeColor(material, color, seconds, 0f); StartCoroutine(changeColorCoroutine); } else { changeColorCoroutine = materials.ChangeColor(material, color, seconds); StartCoroutine(changeColorCoroutine); } } } }