コード例 #1
0
 public static void Main(string[] args)
 {
     Playfield playfield = new Playfield();
     GameEngine engine = new GameEngine(playfield);
     AssignEvents(engine, engine.UserInput);
     engine.Run();
 }
コード例 #2
0
 public GameEngine(Playfield playfield)
 {
     this.Playfield = playfield;
     this.UserInput = new ConsoleInput();
     this.Messages = new Messages();
     this.Scoreboard = new ScoreBoard();
     this.Score = 0;
     this.HasGameQuit = false;
 }
コード例 #3
0
        public static bool IsValidMove(Playfield playfield, Direction nextDirection)
        {
            int playerCurrentRow = playfield.PlayerPosition.Row;
            int playerCurrentCol = playfield.PlayerPosition.Col;
            Position playerCurrentPosition = new Position(playerCurrentRow, playerCurrentCol);

            if (playerCurrentPosition.IsWinner())
            {
                return false;
            }

            playerCurrentPosition.MoveAtDirection(nextDirection);

            int[,] fieldGrid = playfield.LabyrinthGrid;
            return IsValidPosition(fieldGrid, playerCurrentPosition);
        }