Esempio n. 1
0
        /// <summary>
        /// Calculate the positions of the child gameobjects in a helix.
        /// </summary>
        /// <param name="childs"></param>
        public static void Helix(List <GameObject> childs)
        {
            int sign           = 1;
            int sequenceNumber = 0;

            //childs = DocumentSorter.SortingByHeightDesc(childs);
            //childs = DocumentSorter.SortingByWidthDesc(childs);
            childs = DocumentSorter.SortingByHeightAndWidthDesc(childs);

            float displacementFactorWidth = FindOutDisplacementFactorWidth(childs);
            float displacementFactorDepth = FindOutDisplacementFactorDepth(childs);

            GameObject prevGameObject = childs[0];

            if (prevGameObject.GetComponent <BaseInformation>().GetQualifier() == SqQualifier.FILE ||
                prevGameObject.GetComponent <BaseInformation>().GetQualifier() == SqQualifier.UNIT_TEST)
            {
                prevGameObject.transform.position = new Vector3(0.0f, prevGameObject.transform.position.y, 0.0f);
            }
            else
            {
                prevGameObject.transform.position = new Vector3(0.0f, 0.0f, 0.0f);
            }

            int childIndex = 1;

            for (int listIndex = 0; childIndex < childs.Count; listIndex++)
            {
                if ((listIndex + 1) % 2 == 0)
                {
                    sign = -sign;
                }
                else
                {
                    sequenceNumber++;
                }

                for (int loopIndexSeqNumber = 0; loopIndexSeqNumber < sequenceNumber; loopIndexSeqNumber++)
                {
                    if (childIndex < childs.Count)
                    {
                        if (listIndex % 2 == 0)
                        {
                            childs[childIndex].transform.position = prevGameObject.transform.position + new Vector3(sign * displacementFactorWidth, 0.0f, 0.0f);
                        }
                        else
                        {
                            childs[childIndex].transform.position = prevGameObject.transform.position + new Vector3(0.0f, 0.0f, sign * displacementFactorDepth);
                        }
                        prevGameObject = childs[childIndex];
                        childIndex++;
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Calculate the positions of the child gameobjects in a corner.
        /// </summary>
        /// <param name="childs"></param>
        public static void Corner(List <GameObject> childs)
        {
            childs = DocumentSorter.SortingByHeightDesc(childs);

            float displacementFactorWidth = FindOutDisplacementFactorWidth(childs);
            float displacementFactorDepth = FindOutDisplacementFactorDepth(childs);

            int indexList = 0;
            int i         = 0;

            while (indexList < childs.Count)
            {
                int x = i;

                for (int y = 0; y >= -i && indexList < childs.Count; y--, x--, indexList++)
                {
                    childs[indexList].transform.position = new Vector3(x * displacementFactorWidth, 0.0f, y * displacementFactorDepth);
                }
                i++;
            }
        }