Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions GuessBot(UI)(levelManager)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LevelManager : MonoBehaviour
{
public void LoadLevel(string name)
{
Debug.Log("Level load requested for"+name);
Application.LoadLevel(name);
}


public void QuitRequest()
{
Debug.Log("I wanna quit!");
Application.Quit();
}
}
71 changes: 71 additions & 0 deletions GuessBot(UI)(main_script)
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

using UnityEngine;

using System.Collections;
using UnityEngine.UI;



public class GuessGame : MonoBehaviour {



public int max=1000,min=1,guess;

public int MaxGuesses=12;

public Text text;



void Start ()
{
StartGame();

}

void StartGame()
{
max=1000;
min=1;
nextguess();

}

public void nextguess()

{

guess = Random.Range(min,max+1);
text.text=guess.ToString();
MaxGuesses=MaxGuesses-1;
if(MaxGuesses<=0)
{
Application.LoadLevel("Win");
}



}


public void GuessHigh()
{

min = guess;

nextguess();

}

public void GuessLow()
{
max = guess;

nextguess();
}




}
55 changes: 55 additions & 0 deletions GuessTheNumberGame
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using UnityEngine;
using System.Collections;

public class NoWiz : MonoBehaviour {

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

void Start ()

{

game();
max=max+1;
}
void game ()
{
print("WELCOME TO THE NUMBER WIZARD CONSOLE GAME");
print("Pick a number in ur head,without telling me:");
print("The Highest Number you can pick is " +max);
print("The lowest Number you can pick is " +min);

print("Is the number you picked higher or lower than " +guess);
print("Press UP Arrow key for higher ,DOWN Arrow key for lower ,RETURN for equal");

}
void nextguess()
{
guess=(max+min)/2;
print("Higher or lower than " +guess);
print("Press UP Arrow key for higher,DOWN Arrow key for lower ,enter for equal");

}


void Update ()

{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
nextguess();
}

if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
nextguess();
}

if (Input.GetKeyDown(KeyCode.Return))
{
print("The no. you guessed is"+guess);
}
}
}
Loading