Esempio n. 1
0
            private void _Traverse(HBox hb)
            {
                BoxPath hbpath = B;

                for (int i = 0; i < hb.Boxes.Count; i++)
                {
                    B = hbpath.Clone();
                    B.P.Add(new HBoxLink(hb, i));
                    Traverse(hb.Boxes[i]);
                }
            }
    // Start is called before the first frame update
    void Start()
    {
        particleSys = transform.GetChild(0).gameObject;

        Vector2 size    = transform.GetComponent <BoxCollider2D>().size;
        float   offsetX = -size.x / 2;
        float   offsetY = size.y / 2;

        particleSys.GetComponent <Transform>().localPosition = new Vector2(offsetX, offsetY);

        BoxPath bp = particleSys.GetComponent <BoxPath>();

        bp.points[0] = new Vector3(size.x + offsetX, offsetY, transform.position.z);
        bp.points[1] = new Vector3(size.x + offsetX, -size.y + offsetY, transform.position.z);
        bp.points[2] = new Vector3(offsetX, -size.y + offsetY, transform.position.z);
        bp.points[3] = new Vector3(offsetX, offsetY, transform.position.z);
        bp.speed     = size.x * 2.5f;
    }
Esempio n. 3
0
 static void SetBoxColor(BoxPath boxPath, Box boxToColor)
 {
     if (boxToColor.Row == 0 && boxToColor.Column == 0)
     {
         Console.BackgroundColor = ConsoleColor.Red;
     }
     else if (boxToColor.Row == 4 && boxToColor.Column == 4)
     {
         Console.BackgroundColor = ConsoleColor.Red;
     }
     else if ((boxPath != null) && (boxPath.IsFoundBox(boxToColor)))
     {
         Console.BackgroundColor = ConsoleColor.Green;
     }
     else
     {
         Console.BackgroundColor = ConsoleColor.Blue;
     }
 }
Esempio n. 4
0
            private void _Traverse(DelimitedBox db)
            {
                // FIXME: this is wrong according to TeXbook: whole delimitedbox should become one atom of type Inner. But that only applies to \left \right
                // formulations; not clear should apply to all uses of parens, and right now there may even be issues with function call spacing. Need to
                // look at this more.
                BoxPath dbpath = B;

                B = dbpath.Clone();
                B.P.Add(new DelimitedBoxLink(db, DelimitedBoxLink.Which.Left));
                Traverse(db.Left);

                B = dbpath.Clone();
                B.P.Add(new DelimitedBoxLink(db, DelimitedBoxLink.Which.Contents));
                Traverse(db.Contents);

                B = dbpath.Clone();
                B.P.Add(new DelimitedBoxLink(db, DelimitedBoxLink.Which.Right));
                Traverse(db.Right);
            }
Esempio n. 5
0
            public void TraverseTop(Box box)
            {
                _toplevel = box;
                Traverse(box);
                // then do the end boundary case
                A = B; // Probably unnecessary
                B = null;
                ConsiderPair();

                if (_traverseType == TraverseType.Spacing)
                {
                    foreach (KeyValuePair <List <Box>, SortedDictionary <int, Box> > kvp in _listBoxInserts)
                    {
                        int offset = 0;
                        foreach (KeyValuePair <int, Box> kvp2 in kvp.Value)
                        {
                            kvp.Key.Insert(kvp2.Key + offset, kvp2.Value);
                            offset++;
                        }
                    }
                }
            }
Esempio n. 6
0
        static void ShowMatrix(EuklidesSquareBox squareBox, BoxPath boxPath = null)
        {
            string line = "---------------------";

            Console.WriteLine("");
            Console.WriteLine(line);
            Box currentBox;

            for (int row = 0; row < 5; row++)
            {
                for (int col = 0; col < 5; col++)
                {
                    currentBox = squareBox.matrix[row, col];
                    Console.Write($"|");
                    SetBoxColor(boxPath, currentBox);
                    Console.Write($" {currentBox.Value} ");
                    ReSetBoxColor();
                }
                Console.WriteLine($"|");
                Console.WriteLine(line);
            }
            Console.WriteLine("");
        }
Esempio n. 7
0
 private void Leaf()
 {
     ConsiderPair();
     A = B;
 }