public RectTransform GetRoot(RootsEnum type) { switch (type) { case RootsEnum.Background: return(backgroundRoot); default: case RootsEnum.Pages: return(pagesRoot); case RootsEnum.OverlayPages: return(overlayPagesRoot); case RootsEnum.PopUps: return(popupsRoot); case RootsEnum.OverlayPopUps: return(overlayPopUpsRoot); } }
/// <summary> /// Вычисление корней /// </summary> public void CalculateRoots(double a, double b, double c, out List <double> roots, out RootsEnum rootFlag) { rootFlag = RootsEnum.NoRoots; roots = new List <double>(); double D = b * b - 4 * a * c; //Один корень if (D == 0) { rootFlag = RootsEnum.OneRoot; double root = -b / (2 * a); roots.Add(root); } //Два корня else if (D > 0) { rootFlag = RootsEnum.TwoRoots; double sqrtD = Math.Sqrt(D); double root1 = (-b + sqrtD) / (2 * a); double root2 = (-b - sqrtD) / (2 * a); roots.Add(root1); roots.Add(root2); } }