Can't find NUmberWizard.cs Script

Hey, i’m on lecture 43 (lesson 43) on the Number Wizard UI (Section 5) and I can’t find the Number Wizard.cs script (code). Can any one help me with that, maybe like sending me the code so I can copy and paste to complete the Number Wizard UI project. Thank you!

  • Mathew
1 Like

Hey Matthew,

You can go back and look at the previous Number Wizard Section and the lecture project changes. For whatever reason I deleted my Number Wizard code so I had to do the same thing. I am pretty sure this is the completed version.

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("G'day mate, welcome to numba wiz-ud...");
    Debug.Log("Pick a number, don't tell me what it is...");
    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 = max + 1;
}

// Update is called once per frame
void Update ()
{
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        min = guess;
        guess = (max + min) / 2;
        Debug.Log("Is it higher or lower than..." + guess);
    }
    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        max = guess;
        guess = (max + min) / 2;
        Debug.Log("Is it higher or lower than..." + guess);
    }
    else if (Input.GetKeyDown(KeyCode.Return))
    {
        Debug.Log("I am a genius!");
    }
}

}

Privacy & Terms