static float GetFactorToDegree(Dimension.Unit unit) { switch (unit) { case Dimension.Unit.Gradian: return(360f / 400); case Dimension.Unit.Radian: return(Mathf.Rad2Deg); case Dimension.Unit.Turn: return(360f); default: return(1); } }
public override string ToString() { string str = string.Empty; Dimension.Unit unit = this.unit; Dimension.Unit unit2 = unit; if (unit2 != Dimension.Unit.Pixel) { if (unit2 == Dimension.Unit.Percent) { str = "%"; } } else { str = "px"; } return(this.value.ToString(CultureInfo.InvariantCulture.NumberFormat) + str); }
public BuilderTransformOrigin(float xValue, float yValue, Dimension.Unit unit = Dimension.Unit.Percent) { x = new Dimension(xValue, unit); y = new Dimension(yValue, unit); }
public BuilderTransformOrigin(float xValue, Dimension.Unit xUnit, float yValue, Dimension.Unit yUnit) { x = new Dimension(xValue, xUnit); y = new Dimension(yValue, yUnit); }
public static bool IsTimeUnit(this Dimension.Unit unit) { return(unit == Dimension.Unit.Millisecond || unit == Dimension.Unit.Second); }
static float ConvertAngle(float angle, Dimension.Unit fromUnit, Dimension.Unit toUnit) { return(BuilderEditorUtility.FixRoundOff(angle * GetFactor(fromUnit, toUnit))); }
static float GetFactor(Dimension.Unit unit1, Dimension.Unit unit2) { return(GetFactorToDegree(unit1) / GetFactorToDegree(unit2)); }
public BuilderRotate(float xValue, Dimension.Unit xUnit) { x = new Dimension(xValue, xUnit); }
public Dimension(float value, Dimension.Unit unit) { this.unit = unit; this.value = value; }