Пример #1
0
        /// <summary>
        /// Change one character in the line to a different character.
        /// </summary>
        /// <param name="y">Y position to change.</param>
        /// <param name="character">Character to change to.</param>
        /// <param name="colors">Current color set to use.</param>
        public void ChangeChar(int y, char character, ColorSet colors)
        {
            if (y >= this.Start || y <= this.End)
            {
                return;
            }

            int color = -1;

            if (y < Start && y >= Middle)
            {
                color = colors.c2;
            }
            else
            {
                color = colors.c3;
            }
            CharUpdateEvent?.Invoke(XPos, y, character, color);
        }
Пример #2
0
        /// <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);
        }