Number Wizard

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

public class NumberWizard : MonoBehaviour
{

int max = 1000;
int min = 1;
int guess = 500;

// Use this for initialization
void Start()
{
    Debug.Log("Hola amigo! this is number wizard...");
    Debug.Log("Pick a number, but please, don't tell me, I have the power of divination...");
    Debug.Log("The highest number you can pick is: " + max);
    Debug.Log("The lowest number you can pick is: " + min);
    Debug.Log("Tell me if your number is higher or lower than: " + guess);
    Debug.Log("Push Up = higher, Push Down = lower, Push Enter = Correct");

    max += 1;
}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.UpArrow)) {
        Debug.Log("It seems as you are aiming higher.");
        min = guess;
        guess = (max + min) / 2;
        Debug.Log("Let's see... Is it higher or lower than: " + guess);
    }

    else if (Input.GetKeyDown(KeyCode.DownArrow)) {
        Debug.Log("Are you afraid of high numbers? Were you good at math?");
        max = guess;
        guess = (max + min) / 2;
        Debug.Log("Let's see... Is it higher or lower than: " + guess);
    }

    else if (Input.GetKeyDown(KeyCode.Return)) {
        Debug.Log("I told you, I HAVE A GREAT POWER!");
    }
}

}

Privacy & Terms