public static void Main(string[] args) { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); AssignEvents(engine, engine.UserInput); engine.Run(); }
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; }
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); }