Code wizard introduction from Ukraine

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
public class NumberWizard : MonoBehaviour
 {
     int max = 1000;
     int min = 1;
     int guess = 500;
       
    void Start()
      {

        StartGame();


      }

    void StartGame()
     {
       Debug.Log("Ласкаво просимо до \"Чарівних чисел\" ");
       Debug.Log("Обери число, але не кажи мені яке...");
       Debug.Log("Найбільше число яке ти можеш обрати: " + max);
       Debug.Log("Найменше : " + min);
       Debug.Log("Скажи, твоє число більше, чи менше за " + guess);
       Debug.Log("Натисни \"стрілку вгору\" якщо більше , \"стрілку вниз\" якщо менше, натисни  \"Enter\" якщо я вгадаю число");
       max = max + 1;

      }

     // Update is called once per frame
    void Update()
         {
            if (Input.GetKeyDown(KeyCode.UpArrow))
             {
               min = guess;
               guess = (max + min) / 2;
               Debug.Log(" Це більше чи менше за ..." + guess);
            }

         else if (Input.GetKeyDown(KeyCode.DownArrow))
           {

             max = guess;
             guess = (max + min) / 2;
             Debug.Log(" Це більше чи менше за ..." + guess);
          }

      else if (Input.GetKeyDown(KeyCode.Return))
         {
        Debug.Log("Я геній !!!");
         }
     }
  }

Privacy & Terms