SlovakiaWizardChallenge

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Magic : MonoBehaviour
{
    static int min = 1;
    static int max = 1000;
    int guess = 500;
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Ahoj vitaj v hre Magické čísla");
        Debug.Log(string.Format("Mysli si číslo väčšie ako {0} ale menšie ako {1}",min,max));
        max += 1; 
        
        
    }

    // Update is called once per frame
    void Update()
    {
     if(Input.GetKeyDown(KeyCode.DownArrow))
        {
            max = guess;
            guess = (max + min) / 2;
            Debug.Log("Myslím na nižšie číslo ako " + guess);
        }
     else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            min = guess;
            guess = (max + min) / 2;

            Debug.Log("Ops, myslím navyššie číslo ako " + guess);
        }
     else if (Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("Správne, myslel som " + guess);
        }
    }

    
}

Privacy & Terms