1234567891011121314151617181920212223242526 |
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class Ring : MonoBehaviour
- {
- public RawImage backgroundSprite;
- public RawImage borderSprite;
- const float MAX_BG_ALPHA = 0.8f;
- const float MAX_BORDER_ALPHA = 0.5f;
- const float MIN_BORDER_ALPHA = 0.1f;
- /// <summary>
- /// Sets the alpha of the background and the border from percentage of rings that have been done so far.
- /// As the percentage gets higher, the background gets darker, and the border gets fainter.
- /// </summary>
- /// <param name='percentage'>
- /// Percentage value between 0 and 1
- /// </param>
- public void SetAlphaFromPercentage(float percentage)
- {
- //backgroundSprite.alpha = MAX_BG_ALPHA * percentage;
- //borderSprite.alpha = MIN_BORDER_ALPHA + (MAX_BORDER_ALPHA - MIN_BORDER_ALPHA) * (1 - percentage);
- }
- }
|