Main Menu with loading screen
This commit is contained in:
20
Assets/Scripts/SizeProgressBar.cs
Normal file
20
Assets/Scripts/SizeProgressBar.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SizeProgressBar : MonoBehaviour, IProgressBar{
|
||||
public float Progress { get{return progress;}}
|
||||
private float progress =0;
|
||||
|
||||
public RectTransform target;
|
||||
|
||||
public Vector3 start,end;
|
||||
|
||||
|
||||
void OnValidate(){
|
||||
if(target==null){target=GetComponent<RectTransform>();}
|
||||
if(start==end){start = end = target.sizeDelta;}
|
||||
}
|
||||
public void SetProgress(float val){
|
||||
progress = val;
|
||||
target.sizeDelta = Vector3.Lerp(start,end, val);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user