Ejemplo n.º 1
0
        public void InitGame()
        {
            //var game = Control.Instance;

            //this.visualization.PrintStartMessage();

            //var labyrinth = game.Setup.SetupNewLabyrinth();
            //game.State.IsInitialized = true;

            IObjectFactory instanceFactory = new ObjectFactory();
             Labyrinth labyrinth = new Labyrinth(LabyrinthSize, LabyrinthSize, instanceFactory);
            GameObjectsGenerator generator = new GameObjectsGenerator();
            generator.GenerateObjectsNew(labyrinth);

            this.visualization.PrintMessage("Labyrinth is Ready");

            this.visualization.DrawLabyrinth(labyrinth);
            MovesFactory movesFactory = new MovesFactory(labyrinth);
            while (!labyrinth.State.IsFinished)
            {
                IMoves move = this.visualization.GetUserCommand(movesFactory);
                move.Move();
                this.visualization.DrawLabyrinth(labyrinth);
            }
        }
Ejemplo n.º 2
0
        public bool MoveChecker(Position position)
        {
            Labyrinth Labyrinth = this.Labyrinth;

            if (position.Column >= Labyrinth.Columns || position.Column < 0 ||
                position.Row >= Labyrinth.Rows || position.Row < 0)
            {
                return(false);
            }
            else if (Labyrinth[position] is FreeSpace)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public void DrawLabyrinth(Labyrinth labyrinth)
        {
            for (int i = 0; i < labyrinth.Rows; i++)
            {
                for (int j = 0; j < labyrinth.Columns; j++)
                {
                    var currentGameObject = labyrinth[i, j];

                    char currentSymbol = currentGameObject.Visualization;
                    //Console.BackgroundColor = currentGameObject.BackgroundColor;
                    //Console.ForegroundColor = currentGameObject.ForegroundColor;

                    Console.Write(currentSymbol + " ");
                }
                Console.WriteLine();
            }

            Console.ResetColor();
        }
Ejemplo n.º 4
0
 public LabyrinthNavigation(Labyrinth labyrinth, Position position)
 {
     this.Labyrinth = labyrinth;
     this.CurrentPosition = position;
 }
Ejemplo n.º 5
0
 public LabyrinthNavigation(Labyrinth labyrinth)
 {
     this.Labyrinth = labyrinth;
     this.CurrentPosition = labyrinth.StartPosition;
 }
Ejemplo n.º 6
0
 public LabyrinthNavigation(Labyrinth labyrinth)
 {
     this.Labyrinth       = labyrinth;
     this.CurrentPosition = labyrinth.StartPosition;
 }
Ejemplo n.º 7
0
 public LabyrinthNavigation(Labyrinth labyrinth, Position position)
 {
     this.Labyrinth       = labyrinth;
     this.CurrentPosition = position;
 }