IEnumerator ChangeColor(textColor colorType,float start, float end) { float currTime = 0; while (currTime < switchTime) { currTime += Time.deltaTime; AddColor(colorType, EasingUtil.linear(start, end, currTime / switchTime)); yield return null; } }
void AddColor(textColor colorType, float add) { switch (colorType) { case textColor.red: targetText.color = new Color(add, targetText.color.g, targetText.color.b, targetText.color.a); break; case textColor.green: targetText.color = new Color(targetText.color.r, add, targetText.color.b, targetText.color.a); break; case textColor.blue: targetText.color = new Color(targetText.color.r, targetText.color.g, add, targetText.color.a); break; default: break; } }
public void change_color(Text announce, textColor textcolor) { switch (textcolor) { case textColor.red: announce.color = new Color(255f / 255f, 0f / 255f, 0f / 255f); break; case textColor.yellow: announce.color = new Color(255f / 255f, 255f / 255f, 0f / 255f); break; case textColor.green: announce.color = new Color(0f / 255f, 255f / 255f, 0f / 255f); break; } }