Unit 3 Activity 1
Unit 3 Activity 2
using UnityEngine;
using System.Collections;
public class NumberWizard : MonoBehaviour {
int max;
int min;
int guess;
// Use this for initialization
void Start () {
min = 1;
guess = Random.Range(min, max);
print ("------------------------------------");
print ("Welcome to Guess That Number!");
print ("Pick a number in your head from 1-10000 but DO NOT tell me");
print ("Pick the range that your number is in .");
print ("------------------------------------");
print ("For a range of 1-10 - Press 1");
print ("------------------------------------");
print ("For a range of 1-100 - Press 2");
print ("------------------------------------");
print ("For a range of 1-1000 - Press 3");
print ("------------------------------------");
print ("For a range of 1-10000 - Press 4");
print ("------------------------------------");
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.Alpha1)) {
print ("You have pressed 1 for a range of 1-10");
max = 10+1;
NextGuess();
} else
if (Input.GetKeyDown (KeyCode.Alpha2)) {
print ("You have pressed 2 for a range of 1-100");
max = 100+1;
NextGuess();
} else
if (Input.GetKeyDown (KeyCode.Alpha3)) {
print ("You have pressed 3 for a range of 1-1000");
max = 1000+1;
NextGuess();
} else
if (Input.GetKeyDown (KeyCode.Alpha4)) {
print ("You have pressed 4 for a range of 1-10000");
max = 10000+1;
NextGuess();
}
if (Input.GetKeyDown (KeyCode.UpArrow)) {
print ("UpArrow key was pressed");
min = guess;
NextGuess ();
} else
if (Input.GetKeyDown(KeyCode.DownArrow)) {
print ("DownArrow key was pressed");
max = guess;
NextGuess();
}else
if (Input.GetKeyDown (KeyCode.Space)) {
print ("You lost, The game has now restarted");
Application.LoadLevel(Application.loadedLevel);
}
}
void NextGuess() {
guess = Random.Range(min,max);
print ("Is it higher or lower than " + guess);
print ("UpArrow for higher, DownArrow for lower, and Space for equal and restart.");
}
}
Unit 3- Number Wizard 2.0
https://onedrive.live.com/redir?resid=5229DF98D28CBB4A!109&authkey=!AKFPDtoLfwMf8c0&ithint=folder%2chtml
Unit 3- Escape