Beispiel #1
0
        public void DrawAnimals(Field field, List <Animal> additionalAnimal)
        {
            for (int currentRow = 0; currentRow < field.Height; currentRow++)
            {
                for (int currentColumn = 0; currentColumn < field.Width; currentColumn++)
                {
                    var currentAnimal = _genericAnimal.FindInField(field, currentColumn, currentRow);

                    if (currentAnimal == null)
                    {
                        _facade.Write(TextParameters.Empty);
                    }
                    else if (currentAnimal.Alive)
                    {
                        _facade.Write(currentAnimal.Symbol);
                    }
                    if (currentColumn == field.Width - 1)
                    {
                        _facade.WriteLine(TextParameters.Return);
                    }
                }
            }
        }
Beispiel #2
0
        public void Execute(string input)
        {
            console.WriteLine("You are carrying:");
            using (repository)
            {
                var sack = repository.AsQueryable().Where(qq => qq.RoomId == 2);
                foreach (var item in sack)
                {
                    console.Write("{0}  ", item.ItemName);
                }

                /* Reminder: RoomId 2 is the inventory "room".
                 */
            }
        }
Beispiel #3
0
        public void DrawGame(Field field)
        {
            for (int currentRow = 0; currentRow < field.Height; currentRow++)
            {
                for (int currentColumn = 0; currentColumn < field.Width; currentColumn++)
                {
                    var currentCell = field.Cells[currentRow, currentColumn];
                    if (currentCell)
                    {
                        facade.Write(Texts.Symbol);
                        AddLiveCells();
                    }
                    else
                    {
                        facade.Write(Texts.Empthy);
                    }

                    if (currentColumn == field.Width - 1)
                    {
                        facade.WriteLine(Texts.Return);
                    }
                }
            }
        }
Beispiel #4
0
 public void Run()
 {
     while (true)
     {
         console.Write(">> ");
         var input = console.ReadLine();
         if (input == "exit")
         {
             break;
         }
         if (command.IsValid(input))
         {
             command.Execute(input);
         }
         else
         {
             console.WriteLine(input);
         }
     }
 }