39 lines
857 B
C#
39 lines
857 B
C#
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public class Range{
|
|
public float min, max;
|
|
|
|
public Range(float _min, float _max){
|
|
min = _min;
|
|
max = _max;
|
|
}
|
|
|
|
public float GetRandom(){
|
|
return Random.Range(min,max);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"min:{min}, max:{max}";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public class Helpers{
|
|
public static string SecondsToTime(int time,bool showSeconds= true){
|
|
int seconds = time % 60;
|
|
int mins = Mathf.FloorToInt((float)time/60f);
|
|
int hours = Mathf.FloorToInt((float)mins/60f);
|
|
|
|
string output="";
|
|
if(hours>0){output+=$"{hours}H ";}
|
|
if(mins>0){output+=$"{mins}m ";}
|
|
if(showSeconds){output+=$"{seconds}s";}
|
|
if(output.Length <= 0){
|
|
output = time + " seconds";
|
|
}
|
|
return output;
|
|
}
|
|
} |