I am finished the first lecture

hi this is my code at first lecture its work very good …
i will move to the second lecture …
thanks Rick …
your great teacher …

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizerd : MonoBehaviour
{
    int max , min , guess ;
    void Start()
    {
        startGame(1,1000,500);
    }
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            min = guess;
            Debug.Log(NextGuess());
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            max = guess;
            Debug.Log(NextGuess());

        }
        else if (Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("I am great <3 .... ");
            startGame(1, 1000, 500);
            Debug.Log(guess);
        }
    }
    string NextGuess()
    {
        guess = (min + max) / 2;
        return "My Guess Is  ( " + guess + " )  if its right press enter";
    }

    void startGame(int min,int max,int guess)
    {
        this.min = min;
        this.max = max +1 ;
        this.guess = guess;

        Debug.Log("Welcome to number wizard ");
        Debug.Log("Pick an number , dont say what you pick ");
        Debug.Log("The highest number you can pick is : " + max);
        Debug.Log("The lowest number you can pick is : " + min);
        Debug.Log("tell mer if your number is higher or lower than : " + guess);
        Debug.Log("Pish Up = higher , Push Down = lower , correct guess = enter ");
    }
}

Privacy & Terms