/// <summary>
        /// Resets the position of the line.
        /// </summary>
        /// <param name="r">Random number generator.</param>
        /// <param name="matrixCode">Base MatrixCode object.</param>
        /// <param name="min">Lowest y coordinate that we can reset to.</param>
        private void Reset(Random r, MatrixCode matrixCode, int min = 0)
        {
            int length = r.Next(3, matrixCode.WINDOW_HEIGHT / 2);

            this.Start  = -r.Next(min);
            this.Middle = this.Start - length;
            this.End    = this.Middle - length;
        }
        /// <summary>
        /// Performs one tick on the line.
        /// </summary>
        /// <param name="charGrid">Grid of characters.</param>
        /// <param name="matrixCode">Base Matrix Code object.</param>
        public void Tick(char[,] charGrid, MatrixCode matrixCode)
        {
            Start++;
            Middle++;
            End++;
            if (Start < 0)
            {
                return;
            }
            if (End >= matrixCode.WINDOW_HEIGHT)
            {
                Reset(new Random(), matrixCode);
                return;
            }

            if (Start <= matrixCode.WINDOW_HEIGHT)
            {
                if (Start < matrixCode.WINDOW_HEIGHT)
                {
                    CharUpdateEvent?.Invoke(XPos, Start, charGrid[XPos, Start], matrixCode.CurrentColor.c1);
                }
                if (Start > 0)
                {
                    CharUpdateEvent?.Invoke(XPos, Start - 1, charGrid[XPos, Start - 1], matrixCode.CurrentColor.c2);
                }
            }

            if (Middle < 0)
            {
                return;
            }
            if (Middle < matrixCode.WINDOW_HEIGHT)
            {
                CharUpdateEvent?.Invoke(XPos, Middle, charGrid[XPos, Middle], matrixCode.CurrentColor.c3);
            }
            if (End < 0)
            {
                return;
            }
            CharUpdateEvent?.Invoke(XPos, End, charGrid[XPos, End], -1);
        }
 /// <summary>
 /// Constructor for a Matrix Line.
 /// </summary>
 /// <param name="x">X position of the line.</param>
 /// <param name="matrixCode">Base MatrixCode object.</param>
 /// <param name="r">Random number generator.</param>
 public MatrixLine(int x, MatrixCode matrixCode, Random r)
 {
     this.XPos = x;
     Reset(r, matrixCode, matrixCode.WINDOW_HEIGHT);
 }