Ring.cs 815 B

1234567891011121314151617181920212223242526
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class Ring : MonoBehaviour
  5. {
  6. public RawImage backgroundSprite;
  7. public RawImage borderSprite;
  8. const float MAX_BG_ALPHA = 0.8f;
  9. const float MAX_BORDER_ALPHA = 0.5f;
  10. const float MIN_BORDER_ALPHA = 0.1f;
  11. /// <summary>
  12. /// Sets the alpha of the background and the border from percentage of rings that have been done so far.
  13. /// As the percentage gets higher, the background gets darker, and the border gets fainter.
  14. /// </summary>
  15. /// <param name='percentage'>
  16. /// Percentage value between 0 and 1
  17. /// </param>
  18. public void SetAlphaFromPercentage(float percentage)
  19. {
  20. //backgroundSprite.alpha = MAX_BG_ALPHA * percentage;
  21. //borderSprite.alpha = MIN_BORDER_ALPHA + (MAX_BORDER_ALPHA - MIN_BORDER_ALPHA) * (1 - percentage);
  22. }
  23. }