*
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class VerticalProgressBar {
|
||||
private float _value;
|
||||
public float Value{
|
||||
get{ return _value;}
|
||||
set{_value = Mathf.Clamp01(value);}
|
||||
}
|
||||
|
||||
public void OnGUI(Rect rect){
|
||||
Tools.DrawRectangle (rect, new Color(0,0.1f,0,0.5f));
|
||||
Tools.DrawRectangle (new Rect(rect.x, rect.y + rect.height * (1.0f - _value), rect.width, rect.height - rect.height * (1.0f - _value)), new Color(1,1,0,0.9f));
|
||||
}
|
||||
}
|
||||
|
||||
public class HorizontalProgressBar {
|
||||
|
||||
public static void OnGUI(Rect rect, float value, Color foreground){
|
||||
value = Mathf.Clamp01 (value);
|
||||
Tools.DrawRectangle (rect, new Color(0,0.1f,0,0.5f));
|
||||
Tools.DrawRectangle (new Rect(rect.x, rect.y, rect.width * (value), rect.height), foreground);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user