Example #1
0
 /// <summary>
 /// Načte do pole správné data pro vykreslení
 /// </summary>
 /// <param name="array"></param>
 public void Refresh(Box[,] array)
 {
     for (int i = 0; i < GameArray.GetLength(0); i++)
     {
         for (int j = 0; j < GameArray.GetLength(1); j++)
         {
             if (array[i, j] == Box.Nothing)
             {
                 GameArray[i, j] = NothingDefinition;
             }
             else if (array[i, j] == Box.Wall)
             {
                 GameArray[i, j] = WallDefinition;
             }
             else if (array[i, j] == Box.Food)
             {
                 GameArray[i, j] = FoodDefiniton;
             }
             else if (array[i, j] == Box.Snake)
             {
                 GameArray[i, j] = SnakeDefinition;
             }
             else if (array[i, j] == Box.poisonedFood)
             {
                 GameArray[i, j] = poisonedFoodDefinition;
             }
         }
         Console.WriteLine();
     }
 }
Example #2
0
 /// <summary>
 /// Vykreslí pole
 /// </summary>
 public void Show()
 {
     for (int i = 0; i < GameArray.GetLength(0); i++)
     {
         for (int j = 0; j < GameArray.GetLength(1); j++)
         {
             Console.Write(GameArray[i, j]);
         }
         Console.WriteLine();
     }
 }
Example #3
0
        /// <summary>
        /// Naplní pole základními daty (zdi)
        /// </summary>
        private void FillArray()
        {
            for (int i = 0; i < GameArray.GetLength(0); i++)
            {
                for (int j = 0; j < GameArray.GetLength(1); j++)
                {
                    GameArray[i, j] = Box.Nothing;

                    GameArray[LeghtX - 1, j] = Box.Wall;
                    GameArray[i, LeghtY - 1] = Box.Wall;
                }
            }

            for (int i = 0; i < GameArray.GetLength(0); i++)
            {
                GameArray[0, i] = Box.Wall;
                GameArray[i, 0] = Box.Wall;
            }

            GenerateFood();
            GenerateFood();
            GenerateFood();
        }