Beispiel #1
0
        private static RadialCell CreateChildCellWithOneElementAtRoot(uGUI_CraftNode node, RadialCell parent)
        {
            var siblings    = node.parent.childCount;
            var size        = ComputeNewSize(parent);
            var radius      = ComputeNewRadius(parent, size);
            var index       = node.index;
            var maxSiblings = GetPolygonLineCount(radius, size);

            if (siblings > maxSiblings)
            {
                size = GetPolygonLineSize(radius, siblings);
            }
            var angleDelta = 2 * Mathf.PI / siblings;
            var angle      = angleDelta * index + GetExtraAngleOffset(siblings);

            return(new RadialCell(radius, angle, size, float.NaN, siblings, parent));
        }
Beispiel #2
0
 private static float ComputeNewRadius(RadialCell parent, float size)
 {
     return(parent.radius + parent.size / 2 + size / 2);
 }
Beispiel #3
0
 private RadialCell(float radius, float angle, float size, float groupAngle, int siblings, RadialCell parent)
 {
     this.radius     = radius;
     this.size       = size;
     this.angle      = angle;
     this.parent     = parent;
     this.groupAngle = groupAngle;
     this.siblings   = siblings;
 }
Beispiel #4
0
        private static float ComputeNewSize(RadialCell parent)
        {
            var size = (parent.size - 12);

            return(Mathf.Max(size, 40));
        }