示例#1
0
文件: Program.cs 项目: fkribs/Snake
        private static async Task ProcessBoardState()
        {
            TheBoard.CheckCollisions();
            var front = TheBoard.GetPlayerFront();

            switch (CurrentDirection)
            {
            case PlayerDirection.Up:
                front.Y -= 1;
                break;

            case PlayerDirection.Down:
                front.Y += 1;
                break;

            case PlayerDirection.Left:
                front.X -= 1;
                break;

            case PlayerDirection.Right:
                front.X += 1;
                break;
            }
            TheBoard.MovePlayer(front);
            TheBoard.Refresh();
        }