private void Update() { if (state == TinterState.Hiding) { tintAlpha -= Time.deltaTime / revealTime; if (tintAlpha < 0) { state = TinterState.Hidden; tintAlpha = 0; } Color c = img.color; c.a = tintAlpha; img.color = c; } else if (state == TinterState.Tinting) { tintAlpha += Time.deltaTime / revealTime; if (tintAlpha > 1) { state = TinterState.Tinted; tintAlpha = 1; } Color c = img.color; c.a = tintAlpha; img.color = c; } }
public void Tint() { tintAlpha = 0; state = TinterState.Tinting; }
public void Hide() { tintAlpha = 1; state = TinterState.Hiding; }