Exemple #1
0
        /// <summary>
        /// Moves the snake one cell in the direction specified by MovementDirection.
        /// </summary>
        public void Move()
        {
            int x = Head.Cell.X;
            int y = Head.Cell.Y;

            if (MovementDirection.GetAxis() == Axis2D.X)
            {
                x += MovementDirection.Sign();
            }
            else
            {
                y += MovementDirection.Sign();
            }
            _history.AddFirst(new MovementNode(PlayArea[x, y], MovementDirection));
            _history.RemoveLast();
        }